Commit 05835ba8 authored by Francesco Carraro's avatar Francesco Carraro
Browse files

fixes

parent 245bd846
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -132,10 +132,10 @@
      <Version>8.0.0</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Analytics">
      <Version>4.5.3</Version>
      <Version>5.0.1</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Crashes">
      <Version>4.5.3</Version>
      <Version>5.0.1</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection">
      <Version>7.0.0</Version>
+11 −6
Original line number Diff line number Diff line
@@ -207,30 +207,35 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart

        #region clone
        public IChartSpectrumModel getClonedSpectrum<T>(SpectrumType srcType,
                                                        SpectrumType destType) where T : IChartSpectrumModel
                                                        SpectrumType destType,
                                                        SpectrumLevel spectrumLevel) where T : IChartSpectrumModel
        {
            (IChartSpectrumModel destSpectrum, IChartSpectrumModel rawSpectrumClone) result = getElementsForClone<T>(srcType,
                                                                                                                     destType);
                                                                                                                     destType,
                                                                                                                     spectrumLevel);
            result.destSpectrum.Elements = result.rawSpectrumClone.Elements;

            return result.destSpectrum;
        }

        public IChartSpectrumModel getEmptyClonedSpectrum<T>(SpectrumType srcType,
                                                             SpectrumType destType) where T : IChartSpectrumModel
                                                             SpectrumType destType,
                                                             SpectrumLevel spectrumLevel) where T : IChartSpectrumModel
        {
            (IChartSpectrumModel destSpectrum, IChartSpectrumModel rawSpectrumClone) result = getElementsForClone<T>(srcType,
                                                                                                                     destType);
                                                                                                                     destType,
                                                                                                                     spectrumLevel);

            return result.destSpectrum;
        }

        private (IChartSpectrumModel destSpectrum, IChartSpectrumModel rawSpectrumClone) getElementsForClone<T>(SpectrumType srcType,
                                                                                                                SpectrumType destType) where T : IChartSpectrumModel
                                                                                                                SpectrumType destType,
                                                                                                                SpectrumLevel spectrumLevel) where T : IChartSpectrumModel
        {
            var rawSpectrumClone = (IChartSpectrumModel)spectraContainer.tryGetSpectrumOfType(srcType).Clone();

            var destSpectrum = (T)Activator.CreateInstance(typeof(T), new object[] { serviceProvider, destType, rawSpectrumClone.Filename, rawSpectrumClone.Filepath });
            var destSpectrum = (T)Activator.CreateInstance(typeof(T), new object[] { serviceProvider, destType, spectrumLevel, rawSpectrumClone.Filename, rawSpectrumClone.Filepath });

            destSpectrum.ParentId = rawSpectrumClone.Id;
            destSpectrum.setColor();
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
  <Identity
    Name="INAF.Apps.Uwp.SLabDataManager"
    Publisher="CN=INAF-IAPS, O=INAF, C=IT"
    Version="1.0.16.0" />
    Version="1.0.17.0" />

  <mp:PhoneIdentity PhoneProductId="07F38165-05DE-4ED7-8514-60D1E8CDCBFE" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

+5 −2
Original line number Diff line number Diff line
@@ -125,10 +125,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
                                .tryGetSpectrumOfType(SpectrumType.Continuum);
            else
                continuum = spectraFactory.getEmptyClonedSpectrum<ChartSpectrumModel>(srcType: SpectrumType.Aligned,
                                                                                      destType: SpectrumType.Continuum);
                                                                                      destType: SpectrumType.Continuum,
                                                                                      spectrumLevel: SpectrumLevel.Averaged);

            /* clone aligned spectrum and extract points belonging to selected fit-segment */
            IEnumerable<ElementModel> range = spectraFactory.getClonedSpectrum<ChartSpectrumModel>(srcType: SpectrumType.Aligned, destType: SpectrumType.Continuum)
            IEnumerable<ElementModel> range = spectraFactory.getClonedSpectrum<ChartSpectrumModel>(srcType: SpectrumType.Aligned,
                                                                                                   destType: SpectrumType.Continuum,
                                                                                                   spectrumLevel: SpectrumLevel.Averaged)
                                                            .getRange(segmentFitModel.P1.X, segmentFitModel.P2.X);

            /* show panel with segments */
+4 −2
Original line number Diff line number Diff line
@@ -118,7 +118,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
            /* clone spectrum for smoothing */
            var spectraFactory = serviceProvider.GetRequiredService<SpectraFactory>();
            var clonedSpectrum = spectraFactory.getClonedSpectrum<ChartSpectrumOfTypeSmoothedModel>(srcType: SmoothingViewModel.SelectedSpectrumType,
                                                                                                    destType: destSpectrumType);
                                                                                                    destType: destSpectrumType,
                                                                                                    spectrumLevel: SpectrumLevel.Averaged);

            /* apply smoothing */
            (IChartSpectrumModel smoothedSpectrum, bool isOk) smoothingResult = await SmoothingViewModel.applySmoothingToSegments(clonedSpectrum);
@@ -211,7 +212,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
            /* clone spectrum for smoothing */
            var spectraFactory = serviceProvider.GetRequiredService<SpectraFactory>();
            var clonedSpectrum = spectraFactory.getClonedSpectrum<ChartSpectrumOfTypeSmoothedModel>(srcType: srcSpectrumType,
                                                                                                    destType: destSpectrumType);
                                                                                                    destType: destSpectrumType,
                                                                                                    spectrumLevel: SpectrumLevel.Averaged);

            /* apply smoothing */
            (IChartSpectrumModel smoothedSpectrum, bool isOk) smoothingResult = await SmoothingViewModel.applySmoothingToSpectrum(clonedSpectrum);
Loading