Esempio n. 1
0
        /// <summary>
        ///     Shows a plot of the sampler with the specified name if the sampler does
        ///     not exist it is created.
        /// </summary>
        public void ShowPlot(String samplerName)
        {
            // Check if the plot exist already.
            foreach (var p in _plots) {
                if (p.Sampler.Name == samplerName)
                    return;
            }
            var sampler = GearsetResources.Console.DataSamplerManager.GetSampler(samplerName);
            if (sampler == null)
                return;

            var position = GetNextPosition();
            var plot = new Plot(sampler, position, Config.DefaultSize);
            _plots.Add(plot);

            // Hide all plots that are beign hidden.
            plot.Visible = !Config.HiddenPlots.Contains(samplerName);

            plot.VisibleChanged += plot_VisibleChanged;

            _lastPlotAdded = plot;
        }
Esempio n. 2
0
 // TODO: move this to the DataSampler class.
 static void GetLimits(Plot plot, out float min, out float max)
 {
     max = float.MinValue;
     min = float.MaxValue;
     foreach (var value in plot.Sampler.Values) {
         if (value > max)
             max = value;
         if (value < min)
             min = value;
     }
     max = (float)Math.Ceiling(max);
     min = (float)Math.Floor(min);
 }
Esempio n. 3
0
 /// <summary>
 ///     Removes a plot, if ShowPlot is called again for this plot, it will be shown
 ///     again
 /// </summary>
 /// <param name="name">Name of the plot to remove.</param>
 public void RemovePlot(String name)
 {
     _plotBeignRemoved = null;
     foreach (var plot in _plots) {
         if (plot.Sampler.Name == name) {
             _plotBeignRemoved = plot;
             break;
         }
     }
     if (_plotBeignRemoved != null) {
         _plotBeignRemoved.Visible = false;
         _plots.Remove(_plotBeignRemoved);
         _plotBeignRemoved = null;
     }
 }