public MalaysiaMaxisReportForm(LimitSetting limitSetting, EMIFileData emiFileData, List<ChannelSetting> channelSettings) { mLimitSetting = limitSetting; mEmi = emiFileData; string bandName; foreach (ChannelSetting channelSetting in channelSettings) { bandName = GetBandName(channelSetting); if (!mAllBandChannels.ContainsKey(bandName)) { mAllBandChannels[bandName] = new List<ChannelSetting>(); } mAllBandChannels[bandName].Add(channelSetting); } mEmiDataMgr = Utility.GetEmiDataManager(mEmi, channelSettings); mExportStatusForm = new ExportStatusForm(this); InitializeComponent(); }
public static BitMapInfo create(EMIFileData emi, double azimuth, double actualAzimuth, string title, WatsEmiDataManager dataMgr, List<ChannelSetting> channelSettings, LimitSetting limitSetting, int minAbsRssi, int maxAbsRssi) { BitMapInfo bitMapInfo = new BitMapInfo(); List<WatsEmiSample> verticalSamples = new List<WatsEmiSample>(); List<WatsEmiSample> horizontalSamples = new List<WatsEmiSample>(); bitMapInfo.Title1 = title + " " + azimuth.ToString() + "\x00B0" + " V"; bitMapInfo.Title2 = title + " " + azimuth.ToString() + "\x00B0" + " H"; bitMapInfo.BmpFile1 = Utility.GetAppPath() + "\\Temp\\Site_" + emi.Site_ID + "_Azimuth_" + ((int)azimuth).ToString() + "_Vertical_" + (++counter).ToString() + ".emf"; bitMapInfo.BmpFile2 = Utility.GetAppPath() + "\\Temp\\Site_" + emi.Site_ID + "_Azimuth_" + ((int)azimuth).ToString() + "_Horizontal_" + (++counter).ToString() + ".emf"; for (int i = 0; i < dataMgr.AllSamples[actualAzimuth][0].Count; i++) { if (dataMgr.AllSamples[actualAzimuth][0][i].mFreq >= channelSettings[0].StartFreq && dataMgr.AllSamples[actualAzimuth][0][i].mFreq <= channelSettings[channelSettings.Count - 1].Pair.EndFreq) verticalSamples.Add(dataMgr.AllSamples[actualAzimuth][0][i]); } for (int i = 0; i < dataMgr.AllSamples[actualAzimuth][1].Count; i++) { if (dataMgr.AllSamples[actualAzimuth][1][i].mFreq >= channelSettings[0].StartFreq && dataMgr.AllSamples[actualAzimuth][1][i].mFreq <= channelSettings[channelSettings.Count - 1].Pair.EndFreq) horizontalSamples.Add(dataMgr.AllSamples[actualAzimuth][1][i]); } List<Marker> verticalMarkers = new List<Marker>(); List<Marker> hoizontalMarkers = new List<Marker>(); Marker marker; ChannelPower channelPower; foreach (ChannelSetting channelSetting in channelSettings) { channelPower = new ChannelPower(emi.SA_RBW, channelSetting, limitSetting, dataMgr.AllChannelSamples[actualAzimuth][channelSetting]); if (!channelPower.IsValidVPower) { marker = Utility.CreateMarker(channelSetting.ChannelName, dataMgr.AllChannelSamples[actualAzimuth][channelSetting].mVSamples); verticalMarkers.Add(marker); } if (!channelPower.IsValidVPairPower) { marker = Utility.CreateMarker(channelSetting.Pair.ChannelName, dataMgr.AllChannelSamples[actualAzimuth][channelSetting].mVPairSamples); verticalMarkers.Add(marker); } if (!channelPower.IsValidHPower) { marker = Utility.CreateMarker(channelSetting.ChannelName, dataMgr.AllChannelSamples[actualAzimuth][channelSetting].mHSamples); hoizontalMarkers.Add(marker); } if (!channelPower.IsValidHPairPower) { marker = Utility.CreateMarker(channelSetting.Pair.ChannelName, dataMgr.AllChannelSamples[actualAzimuth][channelSetting].mHPairSamples); hoizontalMarkers.Add(marker); } } verticalMarkers.Sort(Utility.SortMarkerByFrequency); hoizontalMarkers.Sort(Utility.SortMarkerByFrequency); drawPicture(emi, verticalSamples, channelSettings, limitSetting, bitMapInfo.BmpFile1, bitMapInfo.Title1, minAbsRssi, maxAbsRssi, verticalMarkers); drawPicture(emi, horizontalSamples, channelSettings, limitSetting, bitMapInfo.BmpFile2, bitMapInfo.Title2, minAbsRssi, maxAbsRssi, hoizontalMarkers); return bitMapInfo; }
/* public Dictionary<double, Dictionary<ChannelSetting, WatsEmiData>> AllChannelSamples = new Dictionary<double, Dictionary<ChannelSetting, WatsEmiData>>(); public Dictionary<double, Dictionary<int, List<WatsEmiSample>>> AllSamples = new Dictionary<double, Dictionary<int, List<WatsEmiSample>>>(); */ private static void SortEmiData(WatsEmiDataManager watsEmiDataMgr) { Dictionary<ChannelSetting, WatsEmiData> channelSamples; foreach (KeyValuePair<double, Dictionary<ChannelSetting, WatsEmiData>> pair in watsEmiDataMgr.AllChannelSamples) { channelSamples = pair.Value; foreach (KeyValuePair<ChannelSetting, WatsEmiData> pair2 in pair.Value) { pair2.Value.mHPairSamples.Sort(SortWatsEmiSampleByFreq); pair2.Value.mHSamples.Sort(SortWatsEmiSampleByFreq); pair2.Value.mVSamples.Sort(SortWatsEmiSampleByFreq); pair2.Value.mVPairSamples.Sort(SortWatsEmiSampleByFreq); } } Dictionary<int, List<WatsEmiSample>> samples; foreach (KeyValuePair<double, Dictionary<int, List<WatsEmiSample>>> pair in watsEmiDataMgr.AllSamples) { samples = pair.Value; foreach (KeyValuePair<int, List<WatsEmiSample>> pair2 in pair.Value) { pair2.Value.Sort(SortWatsEmiSampleByFreq); } } }
public static WatsEmiDataManager GetEmiDataManager(EMIFileData emiFileData, List<ChannelSetting> channelSettings) { WatsEmiDataManager watsEmiDataManager = new WatsEmiDataManager(); Dictionary<double, double> startFrequencys = new Dictionary<double, double>(); Dictionary<double, double> endFrequencys = new Dictionary<double, double>(); Dictionary<ChannelSetting, WatsEmiData> datas; Dictionary<int, List<WatsEmiSample>> samples = null; ChannelSetting curChannelSetting; WatsEmiData curData; foreach (DG_Type dataGroup in emiFileData.DataGroups) { if (!startFrequencys.ContainsKey(dataGroup.DG_FB_Angle)) startFrequencys[dataGroup.DG_FB_Angle] = dataGroup.DG_FB_Start; else if (dataGroup.DG_FB_Start < startFrequencys[dataGroup.DG_FB_Angle]) startFrequencys[dataGroup.DG_FB_Angle] = dataGroup.DG_FB_Start; if (!endFrequencys.ContainsKey(dataGroup.DG_FB_Angle)) endFrequencys[dataGroup.DG_FB_Angle] = dataGroup.DG_FB_End; else if (dataGroup.DG_FB_End > endFrequencys[dataGroup.DG_FB_Angle]) endFrequencys[dataGroup.DG_FB_Angle] = dataGroup.DG_FB_End; if (!watsEmiDataManager.AllChannelSamples.TryGetValue(dataGroup.DG_FB_Angle, out datas)) { datas = new Dictionary<ChannelSetting, WatsEmiData>(); watsEmiDataManager.AllChannelSamples.Add(dataGroup.DG_FB_Angle, datas); } if (!watsEmiDataManager.AllSamples.TryGetValue(dataGroup.DG_FB_Angle, out samples)) { samples = new Dictionary<int, List<WatsEmiSample>>(); samples[0] = new List<WatsEmiSample>(); samples[1] = new List<WatsEmiSample>(); watsEmiDataManager.AllSamples.Add(dataGroup.DG_FB_Angle, samples); } foreach (DG_Data_Type data in dataGroup.DGDatas) { if (dataGroup.DB_FB_AntennaPolarization == 0) samples[0].Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else //if (dataGroup.DB_FB_AntennaPolarization == 1) samples[1].Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); curChannelSetting = null; foreach (ChannelSetting channelSetting in channelSettings) { if (data.DG_DI_Freq >= channelSetting.StartFreq && data.DG_DI_Freq <= channelSetting.EndFreq || data.DG_DI_Freq >= channelSetting.Pair.StartFreq && data.DG_DI_Freq <= channelSetting.Pair.EndFreq) { curChannelSetting = channelSetting; break; } } if (curChannelSetting == null) continue; if (!datas.TryGetValue(curChannelSetting, out curData)) { curData = new WatsEmiData(); datas.Add(curChannelSetting, curData); } if (dataGroup.DB_FB_AntennaPolarization == 0) { if (data.DG_DI_Freq >= curChannelSetting.StartFreq && data.DG_DI_Freq <= curChannelSetting.EndFreq) curData.mVSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else curData.mVPairSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); } else { if (data.DG_DI_Freq >= curChannelSetting.StartFreq && data.DG_DI_Freq <= curChannelSetting.EndFreq) curData.mHSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else curData.mHPairSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); } } } SortEmiData(watsEmiDataManager); return watsEmiDataManager; }
private void PairReportForm_Load(object sender, EventArgs e) { SiteAIDLabel.Text = mEmiA.Site_ID; LongtitudeALabel.Text = Utility.ConvertLongtitude(mEmiA.Site_Longitude); LatitudeALabel.Text = Utility.ConvertLatitude(mEmiA.Site_Longitude); DateALabel.Text = mEmiA.PA_TestTime; EngineerALabel.Text = mEmiA.PA_UserName; SiteBIDLabel.Text = mEmiB.Site_ID; LongtitudeBLabel.Text = Utility.ConvertLongtitude(mEmiB.Site_Longitude); LatitudeBLabel.Text = Utility.ConvertLatitude(mEmiB.Site_Longitude); DateBLabel.Text = mEmiB.PA_TestTime; EngineerBLabel.Text = mEmiB.PA_UserName; ChannelMatcher.Instance.Channels = mAvailableChannels; ChannelMatcher.Instance.EquipmentParameters = mEquipmentParameters; mFrequencyCounts = new List<int>(); if (mIsManualConfig) { mLinkConfigurations = new List<LinkConfiguration>(); if ((mManualConfig & ManualConfigConstants.MC_1_PLUS_0) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_1_PLUS_0)); AddManualConfiguration(ManualConfigConstants.MC_1_PLUS_0); } if ((mManualConfig & ManualConfigConstants.MC_2_PLUS_0) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_2_PLUS_0)); AddManualConfiguration(ManualConfigConstants.MC_2_PLUS_0); } if ((mManualConfig & ManualConfigConstants.MC_3_PLUS_0) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_3_PLUS_0)); AddManualConfiguration(ManualConfigConstants.MC_3_PLUS_0); } if ((mManualConfig & ManualConfigConstants.MC_4_PLUS_0) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_4_PLUS_0)); AddManualConfiguration(ManualConfigConstants.MC_4_PLUS_0); } if ((mManualConfig & ManualConfigConstants.MC_1_PLUS_1FD) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_1_PLUS_1FD)); AddManualConfiguration(ManualConfigConstants.MC_1_PLUS_1FD); } if ((mManualConfig & ManualConfigConstants.MC_2_PLUS_1FD) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_2_PLUS_1FD)); AddManualConfiguration(ManualConfigConstants.MC_2_PLUS_1FD); } if ((mManualConfig & ManualConfigConstants.MC_3_PLUS_1FD) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_3_PLUS_1FD)); AddManualConfiguration(ManualConfigConstants.MC_3_PLUS_1FD); } if ((mManualConfig & ManualConfigConstants.MC_1_PLUS_1HSB) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_1_PLUS_1HSB)); AddManualConfiguration(ManualConfigConstants.MC_1_PLUS_1HSB); } if ((mManualConfig & ManualConfigConstants.MC_1_PLUS_1SD) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_1_PLUS_1SD)); AddManualConfiguration(ManualConfigConstants.MC_1_PLUS_1SD); } if ((mManualConfig & ManualConfigConstants.MC_DOUBLE_1_PLUS_1SD) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_DOUBLE_1_PLUS_1SD)); AddManualConfiguration(ManualConfigConstants.MC_DOUBLE_1_PLUS_1SD); } if ((mManualConfig & ManualConfigConstants.MC_TRIPLE_1_PLUS_1SD) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_TRIPLE_1_PLUS_1SD)); AddManualConfiguration(ManualConfigConstants.MC_TRIPLE_1_PLUS_1SD); } if ((mManualConfig & ManualConfigConstants.MC_FOURTIMES_1_PLUS_1SD) != 0) { mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(ManualConfigConstants.MC_FOURTIMES_1_PLUS_1SD)); AddManualConfiguration(ManualConfigConstants.MC_FOURTIMES_1_PLUS_1SD); } } else { foreach (LinkConfiguration linkConfiguration in mLinkConfigurations) mFrequencyCounts.Add(LinkFrequencyCountMap.Instance.GetCount(linkConfiguration.RequiredConfiguration)); } Link parentLink = new Link(); int[] availableChannelIndexs = new int[mAvailableChannels.Count]; for (int i = 0; i < mAvailableChannels.Count; i++) availableChannelIndexs[i] = i; if (AnalysisChannelCombination) GetAllLinks(parentLink, availableChannelIndexs, 0, 0); mDataManagerA = Utility.GetEmiDataManager(mEmiA, mChannelSettings); mDataManagerB = Utility.GetEmiDataManager(mEmiB, mChannelSettings); GenerateGraphs(); ShowGraph(true); ShowGraph(false); if (AnalysisChannelCombination) { mAllCombinationDirectionMasks = DirectionMasker.Instance().GetAllCombinateDirectionMasks(mFrequencyCounts); mLinkcombinations = GetAllLinkCombinations(parentLink); ShowLinkCombinations(); } }
public static Dictionary<string, List<BitMapInfo>> create(EMIFileData emi, double azimuth, string relativeAzimuth, WatsEmiDataManager dataMgr, Dictionary<string, List<ChannelSetting>> allBandchannels, LimitSetting limitSetting, int minAbsRssi, int maxAbsRssi) { Dictionary<string, List<BitMapInfo>> allChannelBitmapInfos = new Dictionary<string,List<BitMapInfo>>(); List<BitMapInfo> channelBitmapInfos; BitMapInfo loBitMapInfo, hiBitMapInfo; List<WatsEmiSample> loVerticalSamples, hiVerticalSamples; List<WatsEmiSample> loHorizontalSamples, hiHorizontalSamples; string bandName; double curFreq; int counter = 0; List<BitMapInfo> channelBitmaps; List<Marker> loVerticalMarkers, loHoizontalMarkers; List<Marker> hiVerticalMarkers, hiHoizontalMarkers; List<ChannelSetting> channelSettings; List<ChannelSetting> pairChannelSettings; Marker marker; ChannelPower channelPower; foreach (KeyValuePair<string, List<ChannelSetting>> pair in allBandchannels) { bandName = pair.Key; channelBitmapInfos = new List<BitMapInfo>(); channelSettings = pair.Value; pairChannelSettings = new List<ChannelSetting>(); foreach (ChannelSetting channelSetting in channelSettings) pairChannelSettings.Add(channelSetting.Pair); loVerticalSamples = new List<WatsEmiSample>(); for (int i = 0; i < dataMgr.AllSamples[azimuth][0].Count; i++) { curFreq = dataMgr.AllSamples[azimuth][0][i].mFreq; if (curFreq >= channelSettings[0].StartFreq && curFreq <= channelSettings[channelSettings.Count - 1].EndFreq) { loVerticalSamples.Add(dataMgr.AllSamples[azimuth][0][i]); } } loHorizontalSamples = new List<WatsEmiSample>(); for (int i = 0; i < dataMgr.AllSamples[azimuth][1].Count; i++) { curFreq = dataMgr.AllSamples[azimuth][1][i].mFreq; if (curFreq >= channelSettings[0].StartFreq && curFreq <= channelSettings[channelSettings.Count - 1].EndFreq) { loHorizontalSamples.Add(dataMgr.AllSamples[azimuth][1][i]); } } hiVerticalSamples = new List<WatsEmiSample>(); for (int i = 0; i < dataMgr.AllSamples[azimuth][0].Count; i++) { curFreq = dataMgr.AllSamples[azimuth][0][i].mFreq; if (curFreq >= pairChannelSettings[0].StartFreq && curFreq <= pairChannelSettings[pairChannelSettings.Count - 1].EndFreq) { hiVerticalSamples.Add(dataMgr.AllSamples[azimuth][0][i]); } } hiHorizontalSamples = new List<WatsEmiSample>(); for (int i = 0; i < dataMgr.AllSamples[azimuth][1].Count; i++) { curFreq = dataMgr.AllSamples[azimuth][1][i].mFreq; if (curFreq >= pairChannelSettings[0].StartFreq && curFreq <= pairChannelSettings[pairChannelSettings.Count - 1].EndFreq) { hiHorizontalSamples.Add(dataMgr.AllSamples[azimuth][1][i]); } } loBitMapInfo = new BitMapInfo(); loBitMapInfo.Title1 = "Spectrum Analyzer Data MDEF-LAXI_" + bandName + "_" + relativeAzimuth + "V (LO)"; loBitMapInfo.Title2 = "Spectrum Analyzer Data MDEF-LAXI_" + bandName + "_" + relativeAzimuth + "H (LO)"; loBitMapInfo.BmpFile1 = Utility.GetAppPath() + "\\Temp\\Site_" + emi.Site_ID + "_Azimuth_" + relativeAzimuth + "_" + bandName + "_LowBand_Vertical_" + (++counter).ToString() + ".emf"; loBitMapInfo.BmpFile2 = Utility.GetAppPath() + "\\Temp\\Site_" + emi.Site_ID + "_Azimuth_" + relativeAzimuth + "_" + bandName + "_LowBand_Horizontal_" + (counter).ToString() + ".emf"; hiBitMapInfo = new BitMapInfo(); hiBitMapInfo.Title1 = "Spectrum Analyzer DataMDEF-LAXI_" + bandName + "_" + relativeAzimuth + "V (HI)"; hiBitMapInfo.Title2 = "Spectrum Analyzer DataMDEF-LAXI_" + bandName + "_" + relativeAzimuth + "H (HI)"; hiBitMapInfo.BmpFile1 = Utility.GetAppPath() + "\\Temp\\Site_" + emi.Site_ID + "_Azimuth_" + relativeAzimuth + "_" + bandName + "_HighBand_Vertical_" + (++counter).ToString() + ".emf"; hiBitMapInfo.BmpFile2 = Utility.GetAppPath() + "\\Temp\\Site_" + emi.Site_ID + "_Azimuth_" + relativeAzimuth + "_" + bandName + "_HighBand_Horizontal_" + (counter).ToString() + ".emf"; loVerticalMarkers = new List<Marker>(); loHoizontalMarkers = new List<Marker>(); hiVerticalMarkers = new List<Marker>(); hiHoizontalMarkers = new List<Marker>(); foreach (ChannelSetting channelSetting in channelSettings) { channelPower = new ChannelPower(emi.SA_RBW, channelSetting, limitSetting, dataMgr.AllChannelSamples[azimuth][channelSetting]); if (!channelPower.IsValidVPower) { marker = Utility.CreateMarker(channelSetting.ChannelName, dataMgr.AllChannelSamples[azimuth][channelSetting].mVSamples); loVerticalMarkers.Add(marker); } if (!channelPower.IsValidVPairPower) { marker = Utility.CreateMarker(channelSetting.Pair.ChannelName, dataMgr.AllChannelSamples[azimuth][channelSetting].mVPairSamples); hiVerticalMarkers.Add(marker); } if (!channelPower.IsValidHPower) { marker = Utility.CreateMarker(channelSetting.ChannelName, dataMgr.AllChannelSamples[azimuth][channelSetting].mHSamples); loHoizontalMarkers.Add(marker); } if (!channelPower.IsValidHPairPower) { marker = Utility.CreateMarker(channelSetting.Pair.ChannelName, dataMgr.AllChannelSamples[azimuth][channelSetting].mHPairSamples); hiHoizontalMarkers.Add(marker); } } drawPicture(emi, loVerticalSamples, channelSettings, limitSetting, loBitMapInfo.BmpFile1, loBitMapInfo.Title1, minAbsRssi, maxAbsRssi, loVerticalMarkers); drawPicture(emi, loHorizontalSamples, channelSettings, limitSetting, loBitMapInfo.BmpFile2, loBitMapInfo.Title2, minAbsRssi, maxAbsRssi, loHoizontalMarkers); drawPicture(emi, hiVerticalSamples, pairChannelSettings, limitSetting, hiBitMapInfo.BmpFile1, hiBitMapInfo.Title1, minAbsRssi, maxAbsRssi, hiVerticalMarkers); drawPicture(emi, hiHorizontalSamples, pairChannelSettings, limitSetting, hiBitMapInfo.BmpFile2, hiBitMapInfo.Title2, minAbsRssi, maxAbsRssi, hiHoizontalMarkers); channelBitmaps = new List<BitMapInfo>(); channelBitmaps.Add(loBitMapInfo); channelBitmaps.Add(hiBitMapInfo); allChannelBitmapInfos[bandName] = channelBitmaps; } return allChannelBitmapInfos; }
private void VenezuelaReportForm_Load(object sender, EventArgs e) { SiteAIDLabel.Text = mEmiA.Site_ID; LongtitudeALabel.Text = Utility.ConvertLongtitude(mEmiA.Site_Longitude); LatitudeALabel.Text = Utility.ConvertLatitude(mEmiA.Site_Longitude); DateALabel.Text = mEmiA.PA_TestTime; EngineerALabel.Text = mEmiA.PA_UserName; SiteBIDLabel.Text = mEmiB.Site_ID; LongtitudeBLabel.Text = Utility.ConvertLongtitude(mEmiB.Site_Longitude); LatitudeBLabel.Text = Utility.ConvertLatitude(mEmiB.Site_Longitude); DateBLabel.Text = mEmiB.PA_TestTime; EngineerBLabel.Text = mEmiB.PA_UserName; if (mLimitSetting.UseChannelPowerLimit) PChannelLimitALabel.Text = PChannelLimitBLabel.Text = mLimitSetting.ChannelPowerLimit.ToString(); else PChannelLimitALabel.Text = PChannelLimitBLabel.Text = ""; if (mLimitSetting.UseDeltaPowerLimit) PLevelLimitALabel.Text = PLevelLimitBLabel.Text = mLimitSetting.DeltaPowerLimit.ToString(); else PLevelLimitALabel.Text = PLevelLimitBLabel.Text = ""; mEmiDataMgrA = Utility.GetEmiDataManager(mEmiA, mChannelSettings); mEmiDataMgrB = Utility.GetEmiDataManager(mEmiB, mChannelSettings); int graphCount = mIniFile.ReadInt("General", "VenezuelaReportGraphCount", 1); GraphCountComboBox.SelectedIndex = graphCount - 1; GenerateGraphs(); ShowGraph(true); ShowGraph(false); }
private void ViewExcelButton_Click(object sender, EventArgs e) { if (WatsEmiReportTool.Utility.GetExcelVersion() < 0) { MessageBox.Show("Excel was not installed !"); return; } ExportSettingForm exportSettingForm = new ExportSettingForm(); if (exportSettingForm.ShowDialog() == DialogResult.Cancel) return; string reportTemplateFile; SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = "Select report file name"; Excel.XlFileFormat excelFormat; if (exportSettingForm.ExportOffice2003) { reportTemplateFile = System.AppDomain.CurrentDomain.BaseDirectory + "ReportTemplate.xls"; //excelFormat = Excel.XlFileFormat.xlExcel8; //excelFormat = Excel.XlFileFormat.xlWorkbookNormal; saveFileDialog.Filter = "report file(*.xls)|*.xls"; } else { reportTemplateFile = System.AppDomain.CurrentDomain.BaseDirectory + "ReportTemplate.xlsx"; //excelFormat = Excel.XlFileFormat.xlExcel12; saveFileDialog.Filter = "report file(*.xlsx)|*.xlsx"; } do { if (DialogResult.Cancel == saveFileDialog.ShowDialog()) return; if (saveFileDialog.FileName.Equals(reportTemplateFile, StringComparison.OrdinalIgnoreCase)) { MessageBox.Show("Can't select report template file !"); continue; } try { File.Copy(reportTemplateFile, saveFileDialog.FileName, true); } catch (System.Exception ex) { MessageBox.Show("Can't save file " + saveFileDialog.FileName + "!\r\n" + "Select another file name for report."); continue; } mExportFileName = saveFileDialog.FileName; break; } while (true); //Hide(); mExportStatusForm.Show(); mCancelExport = false; //ExportButton.Enabled = false; mExportThread = new Thread(delegate() { bool isReportSucceed = false; string[] subBands = new string[2]; System.Globalization.CultureInfo Oldci = null; Excel._Application app = null; Excel.WorkbookClass workBook = null; Excel.Sheets sheets = null; Excel.Worksheet sheet = null; Excel.Worksheet summarySheet; try { Oldci = System.Threading.Thread.CurrentThread.CurrentCulture; System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us"); app = new Excel.Application(); app.DisplayAlerts = false; object objOpt = System.Reflection.Missing.Value; UpdateStatus("Initialize ..."); workBook = (Excel.WorkbookClass)app.Workbooks.Open( mExportFileName, objOpt, false, objOpt, objOpt, objOpt, true, objOpt, objOpt, true, objOpt, objOpt, objOpt, objOpt, objOpt); sheets = workBook.Worksheets; summarySheet = (Excel.Worksheet)sheets["Summary"]; summarySheet.Cells[1, 6] = mEmiFileData.Site_ID; UpdateStatus("Export Cover sheet ..."); /* Cover Sheet */ sheet = (Excel.Worksheet)sheets["Cover"]; if (!string.IsNullOrEmpty(mEmiFileData.PI_ID)) sheet.Cells[15, 5] = mEmiFileData.PI_ID; if (!string.IsNullOrEmpty(mEmiFileData.PA_UserName)) sheet.Cells[17, 5] = mEmiFileData.PA_UserName; Dictionary<double, double> startFrequencys = new Dictionary<double, double>(); Dictionary<double, double> endFrequencys = new Dictionary<double, double>(); WatsEmiDataManager dataManager = new WatsEmiDataManager(); Dictionary<ChannelSetting, WatsEmiData> datas; Dictionary<int, List<WatsEmiSample>> samples = null; ChannelSetting curChannelSetting; WatsEmiData curData; foreach (DG_Type dataGroup in mEmiFileData.DataGroups) { if (mCancelExport) return; if (!startFrequencys.ContainsKey(dataGroup.DG_FB_Angle)) startFrequencys[dataGroup.DG_FB_Angle] = dataGroup.DG_FB_Start; else if (dataGroup.DG_FB_Start < startFrequencys[dataGroup.DG_FB_Angle]) startFrequencys[dataGroup.DG_FB_Angle] = dataGroup.DG_FB_Start; if (!endFrequencys.ContainsKey(dataGroup.DG_FB_Angle)) endFrequencys[dataGroup.DG_FB_Angle] = dataGroup.DG_FB_End; else if (dataGroup.DG_FB_End > endFrequencys[dataGroup.DG_FB_Angle]) endFrequencys[dataGroup.DG_FB_Angle] = dataGroup.DG_FB_End; if (!dataManager.AllChannelSamples.TryGetValue(dataGroup.DG_FB_Angle, out datas)) { datas = new Dictionary<ChannelSetting, WatsEmiData>(); dataManager.AllChannelSamples.Add(dataGroup.DG_FB_Angle, datas); } if (!dataManager.AllSamples.TryGetValue(dataGroup.DG_FB_Angle, out samples)) { samples = new Dictionary<int, List<WatsEmiSample>>(); samples[0] = new List<WatsEmiSample>(); samples[1] = new List<WatsEmiSample>(); dataManager.AllSamples.Add(dataGroup.DG_FB_Angle, samples); } foreach (DG_Data_Type data in dataGroup.DGDatas) { if (mCancelExport) return; if (dataGroup.DB_FB_AntennaPolarization == 0) samples[0].Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else //if (dataGroup.DB_FB_AntennaPolarization == 1) samples[1].Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); curChannelSetting = null; foreach (ChannelSetting channelSetting in mChannelSettings) { if (mCancelExport) return; if (data.DG_DI_Freq >= channelSetting.StartFreq && data.DG_DI_Freq <= channelSetting.EndFreq || data.DG_DI_Freq >= channelSetting.Pair.StartFreq && data.DG_DI_Freq <= channelSetting.Pair.EndFreq) { curChannelSetting = channelSetting; break; } } if (curChannelSetting == null) continue; if (!datas.TryGetValue(curChannelSetting, out curData)) { curData = new WatsEmiData(); datas.Add(curChannelSetting, curData); } if (dataGroup.DB_FB_AntennaPolarization == 0) { if (data.DG_DI_Freq >= curChannelSetting.StartFreq && data.DG_DI_Freq <= curChannelSetting.EndFreq) curData.mVSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else curData.mVPairSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); } else { if (data.DG_DI_Freq >= curChannelSetting.StartFreq && data.DG_DI_Freq <= curChannelSetting.EndFreq) curData.mHSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); else curData.mHPairSamples.Add(new WatsEmiSample(data.DG_DI_Freq, data.DG_DI_RSSI)); } } } for (int i = 1; i < dataManager.AllChannelSamples.Count; i++) { if (mCancelExport) return; ((Excel.Range)summarySheet.Rows[3, objOpt]).Copy(objOpt); ((Excel.Range)summarySheet.Cells[3 + i, 1]).EntireRow.Insert(objOpt, objOpt); } UpdateStatus("Export Device Info sheet ..."); /* Device Info Sheet */ sheet = (Excel.Worksheet)sheets["Device info"]; sheet.Cells[18, 12] = mEmiFileData.SA_RBW + "kHz"; sheet.Cells[19, 12] = mEmiFileData.SA_VBW + "kHz"; sheet.Cells[20, 12] = mEmiFileData.SA_Detector; sheet.Cells[21, 12] = mEmiFileData.SA_Trace; sheet.Cells[22, 12] = mEmiFileData.SA_Attenuation_Value + "dB"; sheet.Cells[23, 12] = mEmiFileData.SA_REF_LEVEL + "dBm"; int channelIndex; Excel.Range range; int summaryAngleStartRowIndex = 3; List<Excel.Range> boldBorderRanges = new List<Excel.Range>(); boldBorderRanges.Add(summarySheet.get_Range(summarySheet.Cells[1, 1], summarySheet.Cells[2, 14])); foreach (KeyValuePair<double, Dictionary<ChannelSetting, WatsEmiData>> pair in dataManager.AllChannelSamples) { UpdateStatus("Export sheet " + pair.Key.ToString() + "\x00B0" + " ..."); if (mCancelExport) return; ((Excel.Worksheet)sheets["template"]).Copy(objOpt, workBook.ActiveSheet); sheet = (Excel.Worksheet)workBook.ActiveSheet; sheet.Name = pair.Key.ToString() + "\x00B0"; sheet.Cells[2, 3] = mEmiFileData.Site_ID; sheet.Cells[2, 11] = mEmiFileData.Site_ID; sheet.Cells[3, 3] = mEmiFileData.Site_Address; sheet.Cells[4, 3] = WatsEmiReportTool.Utility.ConvertLatitude(mEmiFileData.Site_Latitude); sheet.Cells[4, 11] = WatsEmiReportTool.Utility.ConvertLongtitude(mEmiFileData.Site_Longitude); if (mLimitSetting.UseChannelPowerLimit) sheet.Cells[5, 11] = mLimitSetting.ChannelPowerLimit.ToString(); else sheet.Cells[5, 11] = ""; if (mLimitSetting.UseDeltaPowerLimit) sheet.Cells[5, 15] = mLimitSetting.DeltaPowerLimit.ToString(); else sheet.Cells[5, 15] = ""; sheet.Cells[6, 3] = WatsEmiReportTool.Utility.ConvertToDate(mEmiFileData.PA_TestTime); sheet.Cells[6, 11] = mEmiFileData.PA_UserName; summarySheet.Cells[summaryAngleStartRowIndex, 1] = pair.Key.ToString() + "\x00B0"; channelIndex = 0; foreach (KeyValuePair<ChannelSetting, WatsEmiData> dataPair in pair.Value) { if (mCancelExport) return; if (channelIndex > 0) { ((Excel.Range)sheet.Rows[11, objOpt]).Copy(objOpt); ((Excel.Range)sheet.Cells[11 + channelIndex, 1]).EntireRow.Insert(objOpt, objOpt); ((Excel.Range)summarySheet.Rows[summaryAngleStartRowIndex, objOpt]).Copy(objOpt); ((Excel.Range)summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 1]).EntireRow.Insert(objOpt, objOpt); } sheet.Cells[11 + channelIndex, 3] = dataPair.Key.ChannelName; sheet.Cells[11 + channelIndex, 4] = dataPair.Key.CenterFreq; sheet.Cells[11 + channelIndex, 5] = dataPair.Key.BandWidth; //channel pair sheet.Cells[11 + channelIndex, 10] = dataPair.Key.Pair.ChannelName; sheet.Cells[11 + channelIndex, 11] = dataPair.Key.Pair.CenterFreq; sheet.Cells[11 + channelIndex, 12] = dataPair.Key.Pair.BandWidth; summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 5] = dataPair.Key.ChannelName; summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 6] = dataPair.Key.CenterFreq; summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 9] = dataPair.Key.Pair.ChannelName; summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 10] = dataPair.Key.Pair.CenterFreq; WatsEmiReportTool.ChannelPower channelPower = new WatsEmiReportTool.ChannelPower(mEmiFileData.SA_RBW, dataPair.Key, mLimitSetting, dataPair.Value); sheet.Cells[11 + channelIndex, 8] = channelPower.HPower; sheet.Cells[11 + channelIndex, 15] = channelPower.HPairPower; sheet.Cells[11 + channelIndex, 6] = channelPower.VPower; sheet.Cells[11 + channelIndex, 13] = channelPower.VPairPower; subBands[0] = ""; subBands[1] = ""; if (dataPair.Key.ODUSubBand.Length == 1) subBands[0] = dataPair.Key.ODUSubBand; else if (dataPair.Key.ODUSubBand.Length == 3) { subBands[0] = dataPair.Key.ODUSubBand.Substring(0, 1); subBands[1] = dataPair.Key.ODUSubBand.Substring(2); } summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 3] = subBands[0]; summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 4] = subBands[1]; if (!channelPower.IsValidVPower || !channelPower.IsValidVPairPower) summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 13] = "X"; else summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 13] = ""; if (!channelPower.IsValidHPower || !channelPower.IsValidHPairPower) summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 14] = "X"; else summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 14] = ""; if (!channelPower.IsValidVPower) { summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 7] = "X"; sheet.Cells[11 + channelIndex, 7] = "X"; } else { summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 7] = ""; sheet.Cells[11 + channelIndex, 7] = ""; } if (!channelPower.IsValidHPower) { summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 8] = "X"; sheet.Cells[11 + channelIndex, 9] = "X"; } else { summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 8] = ""; sheet.Cells[11 + channelIndex, 9] = ""; } if (!channelPower.IsValidVPairPower) { summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 11] = "X"; sheet.Cells[11 + channelIndex, 14] = "X"; } else { summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 11] = ""; sheet.Cells[11 + channelIndex, 14] = ""; } if (!channelPower.IsValidHPairPower) { summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 12] = "X"; sheet.Cells[11 + channelIndex, 16] = "X"; } else { summarySheet.Cells[summaryAngleStartRowIndex + channelIndex, 12] = ""; sheet.Cells[11 + channelIndex, 16] = ""; } channelIndex++; } if (channelIndex > 1) { range = sheet.get_Range(sheet.Cells[11, 1], sheet.Cells[11 + channelIndex - 1, 1]); range.ClearContents(); range.Merge(objOpt); range = sheet.get_Range(sheet.Cells[11, 2], sheet.Cells[11 + channelIndex - 1, 2]); range.ClearContents(); range.Merge(objOpt); range = summarySheet.get_Range(summarySheet.Cells[summaryAngleStartRowIndex, 1], summarySheet.Cells[summaryAngleStartRowIndex + channelIndex - 1, 1]); range.Merge(objOpt); } boldBorderRanges.Add(summarySheet.get_Range(summarySheet.Cells[summaryAngleStartRowIndex, 1], summarySheet.Cells[summaryAngleStartRowIndex + channelIndex - 1, 14])); summaryAngleStartRowIndex += channelIndex; sheet.Cells[11, 1] = startFrequencys[pair.Key].ToString() + "-" + endFrequencys[pair.Key].ToString(); sheet.Cells[11, 2] = pair.Key.ToString() + "\x00B0"; List<BitMapInfo> bitmapInfos = mBitmaps[pair.Key]; int pictureRows = bitmapInfos.Count; if (pictureRows > 1) { for (int i = 0; i < pictureRows - 1; i++) { ((Excel.Range)sheet.Rows[12 + channelIndex, objOpt]).Copy(objOpt); ((Excel.Range)sheet.Cells[13 + channelIndex + i, 1]).EntireRow.Insert(objOpt, objOpt); } } for (int i = 0; i < pictureRows; i++) { UpdateStatus("Export sheet " + pair.Key.ToString() + "\x00B0 vertical picture " + (i + 1).ToString() + " ..."); if (mCancelExport) return; sheet.Cells[12 + channelIndex + i, 1] = bitmapInfos[i].Title1; range = (Excel.Range)sheet.Cells[12 + channelIndex + i, 1]; range.Select(); float left = Convert.ToSingle(range.Left) + 15; float top = Convert.ToSingle(range.Top) + 15; float width = 310; float height = 150; sheet.Shapes.AddPicture(bitmapInfos[i].BmpFile1, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, left, top, width, height); UpdateStatus("Export sheet " + pair.Key.ToString() + "\x00B0 horizontal picture " + (i + 1).ToString() + " ..."); if (mCancelExport) return; sheet.Cells[12 + channelIndex + i, 9] = bitmapInfos[i].Title2; range = (Excel.Range)sheet.Cells[12 + channelIndex + i, 9]; range.Select(); left = Convert.ToSingle(range.Left) + 15; top = Convert.ToSingle(range.Top) + 15; width = 310; height = 150; sheet.Shapes.AddPicture(bitmapInfos[i].BmpFile2, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, left, top, width, height); } } foreach (Excel.Range boldBorderRange in boldBorderRanges) { boldBorderRange.Borders.get_Item(Excel.XlBordersIndex.xlEdgeBottom).Weight = Excel.XlBorderWeight.xlMedium; boldBorderRange.Borders.get_Item(Excel.XlBordersIndex.xlEdgeTop).Weight = Excel.XlBorderWeight.xlMedium; boldBorderRange.Borders.get_Item(Excel.XlBordersIndex.xlEdgeLeft).Weight = Excel.XlBorderWeight.xlMedium; boldBorderRange.Borders.get_Item(Excel.XlBordersIndex.xlEdgeRight).Weight = Excel.XlBorderWeight.xlMedium; } UpdateStatus("Delete template sheet ..."); ((Excel.Worksheet)sheets["template"]).Delete(); isReportSucceed = true; UpdateStatus("Save export file, please wait ..."); workBook.Save(); /* workBook.SaveAs(mExportFileName, Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); */ UpdateStatus("Export succeed !"); } catch (Exception ex) { MessageBox.Show("Create report failed !\r\nException: " + ex.Message); } finally { if (Oldci != null) { System.Threading.Thread.CurrentThread.CurrentCulture = Oldci; } if (app != null) app.Quit(); ExcelAppKiller.Kill(app); WatsEmiReportTool.Utility.ReleaseCom(sheet); WatsEmiReportTool.Utility.ReleaseCom(sheets); WatsEmiReportTool.Utility.ReleaseCom(workBook); WatsEmiReportTool.Utility.ReleaseCom(app); GC.Collect(System.GC.GetGeneration(sheet)); GC.Collect(System.GC.GetGeneration(sheets)); GC.Collect(System.GC.GetGeneration(workBook)); GC.Collect(System.GC.GetGeneration(app)); GC.Collect(); /* ReleaseCom(sheet); ReleaseCom(sheets); ReleaseCom(workBook); if (app != null) app.Quit(); ExcelAppKiller.Kill(app); ReleaseCom(app); GC.Collect(); */ } if (isReportSucceed) { try { UpdateStatus("Open excel ..."); Process process = Process.Start("excel", "\"" + mExportFileName + "\""); process.Close(); } catch (System.Exception ex) { } } UpdateStatus("Finished"); } ); mExportThread.Start(); }
private void AnalysisButton_Click(object sender, EventArgs e) { ChannelPowerLimitEditor.Text = ChannelPowerLimitEditor.Text.Trim(); if (ChannelPowerLimitEditor.Text.Length == 0) { MessageBox.Show("Please input channel power limit !", "Warning"); ChannelPowerLimitEditor.Focus(); return; } if (!Regex.IsMatch(ChannelPowerLimitEditor.Text, @"^-?[1-9]\d*$")) { MessageBox.Show(ChannelPowerLimitEditor.Text + " is not a valid power limit !", "Warning"); ChannelPowerLimitEditor.SelectAll(); ChannelPowerLimitEditor.Focus(); return; } DeltaPowerLimitEditor.Text = DeltaPowerLimitEditor.Text.Trim(); if (DeltaPowerLimitEditor.Text.Length == 0) { MessageBox.Show("Please input delta power limit !", "Warning"); DeltaPowerLimitEditor.Focus(); return; } if (!Regex.IsMatch(DeltaPowerLimitEditor.Text, @"^-?[1-9]\d*$")) { MessageBox.Show(DeltaPowerLimitEditor.Text + " is not a valid delta limit !", "Warning"); DeltaPowerLimitEditor.SelectAll(); DeltaPowerLimitEditor.Focus(); return; } if (!mIsViewReport) { Program.Config.WriteInt("General", "UseChannelPowerLimit", ChannelPowerCheckBox.Checked ? 1 : 0); Program.Config.WriteString("General", "ChannelPowerLimit", ChannelPowerLimitEditor.Text.Trim()); Program.Config.WriteInt("General", "UseDeltaPowerLimit", DeltaPowerCheckBox.Checked ? 1 : 0); Program.Config.WriteString("General", "DeltaPowerLimit", DeltaPowerLimitEditor.Text.Trim()); } mLimitSetting.UseChannelPowerLimit = ChannelPowerCheckBox.Checked; mLimitSetting.ChannelPowerLimit = Int32.Parse(ChannelPowerLimitEditor.Text); mLimitSetting.UseDeltaPowerLimit = DeltaPowerCheckBox.Checked; mLimitSetting.DeltaPowerLimit = Int32.Parse(DeltaPowerLimitEditor.Text); SiteIDLabel.Text = mEmiFileData.Site_ID; SiteNameLabel.Text = mEmiFileData.Site_ID; AddressLabel.Text = mEmiFileData.Site_Address; DateLabel.Text = mEmiFileData.PA_TestTime; EngineerLabel.Text = mEmiFileData.PA_UserName; LongtitudeLabel.Text = WatsEmiReportTool.Utility.ConvertLongtitude(mEmiFileData.Site_Longitude); LatitudeLabel.Text = WatsEmiReportTool.Utility.ConvertLatitude(mEmiFileData.Site_Longitude); ; if (mLimitSetting.UseChannelPowerLimit) PChannelLimitLabel.Text = mLimitSetting.ChannelPowerLimit.ToString(); else PChannelLimitLabel.Text = ""; if (mLimitSetting.UseDeltaPowerLimit) LevelLimitLabel.Text = mLimitSetting.DeltaPowerLimit.ToString(); else LevelLimitLabel.Text = ""; if (Program.Config.ReadInt("General", "ChannelPreferred", 1) == 1) ChannelPreferredRadioButton.Checked = true; else FrequencePreferredRadioButton.Checked = true; DisplayChannelCheckBox.Enabled = (!ChannelPreferredRadioButton.Checked); if (!mIsViewReport) { DisplayChannelCheckBox.Checked = (Program.Config.ReadInt("General", "DisplayChannel", 1) == 1); SpanEditor.Text = Program.Config.ReadString("General", "Span", "300").Trim(); if (!Regex.IsMatch(SpanEditor.Text, @"^[1-9]\d*(\.\d+)?$")) SpanEditor.Text = "300"; } mDefaultStartFreq = mChannelSettings[0].StartFreq; mDefaultEndFreq = mChannelSettings[mChannelSettings.Count - 1].Pair.EndFreq; SetDefaultFreq(); mExportStatusForm = new ExportStatusForm(this); mDataManager = WatsEmiReportTool.Utility.GetEmiDataManager(mEmiFileData, mChannelSettings); GenerateGraphs(); }
public static List<BitMapInfo> create(EMIFileData emi, double azimuth, string title, WatsEmiDataManager dataMgr, List<ChannelSetting> channelSettings, LimitSetting limitSetting, int minAbsRssi, int maxAbsRssi, double span, List<FrequencyRange> ranges, ref string verticalCircleTitle, ref string horizontalCircleTitle, ref string verticalCircleBmpFile, ref string horizontalCircleBmpFile) { List<BitMapInfo> bitMapInfos = new List<BitMapInfo>(); List<WatsEmiSample> verticalSamples; List<WatsEmiSample> horizontalSamples; verticalCircleBmpFile = Utility.GetAppPath() + "\\Temp\\" + azimuth.ToString() + "-circle-vertical.emf"; verticalCircleTitle = "V-" + azimuth.ToString() + "\x00B0[" + ranges[0].FromFreq + "~" + ranges[ranges.Count - 1].EndFreq + " MHz]"; horizontalCircleBmpFile = Utility.GetAppPath() + "\\Temp\\" + azimuth.ToString() + "circle-horizontal.emf"; horizontalCircleTitle = "H-" + azimuth.ToString() + "\x00B0[" + ranges[0].FromFreq + "~" + ranges[ranges.Count - 1].EndFreq + " MHz]"; //draw circle picture drawCirclePicture(true, verticalCircleBmpFile, azimuth, 30, emi.SA_RBW, dataMgr.AllChannelSamples[azimuth], limitSetting); drawCirclePicture(false, horizontalCircleBmpFile, azimuth, 30, emi.SA_RBW, dataMgr.AllChannelSamples[azimuth], limitSetting); //calculate all Markers List<Marker> allVerticalMarkers = new List<Marker>(); List<Marker> allHoizontalMarkers = new List<Marker>(); Marker marker; ChannelPower channelPower; foreach (ChannelSetting channelSetting in channelSettings) { channelPower = new ChannelPower(emi.SA_RBW, channelSetting, limitSetting, dataMgr.AllChannelSamples[azimuth][channelSetting]); if (!channelPower.IsValidVPower) { marker = Utility.CreateMarker(channelSetting.ChannelName, dataMgr.AllChannelSamples[azimuth][channelSetting].mVSamples); allVerticalMarkers.Add(marker); } if (!channelPower.IsValidVPairPower) { marker = Utility.CreateMarker(channelSetting.Pair.ChannelName, dataMgr.AllChannelSamples[azimuth][channelSetting].mVPairSamples); allVerticalMarkers.Add(marker); } if (!channelPower.IsValidHPower) { marker = Utility.CreateMarker(channelSetting.ChannelName, dataMgr.AllChannelSamples[azimuth][channelSetting].mHSamples); allHoizontalMarkers.Add(marker); } if (!channelPower.IsValidHPairPower) { marker = Utility.CreateMarker(channelSetting.Pair.ChannelName, dataMgr.AllChannelSamples[azimuth][channelSetting].mHPairSamples); allHoizontalMarkers.Add(marker); } } allVerticalMarkers.Sort(Utility.SortMarkerByFrequency); allHoizontalMarkers.Sort(Utility.SortMarkerByFrequency); //draw picture per range BitMapInfo bitMapInfo; List<Marker> verticalMarkers; List<Marker> horizontalMarkers; foreach (FrequencyRange range in ranges) { bitMapInfo = new BitMapInfo(); verticalSamples = new List<WatsEmiSample>(); horizontalSamples = new List<WatsEmiSample>(); verticalMarkers = new List<Marker>(); horizontalMarkers = new List<Marker>(); foreach (Marker rangeMarker in allVerticalMarkers) { if (rangeMarker.frequency >= range.FromFreq && rangeMarker.frequency <= range.EndFreq) verticalMarkers.Add(rangeMarker); } foreach (Marker rangeMarker in allHoizontalMarkers) { if (rangeMarker.frequency >= range.FromFreq && rangeMarker.frequency <= range.EndFreq) horizontalMarkers.Add(rangeMarker); } int markerRows = Math.Max(verticalMarkers.Count, horizontalMarkers.Count); bitMapInfo.Band = Utility.ConvertDoubleString(range.FromFreq) + "-" + Utility.ConvertDoubleString(range.EndFreq); bitMapInfo.Title1 = "V-" + Utility.ConvertDoubleString(azimuth) + "\x00B0" + "[" + Utility.ConvertDoubleString(range.FromFreq) + "~" + range.EndFreq + " MHz]"; bitMapInfo.Title2 = "H-" + Utility.ConvertDoubleString(azimuth) + "\x00B0" + "[" + Utility.ConvertDoubleString(range.FromFreq) + "~" + range.EndFreq + " MHz]"; bitMapInfo.BmpFile1 = Utility.GetAppPath() + "\\Temp\\Angle" + azimuth.ToString() + "-vertical-" + ((int)range.FromFreq).ToString() + ".emf"; bitMapInfo.BmpFile2 = Utility.GetAppPath() + "\\Temp\\Angle" + azimuth.ToString() + "-horizontal-" + ((int)range.FromFreq).ToString() + ".emf"; for (int i = 0; i < dataMgr.AllSamples[azimuth][0].Count; i++) { if (dataMgr.AllSamples[azimuth][0][i].mFreq >= range.FromFreq && dataMgr.AllSamples[azimuth][0][i].mFreq <= range.EndFreq) verticalSamples.Add(dataMgr.AllSamples[azimuth][0][i]); } for (int i = 0; i < dataMgr.AllSamples[azimuth][1].Count; i++) { if (dataMgr.AllSamples[azimuth][1][i].mFreq >= range.FromFreq && dataMgr.AllSamples[azimuth][1][i].mFreq <= range.EndFreq) horizontalSamples.Add(dataMgr.AllSamples[azimuth][1][i]); } drawPicture(emi, verticalSamples, span, range, limitSetting, bitMapInfo.BmpFile1, title + " V", minAbsRssi, maxAbsRssi, verticalMarkers, markerRows); drawPicture(emi, horizontalSamples, span, range, limitSetting, bitMapInfo.BmpFile2, title + " H", minAbsRssi, maxAbsRssi, horizontalMarkers, markerRows); bitMapInfos.Add(bitMapInfo); } return bitMapInfos; }
private void ReportForm_Load(object sender, EventArgs e) { mDataManager = Utility.GetEmiDataManager(mEmiFileData, mChannelSettings); GenerateGraphs(); }
private void MalaysiaReportForm_Load(object sender, EventArgs e) { mEmiDataMgrA = Utility.GetEmiDataManager(mEmiA, mChannelSettings); mEmiDataMgrB = Utility.GetEmiDataManager(mEmiB, mChannelSettings); GenerateGraphs(); EmiComboBox.SelectedIndex = 0; ShowGraph(); }