예제 #1
0
        public KmlElement(KmlDocument ownerDoc, string kmlType, string name, int open, string description)
        {
            m_ownerDoc = ownerDoc;

            m_elementNode = m_ownerDoc.xmlDoc.CreateElement(kmlType);

            XmlNode node;

            if (name != null)
            {
                node           = m_elementNode.OwnerDocument.CreateElement("name");
                node.InnerText = name.Trim();
                m_elementNode.AppendChild(node);
            }

            // setSnippet();
            node = m_elementNode.OwnerDocument.CreateElement("Snippet");
            m_elementNode.AppendChild(node);

            XmlAttribute attr = m_elementNode.OwnerDocument.CreateAttribute("maxLines");

            attr.InnerText = "2";
            node.Attributes.Append(attr);

            if (description != null)
            {
                node = m_elementNode.OwnerDocument.CreateElement("description");
                m_elementNode.AppendChild(node);
                XmlNode node2 = m_elementNode.OwnerDocument.CreateCDataSection("description");
                node2.InnerText = description.Trim();
                node.AppendChild(node2);
            }

            if (open >= 0)
            {
                node           = m_elementNode.OwnerDocument.CreateElement("open");
                node.InnerText = String.Format("{0}", open);
                m_elementNode.AppendChild(node);
            }
        }
예제 #2
0
        public static void importStyles(KmlDocument kmlDoc)
        {
            XmlDocument stylesXmlDoc = new XmlDocument();

            string filename = Path.Combine(Application.StartupPath, "kmlstyles.xml");   // Project.GetMiscPath("kmlstyles.xml");

            if (File.Exists(filename))
            {
                stylesXmlDoc.Load(filename);

                XmlNodeList styleNodes = stylesXmlDoc.SelectNodes("//Style");

                foreach (XmlNode node in styleNodes)
                {
                    XmlNode myNode = kmlDoc.xmlDoc.ImportNode(node, true);
                    kmlDoc.documentNode.AppendChild(myNode);
                }
                LibSys.StatusBar.Trace("* Ready");
            }
            else
            {
                Project.ErrorBox(null, "Error: could not locate file " + filename);
            }
        }
예제 #3
0
 public KmlFolder(KmlDocument ownerDoc, string name, int open, string description)
     : base(ownerDoc, "Folder", name, open, description)
 {
 }