public Bitmap DrawRainMap(ref int nWidth, ref int nHeight, bool bRealtime, ASiteObj site) { GetParams(); m_nOneHourWidth = (m_nParentWidth - m_nHMarigineLeft - m_nHMarigineRight) / 25; m_nOneMmRainHeight = (m_nParentHeight - m_nVMarigineTop - m_nVMarigineBottom) / 10; m_nMapWidth = m_nNumOfDays * 25 * m_nOneHourWidth + m_nHMarigineLeft + m_nHMarigineRight; m_nMapHeight = m_nMaxRainHeight * m_nOneMmRainHeight + m_nVMarigineTop + m_nVMarigineBottom; nWidth = m_nMapWidth; nHeight = m_nMapHeight; System.Drawing.Bitmap pBitmap = new Bitmap(m_nMapWidth, m_nMapHeight);// System.Drawing.Graphics pGraphics = System.Drawing.Graphics.FromImage(pBitmap); pGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; if (bRealtime) { } if (OnCountRainStartAndStopTimeEvent != null) { OnCountRainStartAndStopTimeEvent(m_nBeginTime, bRealtime); } g_mu = new _maxunit[100]; g_start_mm = new int[100]; g_mm = new int[100]; m_pSiteRainCalc.getMaxUnits(m_nBeginTime, 600, g_mu, site); m_pSiteRainCalc.getMMByHour(m_nBeginTime, 25, g_start_mm, g_mm, site); DrawRainAxis(pGraphics); DrawRainLine(pGraphics, site.RainClickLists, site.Records, bRealtime, g_mu); pGraphics.Dispose(); GC.Collect(); return(pBitmap); }
public void Initialize(bool bRealtime, string historytm) { int[] _start_mm = new int[48]; int[] _mm = new int[48]; if (bRealtime) { setlbDtTxt(); } else { setlbDtTxt(historytm); } ////////////// long now = Time.DateTime2DbTime(DateTime.Now); long oneDayBefore = Time.DateTime2DbTime(DateTime.Parse(lbTime.Text)) - 24 * 3600; long d = 0; DateTime dt_now = Time.DbTime2DateTime(now); DateTime dt_oneDayBefor = Time.DbTime2DateTime(oneDayBefore); if (dt_now.Day == dt_oneDayBefor.Day && dt_now.Month == dt_oneDayBefor.Month && dt_now.Year == dt_oneDayBefor.Year && dt_now.Hour > 18) { d = now; } else { d = oneDayBefore; } DateTime dt = Time.DbTime2DateTime(d); dt = new DateTime(dt.Year, dt.Month, dt.Day, 19, 0, 0); long t0 = Time.DateTime2DbTime(dt); //////////////// _maxunit[] mu = new _maxunit[25]; m_siteRainCalc.getMMByHour(t0, 25, _start_mm, _mm, m_pCurSite); m_siteRainCalc.getMaxUnits(t0, 600, mu, m_pCurSite); rainLogCtrl.logCtrl._maxunit [] mu2 = new rainLogCtrl.logCtrl._maxunit[25]; for (int i = 0; i < 25; i++) { mu2[i].start = mu[i].start; mu2[i].end = mu[i].end; mu2[i].max = mu[i].max; mu2[i].idx_start = mu[i].idx_start; mu2[i].idx_end = mu[i].idx_end; } _RFLog[] log = new _RFLog[64]; int N = m_dbHelper.GetRainLogRecords(log, t0, m_pCurSite.SiteID); rainLogCtrl.logCtrl._RFLog[] rLog = new rainLogCtrl.logCtrl._RFLog[64]; for (int i = 0; i < N; i++) { if (log[i].level.Equals("1")) { continue; } if (log[i].level.Equals("2")) { rLog[i].limit_restore = log[i].tm2; rLog[i].limit_start = log[i].tm1; rLog[i].brk_close = 0; rLog[i].brk_open = 0; } if (log[i].level.Equals("3") || log[i].level.Equals("4")) { rLog[i].limit_restore = 0; rLog[i].limit_start = 0; rLog[i].brk_close = log[i].tm2; rLog[i].brk_open = log[i].tm1; } rLog[i].dir = (m_siteRainCalc.getXingbieName(log[i].section_id).Split('~'))[1]; rLog[i].km = m_siteRainCalc.getQjName(log[i].section_id); rLog[i].level = log[i].level; rLog[i].logtime = log[i].logtime; rLog[i].note = log[i].note; rLog[i].railLine = m_siteRainCalc.getLineName(log[i].section_id); rLog[i].site_id = log[i].site_id; } rainlogCtrl.SetRainLog(_start_mm, _mm, mu2, now, t0, rLog, N); }