/// <summary> /// Show serialized item in browser /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnViewXmlClick(object sender, EventArgs e) { ConfigurationSaver.SaveAs(this, "temp.xml"); System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(); psi.FileName = "temp.xml"; psi.Verb = "open"; psi.UseShellExecute = true; psi.CreateNoWindow = true; System.Diagnostics.Process.Start(psi); }
/// <summary> /// Save item from LM to a file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnSaveAsClick(object sender, EventArgs e) { SaveFileDialog fd = new SaveFileDialog(); fd.AddExtension = true; fd.DefaultExt = "xml"; if (fd.ShowDialog() == DialogResult.OK) { try { ConfigurationSaver.SaveAs(this, fd.FileName); } catch (Exception ex) { MessageBox.Show(ex.Message, "Save as..."); } } }
public override XmlNode ToXml(XmlDocument worldDoc) { XmlNode lfNode = worldDoc.CreateElement("LineFeature"); ConfigurationSaver.getRenderableObjectProperties(this, lfNode); XmlNode altitudeModeNode = worldDoc.CreateElement("AltitudeMode"); altitudeModeNode.AppendChild(worldDoc.CreateTextNode(AltitudeMode.ToString())); lfNode.AppendChild(altitudeModeNode); XmlNode minDANode = worldDoc.CreateElement("MinimumDisplayAltitude"); minDANode.AppendChild(worldDoc.CreateTextNode(MinimumDisplayAltitude.ToString(CultureInfo.InvariantCulture))); lfNode.AppendChild(minDANode); XmlNode maxDANode = worldDoc.CreateElement("MaximumDisplayAltitude"); maxDANode.AppendChild(worldDoc.CreateTextNode(MaximumDisplayAltitude.ToString(CultureInfo.InvariantCulture))); lfNode.AppendChild(maxDANode); XmlNode dASNode = worldDoc.CreateElement("DistanceAboveSurface"); dASNode.AppendChild(worldDoc.CreateTextNode(DistanceAboveSurface.ToString(CultureInfo.InvariantCulture))); lfNode.AppendChild(dASNode); XmlNode extrudeHeightNode = worldDoc.CreateElement("ExtrudeHeight"); extrudeHeightNode.AppendChild(worldDoc.CreateTextNode(ExtrudeHeight.ToString(CultureInfo.InvariantCulture))); lfNode.AppendChild(extrudeHeightNode); XmlNode extrudeNode = worldDoc.CreateElement("Extrude"); extrudeNode.AppendChild(worldDoc.CreateTextNode(Extrude.ToString(CultureInfo.InvariantCulture))); lfNode.AppendChild(extrudeNode); XmlNode extrudeUpwardsNode = worldDoc.CreateElement("ExtrudeUpwards"); extrudeUpwardsNode.AppendChild(worldDoc.CreateTextNode(ExtrudeUpwards.ToString(CultureInfo.InvariantCulture))); lfNode.AppendChild(extrudeUpwardsNode); XmlNode extrudeToGroundNode = worldDoc.CreateElement("ExtrudeToGround"); extrudeToGroundNode.AppendChild(worldDoc.CreateTextNode(ExtrudeToGround.ToString(CultureInfo.InvariantCulture))); lfNode.AppendChild(extrudeToGroundNode); XmlNode imageUriNode = worldDoc.CreateElement("ImageUri"); imageUriNode.AppendChild(worldDoc.CreateTextNode(ImageUri)); lfNode.AppendChild(imageUriNode); XmlNode outlineNode = worldDoc.CreateElement("Outline"); outlineNode.AppendChild(worldDoc.CreateTextNode(Outline.ToString(CultureInfo.InvariantCulture))); lfNode.AppendChild(outlineNode); // TODO: are these right? // FeatureColor in xml = LineColor, OutlineColor in xml = PolygonColor ? XmlNode featureColorNode = worldDoc.CreateElement("FeatureColor"); ConfigurationSaver.createColorNode(featureColorNode, LineColor); lfNode.AppendChild(featureColorNode); XmlNode outlineColornode = worldDoc.CreateElement("OutlineColor"); ConfigurationSaver.createColorNode(outlineColornode, PolygonColor); lfNode.AppendChild(outlineColornode); string posList = ConfigurationSaver.createPointList(Points); XmlNode lineStringNode = worldDoc.CreateElement("LineString"); XmlNode posListNode = worldDoc.CreateElement("posList"); posListNode.AppendChild(worldDoc.CreateTextNode(posList)); lineStringNode.AppendChild(posListNode); lfNode.AppendChild(lineStringNode); return(lfNode); }