private EcgAnnotation[] GetAnnotations(int pageNum) { var annotations = new List <EcgAnnotation>(); SignalBeat[] beats = m_analysisResults.GetBeats(); double timeMsPerPage = ((TrackWidthPx * TracksPerPage) / (double)EcgBigSquarePx) * 1000; double pageStartTime = (pageNum - 1) * timeMsPerPage; double pageEndTime = pageStartTime + timeMsPerPage; for (int i = 0; i < beats.Length; i++) { SignalBeat beat = beats[i]; if (beat.Time >= pageStartTime && beat.Time < pageEndTime) { int trackNum = 0; double x = 0; double y = 0; x = beat.Time / (float)MS_PER_BIG_SQUARE * EcgBigSquarePx; trackNum = (int)Math.Floor(x / TrackWidthPx); x = XOffsetPx + (x % TrackWidthPx); y = (trackNum % TracksPerPage + 1) * 4 * EcgBigSquarePx; y = y - EcgBigSquarePx + EcgSmallSquarePx; System.Windows.Point point = new System.Windows.Point(x, y); annotations.Add(new EcgAnnotation(beat.Label + (ShowBeatTimes ? "\n" + beat.Time : ""), point)); } } return(annotations.ToArray()); }
private void LoadDataFromXml(string xmlFilePath) { var beats = new List <SignalBeat>(); var beatFamilies = new List <SignalBeatFamily>(); XmlDocument doc = new XmlDocument(); doc.Load(xmlFilePath); XmlNode leadNode = doc.SelectSingleNode("/SignalAnalysisResults/AnalyzedLeads"); if (leadNode != null) { m_signalLeads = leadNode.InnerText.Split(new char[] { ',' }); } XmlNodeList beatNodes = doc.SelectNodes("/SignalAnalysisResults/Beats/Beat"); foreach (XmlNode node in beatNodes) { SignalBeat beat = new SignalBeat(node.Attributes); beats.Add(beat); } XmlNodeList beatFamilyNodes = doc.SelectNodes("/SignalAnalysisResults/BeatFamilies/BeatFamily"); foreach (XmlNode node in beatFamilyNodes) { SignalBeatFamily beatFam = new SignalBeatFamily(); beatFam.ID = Int32.Parse(node.Attributes["ID"].Value); beatFam.Signature = node.Attributes["Signature"].Value; beatFam.NumberOfBeats = Int32.Parse(node.Attributes["NumberOfBeats"].Value); beatFamilies.Add(beatFam); } m_summaryInfo = (m_signalLeads != null) ? "Leads: " + string.Join(",", m_signalLeads) : ""; m_summaryInfo += " Total beats: " + beatNodes.Count + " Total families: " + beatFamilyNodes.Count; m_beatFamilies = beatFamilies.ToArray(); m_beats = beats.ToArray(); }