private void FromXml(System.Xml.XmlNode node) { ID = new Guid(node.Attributes["Id"].Value); Name = node.Attributes["Name"].Value; referenceFrame = node.Attributes["ReferenceFrame"].Value; color = SavedColor.Load(node.Attributes["Color"].Value); opacity = Convert.ToSingle(node.Attributes["Opacity"].Value); if (node.Attributes["StartTime"] != null) { StartTime = Convert.ToDateTime(node.Attributes["StartTime"].Value); } if (node.Attributes["EndTime"] != null) { EndTime = Convert.ToDateTime(node.Attributes["EndTime"].Value); } if (node.Attributes["FadeSpan"] != null) { FadeSpan = TimeSpan.Parse(node.Attributes["FadeSpan"].Value); } if (node.Attributes["FadeType"] != null) { FadeType = (FadeType)Enum.Parse(typeof(FadeType), node.Attributes["FadeType"].Value); } InitializeFromXml(node); }
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(); }
internal void SaveToXml(System.Xml.XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("TextObject"); xmlWriter.WriteAttributeString("Bold", Bold.ToString()); xmlWriter.WriteAttributeString("Italic", Italic.ToString()); xmlWriter.WriteAttributeString("Underline", Underline.ToString()); xmlWriter.WriteAttributeString("FontSize", FontSize.ToString()); xmlWriter.WriteAttributeString("FontName", FontName); xmlWriter.WriteAttributeString("ForgroundColor", SavedColor.Save(ForegroundColor)); xmlWriter.WriteAttributeString("BackgroundColor", SavedColor.Save(BackgroundColor)); xmlWriter.WriteAttributeString("BorderStyle", BorderStyle.ToString()); xmlWriter.WriteString(this.Text); xmlWriter.WriteEndElement(); }
public virtual void SaveToXml(System.Xml.XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("Layer"); xmlWriter.WriteAttributeString("Id", ID.ToString()); xmlWriter.WriteAttributeString("Type", this.GetType().FullName); xmlWriter.WriteAttributeString("Name", Name); xmlWriter.WriteAttributeString("ReferenceFrame", referenceFrame); xmlWriter.WriteAttributeString("Color", SavedColor.Save(color)); xmlWriter.WriteAttributeString("Opacity", opacity.ToString()); xmlWriter.WriteAttributeString("StartTime", StartTime.ToString()); xmlWriter.WriteAttributeString("EndTime", EndTime.ToString()); xmlWriter.WriteAttributeString("FadeSpan", FadeSpan.ToString()); xmlWriter.WriteAttributeString("FadeType", FadeType.ToString()); this.WriteLayerProperties(xmlWriter); xmlWriter.WriteEndElement(); }
internal static TextObject FromXml(System.Xml.XmlNode node) { TextObject newTextObject = new TextObject(); newTextObject.Text = node.InnerText; newTextObject.BorderStyle = TextBorderStyle.None; newTextObject.Bold = Convert.ToBoolean(node.Attributes["Bold"].Value); newTextObject.Italic = Convert.ToBoolean(node.Attributes["Italic"].Value); newTextObject.Underline = Convert.ToBoolean(node.Attributes["Underline"].Value); newTextObject.FontSize = Convert.ToSingle(node.Attributes["FontSize"].Value); newTextObject.FontName = node.Attributes["FontName"].Value; newTextObject.ForegroundColor = SavedColor.Load(node.Attributes["ForgroundColor"].Value); newTextObject.BackgroundColor = SavedColor.Load(node.Attributes["BackgroundColor"].Value); if (node.Attributes["BorderStyle"] != null) { newTextObject.BorderStyle = (TextBorderStyle)(Enum.Parse(typeof(TextBorderStyle), node.Attributes["BorderStyle"].Value)); } return(newTextObject); }
public void LoadInstance(string val) { this.Color = SavedColor.Load(val); }
public string Save() { return(SavedColor.Save(this)); }
public virtual void InitializeFromXml(System.Xml.XmlNode node) { Name = node.Attributes["Name"].Value; Parent = node.Attributes["Parent"].Value; ReferenceFrameType = (ReferenceFrameTypes)Enum.Parse(typeof(ReferenceFrameTypes), node.Attributes["ReferenceFrameType"].Value); Reference = (ReferenceFrames)Enum.Parse(typeof(ReferenceFrames), node.Attributes["Reference"].Value); ParentsRoationalBase = Boolean.Parse(node.Attributes["ParentsRoationalBase"].Value); MeanRadius = Double.Parse(node.Attributes["MeanRadius"].Value); Oblateness = Double.Parse(node.Attributes["Oblateness"].Value); Heading = Double.Parse(node.Attributes["Heading"].Value); Pitch = Double.Parse(node.Attributes["Pitch"].Value); Roll = Double.Parse(node.Attributes["Roll"].Value); Scale = Double.Parse(node.Attributes["Scale"].Value); Tilt = Double.Parse(node.Attributes["Tilt"].Value); Translation = Vector3d.Parse(node.Attributes["Translation"].Value); if (ReferenceFrameType == ReferenceFrameTypes.FixedSherical) { Lat = Double.Parse(node.Attributes["Lat"].Value); Lng = Double.Parse(node.Attributes["Lng"].Value); Altitude = Double.Parse(node.Attributes["Altitude"].Value); } RotationalPeriod = Double.Parse(node.Attributes["RotationalPeriod"].Value); ZeroRotationDate = Double.Parse(node.Attributes["ZeroRotationDate"].Value); RepresentativeColor = SavedColor.Load(node.Attributes["RepresentativeColor"].Value); ShowAsPoint = Boolean.Parse(node.Attributes["ShowAsPoint"].Value); if (node.Attributes["StationKeeping"] != null) { StationKeeping = Boolean.Parse(node.Attributes["StationKeeping"].Value); } if (node.Attributes["ShowOrbitPath"] != null) { ShowOrbitPath = Boolean.Parse(node.Attributes["ShowOrbitPath"].Value); } if (ReferenceFrameType == ReferenceFrameTypes.Orbital) { SemiMajorAxis = Double.Parse(node.Attributes["SemiMajorAxis"].Value); SemiMajorAxisUnits = (AltUnits)Enum.Parse(typeof(AltUnits), node.Attributes["SemiMajorAxisScale"].Value); Eccentricity = Double.Parse(node.Attributes["Eccentricity"].Value); Inclination = Double.Parse(node.Attributes["Inclination"].Value); ArgumentOfPeriapsis = Double.Parse(node.Attributes["ArgumentOfPeriapsis"].Value); LongitudeOfAscendingNode = Double.Parse(node.Attributes["LongitudeOfAscendingNode"].Value); MeanAnomolyAtEpoch = Double.Parse(node.Attributes["MeanAnomolyAtEpoch"].Value); MeanDailyMotion = Double.Parse(node.Attributes["MeanDailyMotion"].Value); Epoch = Double.Parse(node.Attributes["Epoch"].Value); } if (ReferenceFrameType == ReferenceFrameTypes.Trajectory) { if (node["Trajectory"] != null) { foreach (XmlNode child in node["Trajectory"]) { Trajectory.Add(new TrajectorySample(child.InnerText)); } } } SystemGenerated = false; }
public override void WriteLayerProperties(System.Xml.XmlTextWriter xmlWriter) { xmlWriter.WriteAttributeString("PointOpacity", PointOpacity.ToString()); xmlWriter.WriteAttributeString("PointColor", SavedColor.Save(pointColor)); }
public override void InitializeFromXml(System.Xml.XmlNode node) { PointOpacity = double.Parse(node.Attributes["PointOpacity"].Value); PointColor = SavedColor.Load(node.Attributes["PointColor"].Value); }