//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("StationKeeping", StationKeeping.ToString()); // if (ReferenceFrameType == ReferenceFrameTypes.Orbital) // { // xmlWriter.WriteAttributeString("ShowOrbitPath", ShowOrbitPath.ToString()); // 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()); // } // xmlWriter.WriteEndElement(); //} public virtual void SaveToXml(XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("ReferenceFrame"); xmlWriter.WriteAttributeString("Name", Name); xmlWriter.WriteAttributeString("Parent", Parent); xmlWriter.WriteAttributeString("ReferenceFrameType", Enums.ToXml("ReferenceFrameTypes", (int)ReferenceFrameType)); xmlWriter.WriteAttributeString("Reference", Enums.ToXml("ReferenceFrames", (int)Reference)); 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", RepresentativeColor.Save()); 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", Enums.ToXml("AltUnits", (int)SemiMajorAxisUnits)); 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()); } //todo add this back when we support trajectories //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(XmlTextWriter xmlWriter, string elementName) { xmlWriter.WriteStartElement(elementName); xmlWriter.WriteAttributeString("Name", name); xmlWriter.WriteAttributeString("DataSetType", Enums.ToXml("ImageSetType", (int)type)); if (this.Type == ImageSetType.Sky) { xmlWriter.WriteAttributeString("RA", camParams.RA.ToString()); xmlWriter.WriteAttributeString("Dec", camParams.Dec.ToString()); } else { xmlWriter.WriteAttributeString("Lat", Lat.ToString()); xmlWriter.WriteAttributeString("Lng", Lng.ToString()); } xmlWriter.WriteAttributeString("Constellation", constellation); xmlWriter.WriteAttributeString("Classification", Enums.ToXml("Classification", (int)classification)); xmlWriter.WriteAttributeString("Magnitude", magnitude.ToString()); xmlWriter.WriteAttributeString("Distance", distnace.ToString()); xmlWriter.WriteAttributeString("AngularSize", AngularSize.ToString()); xmlWriter.WriteAttributeString("ZoomLevel", ZoomLevel.ToString()); xmlWriter.WriteAttributeString("Rotation", camParams.Rotation.ToString()); xmlWriter.WriteAttributeString("Angle", camParams.Angle.ToString()); xmlWriter.WriteAttributeString("Opacity", camParams.Opacity.ToString()); xmlWriter.WriteAttributeString("Target", Enums.ToXml("SolarSystemObjects", (int)Target)); xmlWriter.WriteAttributeString("ViewTarget", camParams.ViewTarget.ToString()); xmlWriter.WriteAttributeString("TargetReferenceFrame", camParams.TargetReferenceFrame); //todo what do we do with full dome? // xmlWriter.WriteAttributeString("DomeAlt", camParams.DomeAlt.ToString()); // xmlWriter.WriteAttributeString("DomeAz", camParams.DomeAz.ToString()); xmlWriter.WriteStartElement("Description"); xmlWriter.WriteCData(HtmlDescription); xmlWriter.WriteEndElement(); if (backgroundImageSet != null) { xmlWriter.WriteStartElement("BackgroundImageSet"); Imageset.SaveToXml(xmlWriter, backgroundImageSet, ""); xmlWriter.WriteEndElement(); } if (studyImageset != null) { Imageset.SaveToXml(xmlWriter, studyImageset, ""); } xmlWriter.WriteEndElement(); }
public static void SaveToXml(XmlTextWriter xmlWriter, Imageset imageset, string alternateUrl) { xmlWriter.WriteStartElement("ImageSet"); xmlWriter.WriteAttributeString("Generic", imageset.Generic.ToString()); xmlWriter.WriteAttributeString("DataSetType", Enums.ToXml("ImageSetType", (int)imageset.DataSetType)); xmlWriter.WriteAttributeString("BandPass", Enums.ToXml("BandPass", (int)imageset.BandPass)); if (!imageset.Generic) { xmlWriter.WriteAttributeString("Name", imageset.Name); if (String.IsNullOrEmpty(alternateUrl)) { xmlWriter.WriteAttributeString("Url", imageset.Url); } else { xmlWriter.WriteAttributeString("Url", alternateUrl); } xmlWriter.WriteAttributeString("DemUrl", imageset.DemUrl); xmlWriter.WriteAttributeString("BaseTileLevel", imageset.BaseLevel.ToString()); xmlWriter.WriteAttributeString("TileLevels", imageset.Levels.ToString()); xmlWriter.WriteAttributeString("BaseDegreesPerTile", imageset.BaseTileDegrees.ToString()); xmlWriter.WriteAttributeString("FileType", imageset.Extension); xmlWriter.WriteAttributeString("BottomsUp", imageset.BottomsUp.ToString()); xmlWriter.WriteAttributeString("Projection", Enums.ToXml("ProjectionType", (int)imageset.Projection)); xmlWriter.WriteAttributeString("QuadTreeMap", imageset.QuadTreeTileMap); xmlWriter.WriteAttributeString("CenterX", imageset.CenterX.ToString()); xmlWriter.WriteAttributeString("CenterY", imageset.CenterY.ToString()); xmlWriter.WriteAttributeString("OffsetX", imageset.OffsetX.ToString()); xmlWriter.WriteAttributeString("OffsetY", imageset.OffsetY.ToString()); xmlWriter.WriteAttributeString("Rotation", imageset.Rotation.ToString()); xmlWriter.WriteAttributeString("Sparse", imageset.Sparse.ToString()); xmlWriter.WriteAttributeString("ElevationModel", imageset.ElevationModel.ToString()); xmlWriter.WriteAttributeString("StockSet", imageset.DefaultSet.ToString()); xmlWriter.WriteAttributeString("WidthFactor", imageset.WidthFactor.ToString()); xmlWriter.WriteAttributeString("MeanRadius", imageset.MeanRadius.ToString()); xmlWriter.WriteAttributeString("ReferenceFrame", imageset.ReferenceFrame); if (String.IsNullOrEmpty(alternateUrl)) { xmlWriter.WriteElementString("ThumbnailUrl", imageset.ThumbnailUrl); } else { xmlWriter.WriteElementString("ThumbnailUrl", imageset.Url); } } xmlWriter.WriteEndElement(); }
internal void SaveToXml(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", ForegroundColor.Save()); xmlWriter.WriteAttributeString("BackgroundColor", BackgroundColor.Save()); xmlWriter.WriteAttributeString("BorderStyle", Enums.ToXml("TextBorderStyle", (int)BorderStyle)); xmlWriter.WriteString(this.Text); xmlWriter.WriteEndElement(); }
public string GetTourXML() { XmlTextWriter xmlWriter = new XmlTextWriter(); xmlWriter.Formatting = Formatting.Indented; xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); xmlWriter.WriteStartElement("Tour"); xmlWriter.WriteAttributeString("ID", this.id); xmlWriter.WriteAttributeString("Title", this.title); xmlWriter.WriteAttributeString("Descirption", this.Description); xmlWriter.WriteAttributeString("Description", this.Description); xmlWriter.WriteAttributeString("RunTime", ((double)this.RunTime / 1000.0).ToString()); xmlWriter.WriteAttributeString("Author", this.author); xmlWriter.WriteAttributeString("AuthorEmail", this.authorEmail); xmlWriter.WriteAttributeString("OrganizationUrl", this.organizationUrl); xmlWriter.WriteAttributeString("OrganizationName", this.OrgName); xmlWriter.WriteAttributeString("Keywords", this.Keywords); xmlWriter.WriteAttributeString("UserLevel", Enums.ToXml("UserLevel", (int)level)); xmlWriter.WriteAttributeString("Classification", Enums.ToXml("Classification", (int)type)); xmlWriter.WriteAttributeString("Taxonomy", taxonomy.ToString()); // xmlWriter.WriteAttributeString("DomeMode", DomeMode.ToString()); bool timeLineTour = IsTimelineTour(); xmlWriter.WriteAttributeString("TimeLineTour", timeLineTour.ToString()); xmlWriter.WriteStartElement("TourStops"); foreach (TourStop stop in TourStops) { stop.SaveToXml(xmlWriter, true); } xmlWriter.WriteEndElement(); List <Guid> masterList = CreateLayerMasterList(); // This will now save and sync emtpy frames... List <ReferenceFrame> referencedFrames = GetReferenceFrameList(); xmlWriter.WriteStartElement("ReferenceFrames"); foreach (ReferenceFrame item in referencedFrames) { item.SaveToXml(xmlWriter); } xmlWriter.WriteEndElement(); xmlWriter.WriteStartElement("Layers"); foreach (Guid id in masterList) { if (LayerManager.LayerList.ContainsKey(id)) { LayerManager.LayerList[id].SaveToXml(xmlWriter); } } xmlWriter.WriteEndElement(); xmlWriter.WriteFullEndElement(); xmlWriter.Close(); return(xmlWriter.Body); }