示例#1
0
 private void validateIdentificationParameter(OptimizedParameterDTO optimizedParameterDTO, IdentificationParameter identificationParameter, double optimalValue, double startValue)
 {
     optimizedParameterDTO.Name.ShouldBeEqualTo(identificationParameter.Name);
     optimizedParameterDTO.OptimalValue.DisplayValue.ShouldBeEqualTo(identificationParameter.StartValueParameter.ConvertToDisplayUnit(optimalValue));
     optimizedParameterDTO.StartValue.DisplayValue.ShouldBeEqualTo(identificationParameter.StartValueParameter.ConvertToDisplayUnit(startValue));
     optimizedParameterDTO.MinValue.DisplayValue.ShouldBeEqualTo(identificationParameter.MinValueParameter.ValueInDisplayUnit);
     optimizedParameterDTO.MaxValue.DisplayValue.ShouldBeEqualTo(identificationParameter.MaxValueParameter.ValueInDisplayUnit);
     optimizedParameterDTO.ValueIsCloseToBoundary.ShouldBeFalse();
     optimizedParameterDTO.RangeImage.ShouldNotBeNull();
 }
示例#2
0
        private OptimizedParameterDTO mapFrom(IdentificationParameter identificationParameter, double optimalValue, double startValue)
        {
            var dto = new OptimizedParameterDTO
            {
                Name         = identificationParameter.Name,
                OptimalValue = mapFrom(optimalValue, identificationParameter.StartValueParameter),
                StartValue   = mapFrom(startValue, identificationParameter.StartValueParameter),
                MinValue     = mapFrom(identificationParameter.MinValue, identificationParameter.MinValueParameter),
                MaxValue     = mapFrom(identificationParameter.MaxValue, identificationParameter.MaxValueParameter),
                Scaling      = identificationParameter.Scaling
            };

            dto.RangeImage = _optimizedParameterRangeImageCreator.CreateFor(dto);
            return(dto);
        }
        public Image CreateFor(OptimizedParameterDTO optimizedParameterDTO)
        {
            _chart.Series.Clear();
            var minValue     = getValueAccordingToScaling(optimizedParameterDTO.MinValue.Value, optimizedParameterDTO.Scaling);
            var maxValue     = getValueAccordingToScaling(optimizedParameterDTO.MaxValue.Value, optimizedParameterDTO.Scaling);
            var startValue   = getValueAccordingToScaling(optimizedParameterDTO.StartValue.Value, optimizedParameterDTO.Scaling);
            var optimalValue = getValueAccordingToScaling(optimizedParameterDTO.OptimalValue.Value, optimizedParameterDTO.Scaling);

            createPointSeries("seriesBoundary", MarkerKind.Diamond, minValue, maxValue).LegendText = Captions.Boundary;
            createPointSeries("seriesOptimal", MarkerKind.Circle, optimalValue).LegendText         = Captions.OptimalValue;
            createPointSeries("seriesStart", MarkerKind.Square, startValue).LegendText             = Captions.StartValue;

            _chart.XYDiagram.AxisY.Visibility = DefaultBoolean.False;
            _chart.XYDiagram.AxisY.WholeRange.AutoSideMargins = false;
            _chart.XYDiagram.DefaultPane.BorderVisible        = false;

            var image = new Bitmap(_chartSize.Width, _chartSize.Height);

            _chart.DrawToBitmap(image, new Rectangle(Point.Empty, _chartSize));
            return(image);
        }
        public Image CreateLegendFor(OptimizedParameterDTO optimizedParameterDTO)
        {
            CreateFor(optimizedParameterDTO);

            var legendBitmap = new Bitmap(110, 55);

            using (var clonedChart = (ChartControl)_chart.Clone())
            {
                clonedChart.Legend.Visibility        = DefaultBoolean.True;
                clonedChart.BorderOptions.Visibility = DefaultBoolean.False;
                clonedChart.Padding.All = 0;
                clonedChart.Legend.Border.Visibility   = DefaultBoolean.False;
                clonedChart.Legend.Margins.All         = 0;
                clonedChart.Legend.Padding.All         = 0;
                clonedChart.Legend.BackColor           = Color.Transparent;
                clonedChart.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.LeftOutside;
                clonedChart.Legend.AlignmentVertical   = LegendAlignmentVertical.TopOutside;

                ((XYDiagram)clonedChart.Diagram).DefaultPane.Visibility = ChartElementVisibility.Hidden;
                clonedChart.DrawToBitmap(legendBitmap, new Rectangle(Point.Empty, legendBitmap.Size));
            }
            return(legendBitmap);
        }
        private RepositoryItem nameRepositoryFor(OptimizedParameterDTO optimizedParameterDTO)
        {
            var nameRepository = new UxRepositoryItemImageComboBox(_gridViewBinder.GridView, _imageListRetriever);

            return(nameRepository.AddItem(optimizedParameterDTO.Name, optimizedParameterDTO.BoundaryCheckIcon));
        }
示例#6
0
 private void addOptimizedParameterDTOTo(ParameterIdentificationRunResultDTO runResultDTO, OptimizedParameterDTO optimizedParameterDTO)
 {
     if (optimizedParameterDTO != null)
     {
         runResultDTO.AddOptimizedParameter(optimizedParameterDTO);
         if (runResultDTO.LegendImage == null)
         {
             runResultDTO.LegendImage = _optimizedParameterRangeImageCreator.CreateLegendFor(optimizedParameterDTO);
         }
     }
 }