public virtual void InitializeFromXml(XmlNode node) { Name = node.Attributes.GetNamedItem("Name").Value; Parent = node.Attributes.GetNamedItem("Parent").Value; ReferenceFrameType = (ReferenceFrameTypes)Enums.Parse("ReferenceFrameTypes", node.Attributes.GetNamedItem("ReferenceFrameType").Value); Reference = (ReferenceFrames)Enums.Parse("ReferenceFrames", node.Attributes.GetNamedItem("Reference").Value); ParentsRoationalBase = Boolean.Parse(node.Attributes.GetNamedItem("ParentsRoationalBase").Value); MeanRadius = Double.Parse(node.Attributes.GetNamedItem("MeanRadius").Value); Oblateness = Double.Parse(node.Attributes.GetNamedItem("Oblateness").Value); Heading = Double.Parse(node.Attributes.GetNamedItem("Heading").Value); Pitch = Double.Parse(node.Attributes.GetNamedItem("Pitch").Value); Roll = Double.Parse(node.Attributes.GetNamedItem("Roll").Value); Scale = Double.Parse(node.Attributes.GetNamedItem("Scale").Value); Tilt = Double.Parse(node.Attributes.GetNamedItem("Tilt").Value); Translation = Vector3d.Parse(node.Attributes.GetNamedItem("Translation").Value); if (ReferenceFrameType == ReferenceFrameTypes.FixedSherical) { Lat = Double.Parse(node.Attributes.GetNamedItem("Lat").Value); Lng = Double.Parse(node.Attributes.GetNamedItem("Lng").Value); Altitude = Double.Parse(node.Attributes.GetNamedItem("Altitude").Value); } RotationalPeriod = Double.Parse(node.Attributes.GetNamedItem("RotationalPeriod").Value); ZeroRotationDate = Double.Parse(node.Attributes.GetNamedItem("ZeroRotationDate").Value); RepresentativeColor = Color.Load(node.Attributes.GetNamedItem("RepresentativeColor").Value); ShowAsPoint = Boolean.Parse(node.Attributes.GetNamedItem("ShowAsPoint").Value); if (node.Attributes.GetNamedItem("StationKeeping") != null) { StationKeeping = Boolean.Parse(node.Attributes.GetNamedItem("StationKeeping").Value); } if (ReferenceFrameType == ReferenceFrameTypes.Orbital) { ShowOrbitPath = Boolean.Parse(node.Attributes.GetNamedItem("ShowOrbitPath").Value); SemiMajorAxis = Double.Parse(node.Attributes.GetNamedItem("SemiMajorAxis").Value); SemiMajorAxisUnits = (AltUnits)Enums.Parse("AltUnits", node.Attributes.GetNamedItem("SemiMajorAxisScale").Value); Eccentricity = Double.Parse(node.Attributes.GetNamedItem("Eccentricity").Value); Inclination = Double.Parse(node.Attributes.GetNamedItem("Inclination").Value); ArgumentOfPeriapsis = Double.Parse(node.Attributes.GetNamedItem("ArgumentOfPeriapsis").Value); LongitudeOfAscendingNode = Double.Parse(node.Attributes.GetNamedItem("LongitudeOfAscendingNode").Value); MeanAnomolyAtEpoch = Double.Parse(node.Attributes.GetNamedItem("MeanAnomolyAtEpoch").Value); MeanDailyMotion = Double.Parse(node.Attributes.GetNamedItem("MeanDailyMotion").Value); Epoch = Double.Parse(node.Attributes.GetNamedItem("Epoch").Value); } }
public LayerMap(string name, ReferenceFrames reference) { Name = name; Frame.Reference = reference; double radius = 6371000; switch (reference) { case ReferenceFrames.Sky: break; case ReferenceFrames.Ecliptic: break; case ReferenceFrames.Galactic: break; case ReferenceFrames.Sun: radius = 696000000; break; case ReferenceFrames.Mercury: radius = 2439700; break; case ReferenceFrames.Venus: radius = 6051800; break; case ReferenceFrames.Earth: radius = 6371000; break; case ReferenceFrames.Mars: radius = 3390000; break; case ReferenceFrames.Jupiter: radius = 69911000; break; case ReferenceFrames.Saturn: radius = 58232000; break; case ReferenceFrames.Uranus: radius = 25362000; break; case ReferenceFrames.Neptune: radius = 24622000; break; case ReferenceFrames.Pluto: radius = 1161000; break; case ReferenceFrames.Moon: radius = 1737100; break; case ReferenceFrames.Io: radius = 1821500; break; case ReferenceFrames.Europa: radius = 1561000; break; case ReferenceFrames.Ganymede: radius = 2631200; break; case ReferenceFrames.Callisto: radius = 2410300; break; case ReferenceFrames.Custom: break; case ReferenceFrames.Identity: break; default: break; } Frame.MeanRadius = radius; }
//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 InitializeFromXml(XmlNode node) { Name = node.Attributes.GetNamedItem("Name").Value; Parent = node.Attributes.GetNamedItem("Parent").Value; switch (node.Attributes.GetNamedItem("ReferenceFrameType").Value) { case "FixedSherical": ReferenceFrameType = ReferenceFrameTypes.FixedSherical; break; case "Orbital": ReferenceFrameType = ReferenceFrameTypes.Orbital; break; case "Trajectory": ReferenceFrameType = ReferenceFrameTypes.Trajectory; break; default: break; } switch (node.Attributes.GetNamedItem("Reference").Value) { case "Sky": Reference = ReferenceFrames.Sky; break; case "Ecliptic": Reference = ReferenceFrames.Ecliptic; break; case "Galactic": Reference = ReferenceFrames.Galactic; break; case "Sun": Reference = ReferenceFrames.Sun; break; case "Mercury": Reference = ReferenceFrames.Mercury; break; case "Venus": Reference = ReferenceFrames.Venus; break; case "Earth": Reference = ReferenceFrames.Earth; break; case "Mars": Reference = ReferenceFrames.Mars; break; case "Jupiter": Reference = ReferenceFrames.Jupiter; break; case "Saturn": Reference = ReferenceFrames.Saturn; break; case "Uranus": Reference = ReferenceFrames.Uranus; break; case "Neptune": Reference = ReferenceFrames.Neptune; break; case "Pluto": Reference = ReferenceFrames.Pluto; break; case "Moon": Reference = ReferenceFrames.Moon; break; case "Io": Reference = ReferenceFrames.Io; break; case "Europa": Reference = ReferenceFrames.Europa; break; case "Ganymede": Reference = ReferenceFrames.Ganymede; break; case "Callisto": Reference = ReferenceFrames.Callisto; break; case "Custom": Reference = ReferenceFrames.Custom; break; case "Identity": Reference = ReferenceFrames.Identity; break; default: break; } ParentsRoationalBase = Boolean.Parse(node.Attributes.GetNamedItem("ParentsRoationalBase").Value); MeanRadius = Double.Parse(node.Attributes.GetNamedItem("MeanRadius").Value); Oblateness = Double.Parse(node.Attributes.GetNamedItem("Oblateness").Value); Heading = Double.Parse(node.Attributes.GetNamedItem("Heading").Value); Pitch = Double.Parse(node.Attributes.GetNamedItem("Pitch").Value); Roll = Double.Parse(node.Attributes.GetNamedItem("Roll").Value); Scale = Double.Parse(node.Attributes.GetNamedItem("Scale").Value); Tilt = Double.Parse(node.Attributes.GetNamedItem("Tilt").Value); Translation = Vector3d.Parse(node.Attributes.GetNamedItem("Translation").Value); if (ReferenceFrameType == ReferenceFrameTypes.FixedSherical) { Lat = Double.Parse(node.Attributes.GetNamedItem("Lat").Value); Lng = Double.Parse(node.Attributes.GetNamedItem("Lng").Value); Altitude = Double.Parse(node.Attributes.GetNamedItem("Altitude").Value); } RotationalPeriod = Double.Parse(node.Attributes.GetNamedItem("RotationalPeriod").Value); ZeroRotationDate = Double.Parse(node.Attributes.GetNamedItem("ZeroRotationDate").Value); RepresentativeColor = Color.Load(node.Attributes.GetNamedItem("RepresentativeColor").Value); ShowAsPoint = Boolean.Parse(node.Attributes.GetNamedItem("ShowAsPoint").Value); if (node.Attributes.GetNamedItem("StationKeeping") != null) { StationKeeping = Boolean.Parse(node.Attributes.GetNamedItem("StationKeeping").Value); } if (ReferenceFrameType == ReferenceFrameTypes.Orbital) { ShowOrbitPath = Boolean.Parse(node.Attributes.GetNamedItem("ShowOrbitPath").Value); SemiMajorAxis = Double.Parse(node.Attributes.GetNamedItem("SemiMajorAxis").Value); switch (node.Attributes.GetNamedItem("SemiMajorAxisScale").Value) { case "Meters": SemiMajorAxisUnits = AltUnits.Meters; break; case "Feet": SemiMajorAxisUnits = AltUnits.Feet; break; case "Inches": SemiMajorAxisUnits = AltUnits.Inches; break; case "Miles": SemiMajorAxisUnits = AltUnits.Miles; break; case "Kilometers": SemiMajorAxisUnits = AltUnits.Kilometers; break; case "AstronomicalUnits": SemiMajorAxisUnits = AltUnits.AstronomicalUnits; break; case "LightYears": SemiMajorAxisUnits = AltUnits.LightYears; break; case "Parsecs": SemiMajorAxisUnits = AltUnits.Parsecs; break; case "MegaParsecs": SemiMajorAxisUnits = AltUnits.MegaParsecs; break; case "Custom": SemiMajorAxisUnits = AltUnits.Custom; break; default: break; } Eccentricity = Double.Parse(node.Attributes.GetNamedItem("Eccentricity").Value); Inclination = Double.Parse(node.Attributes.GetNamedItem("Inclination").Value); ArgumentOfPeriapsis = Double.Parse(node.Attributes.GetNamedItem("ArgumentOfPeriapsis").Value); LongitudeOfAscendingNode = Double.Parse(node.Attributes.GetNamedItem("LongitudeOfAscendingNode").Value); MeanAnomolyAtEpoch = Double.Parse(node.Attributes.GetNamedItem("MeanAnomolyAtEpoch").Value); MeanDailyMotion = Double.Parse(node.Attributes.GetNamedItem("MeanDailyMotion").Value); Epoch = Double.Parse(node.Attributes.GetNamedItem("Epoch").Value); } }
public LayerMap(string name, ReferenceFrames reference) { Name = name; Frame.Reference = reference; double radius = 6371000; switch (reference) { case ReferenceFrames.Sky: break; case ReferenceFrames.Ecliptic: break; case ReferenceFrames.Galactic: break; case ReferenceFrames.Sun: radius = 696000000; break; case ReferenceFrames.Mercury: radius = 2439700; break; case ReferenceFrames.Venus: radius = 6051800; break; case ReferenceFrames.Earth: radius = 6371000; break; case ReferenceFrames.Mars: radius = 3390000; break; case ReferenceFrames.Jupiter: radius = 69911000; break; case ReferenceFrames.Saturn: radius = 58232000; break; case ReferenceFrames.Uranus: radius = 25362000; break; case ReferenceFrames.Neptune: radius = 24622000; break; case ReferenceFrames.Pluto: radius = 1161000; break; case ReferenceFrames.Moon: radius = 1737100; break; case ReferenceFrames.Io: radius = 1821500; break; case ReferenceFrames.Europa: radius = 1561000; break; case ReferenceFrames.Ganymede: radius = 2631200; break; case ReferenceFrames.Callisto: radius = 2410300; break; case ReferenceFrames.Custom: break; case ReferenceFrames.Identity: break; default: break; } Frame.MeanRadius = radius; }
//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 InitializeFromXml(XmlNode node) { Name = node.Attributes.GetNamedItem("Name").Value; Parent = node.Attributes.GetNamedItem("Parent").Value; switch (node.Attributes.GetNamedItem("ReferenceFrameType").Value) { case "FixedSherical": ReferenceFrameType = ReferenceFrameTypes.FixedSherical; break; case "Orbital": ReferenceFrameType = ReferenceFrameTypes.Orbital; break; case "Trajectory": ReferenceFrameType = ReferenceFrameTypes.Trajectory; break; default: break; } switch (node.Attributes.GetNamedItem("Reference").Value) { case "Sky": Reference = ReferenceFrames.Sky; break; case "Ecliptic": Reference = ReferenceFrames.Ecliptic; break; case "Galactic": Reference = ReferenceFrames.Galactic; break; case "Sun": Reference = ReferenceFrames.Sun; break; case "Mercury": Reference = ReferenceFrames.Mercury; break; case "Venus": Reference = ReferenceFrames.Venus; break; case "Earth": Reference = ReferenceFrames.Earth; break; case "Mars": Reference = ReferenceFrames.Mars; break; case "Jupiter": Reference = ReferenceFrames.Jupiter; break; case "Saturn": Reference = ReferenceFrames.Saturn; break; case "Uranus": Reference = ReferenceFrames.Uranus; break; case "Neptune": Reference = ReferenceFrames.Neptune; break; case "Pluto": Reference = ReferenceFrames.Pluto; break; case "Moon": Reference = ReferenceFrames.Moon; break; case "Io": Reference = ReferenceFrames.Io; break; case "Europa": Reference = ReferenceFrames.Europa; break; case "Ganymede": Reference = ReferenceFrames.Ganymede; break; case "Callisto": Reference = ReferenceFrames.Callisto; break; case "Custom": Reference = ReferenceFrames.Custom; break; case "Identity": Reference = ReferenceFrames.Identity; break; default: break; } ParentsRoationalBase = Boolean.Parse(node.Attributes.GetNamedItem("ParentsRoationalBase").Value); MeanRadius = Double.Parse(node.Attributes.GetNamedItem("MeanRadius").Value); Oblateness = Double.Parse(node.Attributes.GetNamedItem("Oblateness").Value); Heading = Double.Parse(node.Attributes.GetNamedItem("Heading").Value); Pitch = Double.Parse(node.Attributes.GetNamedItem("Pitch").Value); Roll = Double.Parse(node.Attributes.GetNamedItem("Roll").Value); Scale = Double.Parse(node.Attributes.GetNamedItem("Scale").Value); Tilt = Double.Parse(node.Attributes.GetNamedItem("Tilt").Value); Translation = Vector3d.Parse(node.Attributes.GetNamedItem("Translation").Value); if (ReferenceFrameType == ReferenceFrameTypes.FixedSherical) { Lat = Double.Parse(node.Attributes.GetNamedItem("Lat").Value); Lng = Double.Parse(node.Attributes.GetNamedItem("Lng").Value); Altitude = Double.Parse(node.Attributes.GetNamedItem("Altitude").Value); } RotationalPeriod = Double.Parse(node.Attributes.GetNamedItem("RotationalPeriod").Value); ZeroRotationDate = Double.Parse(node.Attributes.GetNamedItem("ZeroRotationDate").Value); RepresentativeColor = Color.Load(node.Attributes.GetNamedItem("RepresentativeColor").Value); ShowAsPoint = Boolean.Parse(node.Attributes.GetNamedItem("ShowAsPoint").Value); if (node.Attributes.GetNamedItem("StationKeeping")!= null) { StationKeeping = Boolean.Parse(node.Attributes.GetNamedItem("StationKeeping").Value); } if (ReferenceFrameType == ReferenceFrameTypes.Orbital) { ShowOrbitPath = Boolean.Parse(node.Attributes.GetNamedItem("ShowOrbitPath").Value); SemiMajorAxis = Double.Parse(node.Attributes.GetNamedItem("SemiMajorAxis").Value); switch (node.Attributes.GetNamedItem("SemiMajorAxisScale").Value) { case "Meters": SemiMajorAxisUnits = AltUnits.Meters; break; case "Feet": SemiMajorAxisUnits = AltUnits.Feet; break; case "Inches": SemiMajorAxisUnits = AltUnits.Inches; break; case "Miles": SemiMajorAxisUnits = AltUnits.Miles; break; case "Kilometers": SemiMajorAxisUnits = AltUnits.Kilometers; break; case "AstronomicalUnits": SemiMajorAxisUnits = AltUnits.AstronomicalUnits; break; case "LightYears": SemiMajorAxisUnits = AltUnits.LightYears; break; case "Parsecs": SemiMajorAxisUnits = AltUnits.Parsecs; break; case "MegaParsecs": SemiMajorAxisUnits = AltUnits.MegaParsecs; break; case "Custom": SemiMajorAxisUnits = AltUnits.Custom; break; default: break; } Eccentricity = Double.Parse(node.Attributes.GetNamedItem("Eccentricity").Value); Inclination = Double.Parse(node.Attributes.GetNamedItem("Inclination").Value); ArgumentOfPeriapsis = Double.Parse(node.Attributes.GetNamedItem("ArgumentOfPeriapsis").Value); LongitudeOfAscendingNode = Double.Parse(node.Attributes.GetNamedItem("LongitudeOfAscendingNode").Value); MeanAnomolyAtEpoch = Double.Parse(node.Attributes.GetNamedItem("MeanAnomolyAtEpoch").Value); MeanDailyMotion = Double.Parse(node.Attributes.GetNamedItem("MeanDailyMotion").Value); Epoch = Double.Parse(node.Attributes.GetNamedItem("Epoch").Value); } }