Ejemplo n.º 1
0
        internal void LoadHeatMap(HeatMapInfo NewInfo)
        {
            try
            {
                if (NewInfo == null)
                {
                    ReleaseImage();
                    return;
                }

                //already loaded
                if (HeatMap != null && NewInfo.Name == Info.Name)
                {
                    return;
                }

                Info = NewInfo;
                LoadImage();

                PanFreq              = 0;
                PanTicks             = 0;
                Zoom                 = 1;
                HeatMapHertzPerPixel = (Info.EndFreq - Info.StartFreq) / (float)HeatMap.Width;
                TimeTicksPerPixel    = (Info.EndTime - Info.StartTime).Ticks / (float)HeatMap.Height;

                if (Double.IsNaN(TimeTicksPerPixel) || Double.IsInfinity(TimeTicksPerPixel) || TimeTicksPerPixel <= 0 ||
                    Single.IsNaN(HeatMapHertzPerPixel) || Single.IsInfinity(HeatMapHertzPerPixel) || HeatMapHertzPerPixel <= 0)
                {
                    throw new Exception("Invalid dimensions");
                }

                Plugin.Settings.SelectedHeatMap = Info.Name;

                Invalidate();
            }
            catch (Exception ex)
            {
                ReleaseImage();
                throw new Exception(String.Format("Unable to load heat map '{0}', error: {1}", NewInfo.Name, ex.Message));
            }
        }
Ejemplo n.º 2
0
        private void PlusButton_Click(object sender, EventArgs e)
        {
            if (OpenFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            try
            {
                HeatMapInfo Info = HeatMapGenerator.Generate(OpenFileDialog.FileName);

                Plugin.Settings.HeatMaps.Add(Info);
                ListBox.SelectedIndex = ListBox.Items.Count - 1;

                Plugin.HeatMapPanel.LoadHeatMap(Info);
                EnabledCheckBox.Enabled = true;
                EnabledCheckBox.Checked = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to generate heat map. Error: " + ex.Message);
            }
        }