private void SetFrequencyAxisFromConfig(RadioBandPlotConfig config)
 {
     _radioBandPlotConfig = config;
     DataTransform        = new RadioBandTransform(_radioBandPlotConfig);
     ((HorizontalAxis)MainHorizontalAxis).TicksProvider = new RadioBandFrequencyTicksProvider(_radioBandPlotConfig);;
     Children.RemoveAll <RadioBandFrequencyAxis>();
     _radioBandFrequencyAxis = new RadioBandFrequencyAxis(_radioBandPlotConfig);
     Children.Add(_radioBandFrequencyAxis);
 }
        public FrequencyRangeLabelsGridBuilder(RadioBandPlotConfig config, FrequencyLabelSet <RangeLabel> rangeLabels)
        {
            _config      = config;
            _rangeLabels = rangeLabels;
            _transform   = new RadioBandTransform(config);

            BuildFrequencyDividers();
            BuildColumns();
            MatchRangeLabelsToColumns();
            ExpandLabelsAcrossRows();
            FillInTheGaps();
        }
Esempio n. 3
0
        private IEnumerable <UIElement> CreateLabelTextBoxes()
        {
            if (_pointLabels.Count() == 0)
            {
                yield break;
            }

            RadioBandTransform transform = new RadioBandTransform(_config);

            double firstTick = _config.Ticks.First();
            double lastTick  = _config.Ticks.Last();

            double startPos    = transform.FrequencyToViewport(firstTick);
            double widthsTotal = startPos;

            int skip    = _pointLabels.First().Position <= firstTick ? 1 : 0;
            int skipEnd = lastTick <= _pointLabels.Last().Position ? 1 : 0;

            int columnNo = 0;

            if (skip == 1)
            {
                var textBlock = CreateTextBlock(columnNo, _pointLabels.First().LabelText);
                textBlock.SetValue(Grid.ColumnSpanProperty, 1);
                textBlock.TextAlignment       = TextAlignment.Left;
                textBlock.HorizontalAlignment = HorizontalAlignment.Left;
                textBlock.Margin = new Thickness(0);
                yield return(textBlock);
            }
            ++columnNo;
            foreach (var pointLabel in _pointLabels.Skip(skip).Take(_pointLabels.Count() - skip - skipEnd))
            {
                var textBlock = CreateTextBlock(columnNo, pointLabel.LabelText);
                yield return(textBlock);

                columnNo += 2;
            }
            --columnNo;
            // If the last tick is after the labels, then we need an extra column
            if (skipEnd == 1)
            {
                var textBlock = CreateTextBlock(columnNo, _pointLabels.Last().LabelText);
                textBlock.SetValue(Grid.ColumnSpanProperty, 1);
                textBlock.TextAlignment       = TextAlignment.Right;
                textBlock.HorizontalAlignment = HorizontalAlignment.Right;
                textBlock.Margin = new Thickness(0);
                yield return(textBlock);

                ++columnNo;
            }
        }
Esempio n. 4
0
 public FrequencyPointLabelsGridBuilder(RadioBandPlotConfig config, FrequencyPointLabels pointLabels)
 {
     _config      = config;
     _pointLabels = pointLabels;
     _transform   = new RadioBandTransform(config);
 }