static XmlElement encodeRuntimeMapLayer(XmlDocument doc, RuntimeMapLayer rmaplayer) { XmlElement e = null; if (rmaplayer != null) { e = doc.CreateElement("maplayer"); e.SetAttribute("layer", rmaplayer.getBuildLayer().getName()); e.SetAttribute("searchlayer", rmaplayer.getSearchLayer().getName()); e.SetAttribute("visible", (rmaplayer.getVisible() ? "true" : "false")); e.SetAttribute("searchable", (rmaplayer.getSearchable() ? "true" : "false")); } return(e); }
static RuntimeMapLayer decodeRuntimeMapLayer(XmlElement e, Project proj) { RuntimeMapLayer layer = null; if (e != null) { layer = new RuntimeMapLayer(); layer.setBuildLayer(proj.getLayer(e.GetAttribute("layer"))); layer.setSearchLayer(proj.getLayer(e.GetAttribute("searchlayer"))); if (e.GetAttribute("searchable") == "true") { layer.setSearchable(true); } if (e.GetAttribute("visible") == "false") { layer.setVisible(false); } } return(layer); }
static RuntimeMap decodeRuntimeMap(XmlElement e, Project proj) { RuntimeMap map = null; if (e != null) { map = new RuntimeMap(); map.setName(e.GetAttribute("name")); map.setTerrain(proj.getTerrain(e.GetAttribute("terrain"))); XmlNodeList map_layers = e.GetElementsByTagName("maplayer"); foreach (XmlNode i in map_layers) { XmlElement e2 = (XmlElement)i; RuntimeMapLayer map_layer = decodeRuntimeMapLayer(e2, proj); if (map_layer != null) { map.getMapLayers().Add(map_layer); } } } return(map); }