public virtual void SaveToXML(XmlElement objOrbit) { var nfi = System.Globalization.NumberFormatInfo.InvariantInfo; var xePlanet = objOrbit.OwnerDocument.CreateElement("Planet"); objOrbit.AppendChild(xePlanet); Common.CreateTextNode(xePlanet, "Type", PlanetType.ToString()); Common.CreateTextNode(xePlanet, "Dense", Dense.ToString()); Common.CreateTextNode(xePlanet, "Mass", Mass.ToString()); Common.CreateTextNode(xePlanet, "Gravity", Grav.ToString()); Common.CreateTextNode(xePlanet, "Pressure", Pressure.ToString()); Common.CreateTextNode(xePlanet, "MaxPop", Maxpop.ToString()); Common.CreateTextNode(xePlanet, "OrbitRange", OrbitRange.ToString()); Common.CreateTextNode(xePlanet, "OrbitNumber", OrbitNumber.ToString()); Common.CreateTextNode(xePlanet, "Tilt", Tilt.ToString()); Common.CreateTextNode(xePlanet, "Ecc", Ecc.ToString()); Common.CreateTextNode(xePlanet, "Rotation", Rotation.ToString()); Common.CreateTextNode(xePlanet, "TidallyLocked", TidallyLocked.ToString()); Common.CreateTextNode(xePlanet, "Temp", Temp.ToString()); Common.CreateTextNode(xePlanet, "Diameter", Diameter.ToString()); Common.CreateTextNode(xePlanet, "NumSats", Satellites.Count.ToString()); Common.CreateTextNode(xePlanet, "Mainworld", MainWorld.ToString()); Common.CreateTextNode(xePlanet, "NormalUWP", Normal.DisplayString(PlanetType, Diameter)); Common.CreateTextNode(xePlanet, "CollapseUWP", Collapse.DisplayString(PlanetType, Diameter)); Common.CreateTextNode(xePlanet, "Life", Life.ToString()); Common.CreateTextNode(xePlanet, "LifeFactor", LifeFactor.ToString()); Common.CreateTextNode(xePlanet, "Name", Name); var xeChild = objOrbit.OwnerDocument.CreateElement("Temperature"); for (var i = 0; i < (Constants.NUM_HEX_ROWS * 2) - 1; i += 2) { var xeTemp = objOrbit.OwnerDocument.CreateElement("Row" + (i / 2 + 1).ToString()); Common.CreateTextNode(xeTemp, "Summer", Summer[i].ToString("N", nfi) + "/" + Summer[i + 1].ToString("N", nfi)); Common.CreateTextNode(xeTemp, "Fall", Fall[i].ToString("N", nfi) + "/" + Fall[i + 1].ToString("N", nfi)); Common.CreateTextNode(xeTemp, "Winter", Winter[i].ToString("N", nfi) + "/" + Winter[i + 1].ToString("N", nfi)); xeChild.AppendChild(xeTemp); } xePlanet.AppendChild(xeChild); if (Life) { xeChild = objOrbit.OwnerDocument.CreateElement("AnimalEncounters"); TableGenerator.WriteToXML(xeChild); xePlanet.AppendChild(xeChild); } Normal.SaveToXML(xePlanet); Collapse.SaveToXML(xePlanet); foreach (var satellite in Satellites) { satellite.SaveToXML(xePlanet); } }
public virtual void SaveToXml(System.Xml.XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("ReferenceFrame"); xmlWriter.WriteAttributeString("Name", Name); xmlWriter.WriteAttributeString("Parent", Parent); xmlWriter.WriteAttributeString("ReferenceFrameType", ReferenceFrameType.ToString()); xmlWriter.WriteAttributeString("Reference", Reference.ToString()); xmlWriter.WriteAttributeString("ParentsRoationalBase", ParentsRoationalBase.ToString()); xmlWriter.WriteAttributeString("MeanRadius", MeanRadius.ToString()); xmlWriter.WriteAttributeString("Oblateness", Oblateness.ToString()); xmlWriter.WriteAttributeString("Heading", Heading.ToString()); xmlWriter.WriteAttributeString("Pitch", Pitch.ToString()); xmlWriter.WriteAttributeString("Roll", Roll.ToString()); xmlWriter.WriteAttributeString("Scale", Scale.ToString()); xmlWriter.WriteAttributeString("Tilt", Tilt.ToString()); xmlWriter.WriteAttributeString("Translation", Translation.ToString()); if (ReferenceFrameType == ReferenceFrameTypes.FixedSherical) { xmlWriter.WriteAttributeString("Lat", Lat.ToString()); xmlWriter.WriteAttributeString("Lng", Lng.ToString()); xmlWriter.WriteAttributeString("Altitude", Altitude.ToString()); } xmlWriter.WriteAttributeString("RotationalPeriod", RotationalPeriod.ToString()); xmlWriter.WriteAttributeString("ZeroRotationDate", ZeroRotationDate.ToString()); xmlWriter.WriteAttributeString("RepresentativeColor", SavedColor.Save(RepresentativeColor)); xmlWriter.WriteAttributeString("ShowAsPoint", ShowAsPoint.ToString()); xmlWriter.WriteAttributeString("ShowOrbitPath", ShowOrbitPath.ToString()); xmlWriter.WriteAttributeString("StationKeeping", StationKeeping.ToString()); if (ReferenceFrameType == ReferenceFrameTypes.Orbital) { xmlWriter.WriteAttributeString("SemiMajorAxis", SemiMajorAxis.ToString()); xmlWriter.WriteAttributeString("SemiMajorAxisScale", this.SemiMajorAxisUnits.ToString()); xmlWriter.WriteAttributeString("Eccentricity", Eccentricity.ToString()); xmlWriter.WriteAttributeString("Inclination", Inclination.ToString()); xmlWriter.WriteAttributeString("ArgumentOfPeriapsis", ArgumentOfPeriapsis.ToString()); xmlWriter.WriteAttributeString("LongitudeOfAscendingNode", LongitudeOfAscendingNode.ToString()); xmlWriter.WriteAttributeString("MeanAnomolyAtEpoch", MeanAnomolyAtEpoch.ToString()); xmlWriter.WriteAttributeString("MeanDailyMotion", MeanDailyMotion.ToString()); xmlWriter.WriteAttributeString("Epoch", Epoch.ToString()); } if (ReferenceFrameType == ReferenceFrameTypes.Trajectory) { xmlWriter.WriteStartElement("Trajectory"); foreach (TrajectorySample sample in Trajectory) { string data = sample.ToString(); xmlWriter.WriteElementString("Sample", data); } xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); }
public override XmlNode ToXml(XmlNode parent) { XmlNode result = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "Camera", string.Empty); //create child nodes XmlNode nodLong = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "longitude", string.Empty); nodLong.InnerText = Longitude.ToString(); result.AppendChild(nodLong); XmlNode nodLat = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "latitude", string.Empty); nodLat.InnerText = Latitude.ToString(); result.AppendChild(nodLat); XmlNode nodAlt = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "altitude", string.Empty); nodAlt.InnerText = Altitude.ToString(); result.AppendChild(nodAlt); XmlNode nodRoll = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "roll", string.Empty); nodRoll.InnerText = Roll.ToString(); result.AppendChild(nodRoll); XmlNode nodTilt = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "tilt", string.Empty); nodTilt.InnerText = Tilt.ToString(); result.AppendChild(nodTilt); XmlNode nodHeading = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "heading", string.Empty); nodHeading.InnerText = Heading.ToString(); result.AppendChild(nodHeading); XmlNode nodAltitudeMode = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "altitudeMode", string.Empty); nodAltitudeMode.InnerText = AltitudeMode; result.AppendChild(nodAltitudeMode); return(result); }
public XmlNode ToXml(XmlNode parent) { XmlNode result = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "Orientation", string.Empty); // child nodes XmlNode nodHeading = result.OwnerDocument.CreateNode(XmlNodeType.Element, "heading", string.Empty); nodHeading.InnerText = Heading.ToString(); result.AppendChild(nodHeading); XmlNode nodTilt = result.OwnerDocument.CreateNode(XmlNodeType.Element, "tilt", string.Empty); nodTilt.InnerText = Tilt.ToString(); result.AppendChild(nodTilt); XmlNode nodRoll = result.OwnerDocument.CreateNode(XmlNodeType.Element, "roll", string.Empty); nodRoll.InnerText = Roll.ToString(); result.AppendChild(nodRoll); return(result); }
public string toString() { return("CameraID: " + Camera.ToString() + " Pan: " + Pan.ToString() + " Tilt: " + Tilt.ToString() + " Zoom: " + Zoom.ToString()); }