int nDelta = 30;
int nMinRow = 0;
int nMinCol = 0;
int nMaxRow = 10000;
int nMaxCol = 100000;
m_strKeyList.Clear();
System.Xml.XmlDocument m_Doc = new System.Xml.XmlDocument();
m_Doc.AppendChild(m_Doc.CreateElement("TilingTask"));
string strKey = "";
System.Xml.XmlNode xmlJobParameters = m_Doc.DocumentElement.AppendChild(m_Doc.DocumentElement.OwnerDocument.CreateElement("JobParameters"));
System.Xml.XmlDocument m_tmp = new System.Xml.XmlDocument();
for (int r = nMinRow; r <= nMaxRow; r += nDelta)
for (int c = nMinCol; c <= nMaxCol; c += nDelta)
{
strKey = string.Format("<Pyramid Level=\"{0}\" MinRow=\"{1}\" MinCol=\"{2}\" MaxRow=\"{3}\" MaxCol=\"{4}\" Count=\"{5}\"/>",
19, r, c, Math.Min(r + nDelta - 1, nMaxRow), Math.Min(c + nDelta - 1, nMaxCol), nDelta * nDelta);
//xmlJobParameters.InnerText += strKey; 此种效率低但是占用内存小
//此种占内存大
System.Xml.XmlElement elem = m_Doc.CreateElement("Pyramid");
elem.SetAttribute("Level", 19.ToString());
elem.SetAttribute("MinRow", r.ToString());
elem.SetAttribute("MinCol", c.ToString());
elem.SetAttribute("MaxRow", Math.Min(r + nDelta - 1, nMaxRow).ToString());
elem.SetAttribute("MaxCol", Math.Min(c + nDelta - 1, nMaxCol).ToString());
elem.SetAttribute("Count", (nDelta * nDelta).ToString());
try
{
xmlJobParameters.AppendChild(elem);
}
catch (Exception e) { }
//System.Runtime.InteropServices.Marshal.ReleaseComObject(elem);
m_strKeyList.Add(strKey);
elem = null;
strKey = null;
}
m_Doc.Save(@"C:\s.xml");
m_tmp = null;