public ImageSetHelper(ImageSetType dataSetType, BandPass bandPass) { generic = true; this.name = "Generic"; this.sparse = false; this.dataSetType = dataSetType; this.bandPass = bandPass; this.quadTreeTileMap = ""; this.url = ""; this.levels = 0; this.baseTileDegrees = 0; this.imageSetID = 0; this.extension = ""; this.projection = ProjectionType.Equirectangular; this.bottomsUp = false; this.baseLevel = 0; this.mercator = (projection == ProjectionType.Mercator); this.centerX = 0; this.centerY = 0; this.rotation = 0; //todo add scale this.thumbnailUrl = ""; matrix = Matrix3d.Identity; matrix.Multiply(Matrix3d.RotationX((((Rotation)) / 180f * Math.PI))); matrix.Multiply(Matrix3d.RotationZ(((CenterY) / 180f * Math.PI))); matrix.Multiply(Matrix3d.RotationY((((360 - CenterX) + 180) / 180f * Math.PI))); Earth3d.AddImageSetToTable(this.GetHash(), this); }
public void SetInitialParameters(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame) { this.ReferenceFrame = referenceFrame; this.MeanRadius = meanRadius; this.altUrl = alturl; this.demUrl = demUrlIn; this.creditsText = credits; this.creditsUrl = creditsUrl; this.offsetY = offsetY; this.offsetX = offsetX; this.widthFactor = wf; this.elevationModel = elevationModel; this.defaultSet = defaultSet; this.name = name; this.sparse = sparse; this.dataSetType = dataSetType; this.bandPass = bandPass; this.quadTreeTileMap = quadTreeMap; this.url = url; this.levels = levels; this.baseTileDegrees = baseTileDegrees; this.imageSetID = imageSetID; this.extension = extension; this.projection = projection; this.bottomsUp = bottomsUp; this.baseLevel = baseLevel; this.mercator = (projection == ProjectionType.Mercator); this.centerX = centerX; this.centerY = centerY; this.rotation = rotation; this.thumbnailUrl = thumbnailUrl; this.ComputeMatrix(); }
public static Imageset CreateGeneric(ImageSetType dataSetType, BandPass bandPass) { Imageset temp = new Imageset(); temp.generic = true; temp.name = "Generic"; temp.sparse = false; temp.dataSetType = dataSetType; temp.bandPass = bandPass; temp.quadTreeTileMap = ""; temp.url = ""; temp.levels = 0; temp.baseTileDegrees = 0; temp.imageSetID = 0; temp.extension = ""; temp.projection = ProjectionType.Equirectangular; temp.bottomsUp = false; temp.baseLevel = 0; temp.mercator = (temp.projection == ProjectionType.Mercator); temp.centerX = 0; temp.centerY = 0; temp.rotation = 0; //todo add scale temp.thumbnailUrl = ""; temp.matrix = Matrix3d.Identity; temp.matrix.Multiply(Matrix3d.RotationX((((temp.Rotation)) / 180f * Math.PI))); temp.matrix.Multiply(Matrix3d.RotationZ(((temp.CenterY) / 180f * Math.PI))); temp.matrix.Multiply(Matrix3d.RotationY((((360 - temp.CenterX) + 180) / 180f * Math.PI))); return(temp); }
public ImageSetHelper(ImageSetType dataSetType, BandPass bandPass) { generic = true; name = "Generic"; sparse = false; this.dataSetType = dataSetType; this.bandPass = bandPass; quadTreeTileMap = ""; url = ""; levels = 0; baseTileDegrees = 0; imageSetID = 0; extension = ""; projection = ProjectionType.Equirectangular; bottomsUp = false; baseLevel = 0; mercator = (projection == ProjectionType.Mercator); centerX = 0; centerY = 0; rotation = 0; //todo add scale thumbnailUrl = ""; matrix = Matrix3d.Identity; matrix.Multiply(Matrix3d.RotationX((((Rotation)) / 180f * Math.PI))); matrix.Multiply(Matrix3d.RotationZ(((CenterY) / 180f * Math.PI))); matrix.Multiply(Matrix3d.RotationY((((360 - CenterX) + 180) / 180f * Math.PI))); Earth3d.AddImageSetToTable(GetHash(), this); }
public static Imageset Create(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame) { Imageset temp = new Imageset(); temp.SetInitialParameters(name, url, dataSetType, bandPass, projection, imageSetID, baseLevel, levels, baseTileDegrees, extension, bottomsUp, quadTreeMap, centerX, centerY, rotation, sparse, thumbnailUrl, defaultSet, elevationModel, wf, offsetX, offsetY, credits, creditsUrl, demUrlIn, alturl, meanRadius, referenceFrame); return(temp); }
public TourPlace(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { this.constellation = constellation; this.name = name; Classification = classification; this.camParams = camParams; Type = type; Target = target; }
public TourPlace(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { this.constellation = constellation; this.name = name; Classification = classification; this.camParams = camParams; Type = type; Target = target; }
private void SetLookAtTargetLocal(ImageSetType lookAt) { int index = 0; foreach (string name in viewTarget.Items) { if (name == lookAt.ToString()) { viewTarget.SelectedIndex = index; break; } index++; } index = 0; }
public TourPlace(string name, double lat, double lng, Classification classification, string constellation, ImageSetType type, double zoomFactor) { ZoomLevel = zoomFactor; this.constellation = constellation; this.name = name; if (type == ImageSetType.Sky || type == ImageSetType.SolarSystem) { camParams.RA = lng; } else { Lng = lng; } Lat = lat; Classification = classification; Type = type; }
public TourPlace(string name, double lat, double lng, Classification classification, string constellation, ImageSetType type, double zoomFactor) { ZoomLevel = zoomFactor; this.constellation = constellation; this.name = name; if (type == ImageSetType.Sky || type == ImageSetType.SolarSystem) { camParams.RA = lng; } else { Lng = lng; } Lat = lat; Classification = classification; Type = type; }
private void LoadImageSetList() { if (viewTarget.SelectedItem == null) { return; } ImageSetType target = (ImageSetType)Enum.Parse(typeof(ImageSetType), viewTarget.SelectedItem.ToString()); ImageDataSetsCombo.Items.Clear(); foreach (IImageSet set in Earth3d.ImageSets) { if (set.DataSetType == target) { ImageDataSetsCombo.Items.Add(set); } } ImageDataSetsCombo.SelectedIndex = 0; if (target != ImageSetType.SolarSystem) { ImageDataSetsCombo.Items.Add(Language.GetLocalizedText(130, "Browse...")); } }
internal void SetLookAtTarget(ImageSetType lookAt) { MethodInvoker doIt = delegate { SetLookAtTargetLocal(lookAt); }; if (this.InvokeRequired) { try { this.Invoke(doIt); } catch { } } else { doIt(); } }
public static Imageset Create(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame) { Imageset temp = new Imageset(); temp.ReferenceFrame = referenceFrame; temp.MeanRadius = meanRadius; temp.altUrl = alturl; temp.demUrl = demUrlIn; temp.creditsText = credits; temp.creditsUrl = creditsUrl; temp.offsetY = offsetY; temp.offsetX = offsetX; temp.widthFactor = wf; temp.elevationModel = elevationModel; temp.defaultSet = defaultSet; temp.name = name; temp.sparse = sparse; temp.dataSetType = dataSetType; temp.bandPass = bandPass; temp.quadTreeTileMap = quadTreeMap; temp.url = url; temp.levels = levels; temp.baseTileDegrees = baseTileDegrees; temp.imageSetID = imageSetID; temp.extension = extension; temp.projection = projection; temp.bottomsUp = bottomsUp; temp.baseLevel = baseLevel; temp.mercator = (projection == ProjectionType.Mercator); temp.centerX = centerX; temp.centerY = centerY; temp.rotation = rotation; temp.thumbnailUrl = thumbnailUrl; temp.ComputeMatrix(); return(temp); }
//public Place(string name, double lat, double lng) //{ // this.name = name; // Lat = lat; // Lng = lng; // Type = DataSetType.Geo; // ZoomLevel = -1; //} public static Place create(string name, double lat, double lng, Classification classification, string constellation, ImageSetType type, double zoomFactor) { Place temp = new Place(); temp.ZoomLevel = zoomFactor; temp.constellation = constellation; temp.name = name; if (type == ImageSetType.Sky || type == ImageSetType.SolarSystem) { temp.camParams.RA = lng; } else { temp.Lng = lng; } temp.Lat = lat; temp.Classification = classification; temp.Type = type; return temp; }
public TourPlace(string input, bool sky) { string[] sa = input.Split('\t'); if (sky) { name = sa[0]; Lat = Convert.ToDouble(sa[3]); if (sky) { camParams.RA = Convert.ToDouble(sa[2])/15; Type = ImageSetType.Sky; } else { Lng = 180 - ((Convert.ToDouble(sa[2]) / 24.0 * 360) - 180); Type = ImageSetType.Earth; } string type = sa[1]; type = type.Replace(" ", ""); type = type.Replace("StarCluster", "Cluster"); type = type.Replace("TripleStar", "MultipleStars"); type = type.Replace("HubbleImage", "Unidentified"); Classification = (Classification)Enum.Parse(typeof(Classification), type); if (sa.Length > 4) { try { if (sa[4].ToUpper() != "NULL" && sa[4] != "") { magnitude = Convert.ToDouble(sa[4]); } } catch { } } if (sa.Length > 5) { constellation = sa[5].ToUpper(); } if (sa.Length > 6) { try { ZoomLevel = Convert.ToDouble(sa[6]); } catch { } } if (sa.Length > 7) { try { distnace = Convert.ToDouble(sa[7]); } catch { } } } else { name = sa[0]; Lat = (float)Convert.ToDouble(sa[1]); Lng = (float)Convert.ToDouble(sa[2]); Type = ImageSetType.Earth; if (sa.Length > 3) { elevation = Convert.ToDouble(sa[3]); } } }
public static Imageset FromXMLNode(XmlNode node) { try { ImageSetType type = ImageSetType.Sky; ProjectionType projection = ProjectionType.Tangent; if (node.Attributes.GetNamedItem("DataSetType") != null) { switch (node.Attributes.GetNamedItem("DataSetType").Value.ToLowerCase()) { case "earth": type = ImageSetType.Earth; break; case "planet": type = ImageSetType.Planet; break; case "sky": type = ImageSetType.Sky; break; case "panorama": type = ImageSetType.Panorama; break; case "solarsystem": type = ImageSetType.SolarSystem; break; } } BandPass bandPass = BandPass.Visible; switch (node.Attributes.GetNamedItem("BandPass").Value) { case "Gamma": bandPass = BandPass.Gamma; break; case "XRay": bandPass = BandPass.XRay; break; case "Ultraviolet": bandPass = BandPass.Ultraviolet; break; case "Visible": bandPass = BandPass.Visible; break; case "HydrogenAlpha": bandPass = BandPass.HydrogenAlpha; break; case "IR": bandPass = BandPass.IR; break; case "Microwave": bandPass = BandPass.Microwave; break; case "Radio": bandPass = BandPass.Radio; break; case "VisibleNight": bandPass = BandPass.VisibleNight; break; default: break; } int wf = 1; if (node.Attributes.GetNamedItem("WidthFactor") != null) { wf = int.Parse(node.Attributes.GetNamedItem("WidthFactor").Value); } if (node.Attributes.GetNamedItem("Generic") == null || !bool.Parse(node.Attributes.GetNamedItem("Generic").Value.ToString())) { switch (node.Attributes.GetNamedItem("Projection").Value.ToString().ToLowerCase()) { case "tan": case "tangent": projection = ProjectionType.Tangent; break; case "mercator": projection = ProjectionType.Mercator; break; case "equirectangular": projection = ProjectionType.Equirectangular; break; case "toast": projection = ProjectionType.Toast; break; case "spherical": projection = ProjectionType.Spherical; break; case "plotted": projection = ProjectionType.Plotted; break; case "skyimage": projection = ProjectionType.SkyImage; break; } string fileType = node.Attributes.GetNamedItem("FileType").Value.ToString(); if (!fileType.StartsWith(".")) { fileType = "." + fileType; } string thumbnailUrl = ""; XmlNode thumbUrl = Util.SelectSingleNode(node, "ThumbnailUrl"); if (thumbUrl != null) { if (string.IsNullOrEmpty(thumbUrl.InnerText)) { ChromeNode cn = (ChromeNode)(object)thumbUrl; thumbnailUrl = cn.TextContent; } else { thumbnailUrl = thumbUrl.InnerText; } } bool stockSet = false; bool elevationModel = false; if (node.Attributes.GetNamedItem("StockSet") != null) { stockSet = bool.Parse(node.Attributes.GetNamedItem("StockSet").Value.ToString()); } if (node.Attributes.GetNamedItem("ElevationModel") != null) { elevationModel = bool.Parse(node.Attributes.GetNamedItem("ElevationModel").Value.ToString()); } string demUrl = ""; if (node.Attributes.GetNamedItem("DemUrl") != null) { demUrl = node.Attributes.GetNamedItem("DemUrl").Value.ToString(); } string alturl = ""; if (node.Attributes.GetNamedItem("AltUrl") != null) { alturl = node.Attributes.GetNamedItem("AltUrl").Value.ToString(); } double offsetX = 0; if (node.Attributes.GetNamedItem("OffsetX") != null) { offsetX = double.Parse(node.Attributes.GetNamedItem("OffsetX").Value.ToString()); } double offsetY = 0; if (node.Attributes.GetNamedItem("OffsetY") != null) { offsetY = double.Parse(node.Attributes.GetNamedItem("OffsetY").Value.ToString()); } string creditText = ""; XmlNode credits = Util.SelectSingleNode(node, "Credits"); if (credits != null) { creditText = Util.GetInnerText(credits); } string creditsUrl = ""; credits = Util.SelectSingleNode(node, "CreditsUrl"); if (credits != null) { creditsUrl = Util.GetInnerText(credits); } double meanRadius = 0; if (node.Attributes.GetNamedItem("MeanRadius") != null) { meanRadius = double.Parse(node.Attributes.GetNamedItem("MeanRadius").Value.ToString()); } string referenceFrame = null; if (node.Attributes.GetNamedItem("ReferenceFrame") != null) { referenceFrame = node.Attributes.GetNamedItem("ReferenceFrame").Value; } string name = ""; if (node.Attributes.GetNamedItem("Name") != null) { name = node.Attributes.GetNamedItem("Name").Value.ToString(); } string url = ""; if (node.Attributes.GetNamedItem("Url") != null) { url = node.Attributes.GetNamedItem("Url").Value.ToString(); } int baseTileLevel = 0; if (node.Attributes.GetNamedItem("BaseTileLevel") != null) { baseTileLevel = int.Parse(node.Attributes.GetNamedItem("BaseTileLevel").Value.ToString()); } int tileLevels = 0; if (node.Attributes.GetNamedItem("TileLevels") != null) { tileLevels = int.Parse(node.Attributes.GetNamedItem("TileLevels").Value.ToString()); } double baseDegreesPerTile = 0; if (node.Attributes.GetNamedItem("BaseDegreesPerTile") != null) { baseDegreesPerTile = double.Parse(node.Attributes.GetNamedItem("BaseDegreesPerTile").Value.ToString()); } bool bottomsUp = false; if (node.Attributes.GetNamedItem("BottomsUp") != null) { bottomsUp = bool.Parse(node.Attributes.GetNamedItem("BottomsUp").Value.ToString()); } string quadTreeMap = ""; if (node.Attributes.GetNamedItem("QuadTreeMap") != null) { quadTreeMap = node.Attributes.GetNamedItem("QuadTreeMap").Value.ToString(); } double centerX = 0; if (node.Attributes.GetNamedItem("CenterX") != null) { centerX = double.Parse(node.Attributes.GetNamedItem("CenterX").Value.ToString()); } double centerY = 0; if (node.Attributes.GetNamedItem("CenterY") != null) { centerY = double.Parse(node.Attributes.GetNamedItem("CenterY").Value.ToString()); } double rotation = 0; if (node.Attributes.GetNamedItem("Rotation") != null) { rotation = double.Parse(node.Attributes.GetNamedItem("Rotation").Value.ToString()); } bool sparse = false; if (node.Attributes.GetNamedItem("Sparse") != null) { sparse = bool.Parse(node.Attributes.GetNamedItem("Sparse").Value.ToString()); } return(Imageset.Create(name, url, type, bandPass, projection, Math.Abs(Util.GetHashCode(url)), baseTileLevel, tileLevels, 256, baseDegreesPerTile, fileType, bottomsUp, quadTreeMap, centerX, centerY, rotation, sparse, thumbnailUrl, stockSet, elevationModel, wf, offsetX, offsetY, creditText, creditsUrl, demUrl, alturl, meanRadius, referenceFrame)); } else { return(Imageset.CreateGeneric(type, bandPass)); } } catch { return(null); } }
internal void SetLookAtTarget(ImageSetType lookAt) { MethodInvoker doIt = delegate { SetLookAtTargetLocal(lookAt); }; if (InvokeRequired) { try { Invoke(doIt); } catch { } } else { doIt(); } }
private void SetLookAtTargetLocal(ImageSetType lookAt) { var index = 0; foreach (string name in viewTarget.Items) { if (name == lookAt.ToString()) { viewTarget.SelectedIndex = index; break; } index++; } index = 0; }
public TourPlace(string input, bool sky) { string[] sa = input.Split('\t'); if (sky) { name = sa[0]; Lat = Convert.ToDouble(sa[3]); if (sky) { camParams.RA = Convert.ToDouble(sa[2]) / 15; Type = ImageSetType.Sky; } else { Lng = 180 - ((Convert.ToDouble(sa[2]) / 24.0 * 360) - 180); Type = ImageSetType.Earth; } string type = sa[1]; type = type.Replace(" ", ""); type = type.Replace("StarCluster", "Cluster"); type = type.Replace("TripleStar", "MultipleStars"); type = type.Replace("HubbleImage", "Unidentified"); Classification = (Classification)Enum.Parse(typeof(Classification), type); if (sa.Length > 4) { try { if (sa[4].ToUpper() != "NULL" && sa[4] != "") { magnitude = Convert.ToDouble(sa[4]); } } catch { } } if (sa.Length > 5) { constellation = sa[5].ToUpper(); } if (sa.Length > 6) { try { ZoomLevel = Convert.ToDouble(sa[6]); } catch { } } if (sa.Length > 7) { try { distnace = Convert.ToDouble(sa[7]); } catch { } } } else { name = sa[0]; Lat = (float)Convert.ToDouble(sa[1]); Lng = (float)Convert.ToDouble(sa[2]); Type = ImageSetType.Earth; if (sa.Length > 3) { elevation = Convert.ToDouble(sa[3]); } } }
public void Render() { if (RenderContext.BackgroundImageset != null) { RenderType = RenderContext.BackgroundImageset.DataSetType; } else { RenderType = ImageSetType.Sky; } //Date date = Date.Now; //int hour = date.GetHours(); //Date date2 = new Date(Date.UTC(0,0,0,0,0,0,date.GetTime())); //int hour1 = date.GetHours(); //int hour3 = date.GetUTCHours(); bool sizeChange = false; if (Canvas.Width != int.Parse(Canvas.ParentNode.Style.Width)) { Canvas.Width = int.Parse(Canvas.ParentNode.Style.Width); sizeChange = true; } if (Canvas.Height != int.Parse(Canvas.ParentNode.Style.Height)) { Canvas.Height = int.Parse(Canvas.ParentNode.Style.Height); sizeChange = true; } if (sizeChange) { if (Explorer != null) { Explorer.Refresh(); } } Tile.lastDeepestLevel = Tile.deepestLevel; RenderTriangle.Width = RenderContext.Width = Canvas.Width; RenderTriangle.Height = RenderContext.Height = Canvas.Height; Tile.TilesInView = 0; Tile.TilesTouched = 0; Tile.deepestLevel = 0; if (Mover != null) { SpaceTimeController.Now = Mover.CurrentDateTime; Planets.UpdatePlanetLocations(SolarSystemMode); if (Mover != null) { CameraParameters newCam = Mover.CurrentPosition; RenderContext.TargetCamera = newCam.Copy(); RenderContext.ViewCamera = newCam.Copy(); if (RenderContext.Space && Settings.Active.GalacticMode) { double[] gPoint = Coordinates.J2000toGalactic(newCam.RA * 15, newCam.Dec); RenderContext.targetAlt = RenderContext.alt = gPoint[1]; RenderContext.targetAz = RenderContext.az = gPoint[0]; } else if (RenderContext.Space && Settings.Active.LocalHorizonMode) { Coordinates currentAltAz = Coordinates.EquitorialToHorizon(Coordinates.FromRaDec(newCam.RA, newCam.Dec), SpaceTimeController.Location, SpaceTimeController.Now); RenderContext.targetAlt = RenderContext.alt = currentAltAz.Alt; RenderContext.targetAz = RenderContext.az = currentAltAz.Az; } if (Mover.Complete) { //Todo Notify interested parties that move is complete scriptInterface.FireArrived(Mover.CurrentPosition.RA, Mover.CurrentPosition.Dec, WWTControl.Singleton.RenderContext.ViewCamera.Zoom); Mover = null; NotifyMoveComplete(); } } } else { SpaceTimeController.UpdateClock(); Planets.UpdatePlanetLocations(SolarSystemMode); UpdateViewParameters(); } RenderContext.Clear(); //if (RenderContext.gl != null) //{ // Window.SetTimeout(delegate() { Render(); }, 0); // return; //} if (RenderType == ImageSetType.SolarSystem) { { if ((int)SolarSystemTrack < (int)SolarSystemObjects.Custom) { double radius = Planets.GetAdjustedPlanetRadius((int)SolarSystemTrack); double distance = RenderContext.SolarSystemCameraDistance; double camAngle = RenderContext.FovLocal; //double distrad = distance / (radius * Math.Tan(.5 * camAngle)); } if (trackingObject == null) { //todo fix this trackingObject = Search.FindCatalogObject("Sun"); } RenderContext.SetupMatricesSolarSystem(true); //float skyOpacity = 1.0f - Planets.CalculateSkyBrightnessFactor(RenderContext11.View, viewCamera.ViewTarget); //if (float.IsNaN(skyOpacity)) //{ // skyOpacity = 0f; //} double zoom = RenderContext.ViewCamera.Zoom; float milkyWayBlend = (float)Math.Min(1.0, Math.Max(0, (Math.Log(zoom) - 8.4)) / 4.2); float milkyWayBlendIn = (float)Math.Min(1.0, Math.Max(0, (Math.Log(zoom) - 17.9)) / 2.3); Matrix3d matOldMW = RenderContext.World; Matrix3d matLocalMW = RenderContext.World.Clone(); matLocalMW.Multiply(Matrix3d.Scaling(100000, 100000, 100000)); matLocalMW.Multiply(Matrix3d.RotationX(23.5 / 180 * Math.PI)); // matLocalMW.Multiply(Matrix3d.RotationY(Math.PI)); matLocalMW.Multiply(Matrix3d.Translation(RenderContext.CameraPosition)); //todo change this when tracking is added back RenderContext.World = matLocalMW; RenderContext.WorldBase = matLocalMW; RenderContext.Space = true; RenderContext.MakeFrustum(); bool lighting = RenderContext.Lighting; RenderContext.Lighting = false; if (Settings.Active.SolarSystemMilkyWay) { if (milkyWayBlend < 1) // Solar System mode Milky Way background { if (milkyWayBackground == null) { milkyWayBackground = GetImagesetByName("Digitized Sky Survey (Color)"); } if (milkyWayBackground != null) { RenderTriangle.CullInside = true; float c = ((1 - milkyWayBlend)) / 2; RenderContext.DrawImageSet( milkyWayBackground, 100 ); RenderTriangle.CullInside = false; } } } DrawSkyOverlays(); RenderContext.Lighting = lighting; RenderContext.Space = false; RenderContext.World = matOldMW; RenderContext.WorldBase = matOldMW; RenderContext.MakeFrustum(); //// CMB //float cmbBlend = (float)Math.Min(1, Math.Max(0, (Math.Log(zoom) - 33)) / 2.3); //double cmbLog = Math.Log(zoom); //if (Properties.Settings.Default.SolarSystemCMB.State) //{ // if (cmbBlend > 0) // Solar System mode Milky Way background // { // if (cmbBackground == null) // { // cmbBackground = GetImagesetByName("Planck CMB"); // } // if (cmbBackground != null) // { // float c = ((cmbBlend)) / 16; // Matrix3d matOldMW = RenderContext11.World; // Matrix3d matLocalMW = RenderContext11.World; // //double dist = UiTools.AuPerLightYear*46000000000; // matLocalMW.Multiply(Matrix3d.Scaling(2.9090248982E+15, 2.9090248982E+15, 2.9090248982E+15)); // matLocalMW.Multiply(Matrix3d.RotationX(-23.5 / 180 * Math.PI)); // matLocalMW.Multiply(Matrix3d.RotationY(Math.PI)); // // matLocalMW.Multiply(Matrix3d.Translation(cameraOffset)); // RenderContext11.World = matLocalMW; // RenderContext11.WorldBase = matLocalMW; // Earth3d.MainWindow.MakeFrustum(); // RenderContext11.SetupBasicEffect(BasicEffect.TextureColorOpacity, 1, Color.White); // //SetupMatricesSpace11(60, renderType); // RenderContext11.DepthStencilMode = DepthStencilMode.Off; // DrawTiledSphere(cmbBackground, c * Properties.Settings.Default.SolarSystemCMB.Opacity, Color.FromArgb(255, 255, 255, 255)); // RenderContext11.World = matOldMW; // RenderContext11.WorldBase = matOldMW; // RenderContext11.DepthStencilMode = DepthStencilMode.ZReadWrite; // } // } //} //{ // Matrix3d matOld = RenderContext11.World; // Matrix3d matLocal = RenderContext11.World; // matLocal.Multiply(Matrix3d.Translation(viewCamera.ViewTarget)); // RenderContext11.World = matLocal; // Earth3d.MainWindow.MakeFrustum(); // if (Properties.Settings.Default.SolarSystemCosmos.State) // { // RenderContext11.DepthStencilMode = DepthStencilMode.Off; // Grids.DrawCosmos3D(RenderContext11, Properties.Settings.Default.SolarSystemCosmos.Opacity * skyOpacity); // RenderContext11.DepthStencilMode = DepthStencilMode.ZReadWrite; // } // if (true) // { // RenderContext11.DepthStencilMode = DepthStencilMode.Off; // Grids.DrawCustomCosmos3D(RenderContext11, skyOpacity); // RenderContext11.DepthStencilMode = DepthStencilMode.ZReadWrite; // } // if (Properties.Settings.Default.SolarSystemMilkyWay.State && milkyWayBlendIn > 0) // { // Grids.DrawGalaxy3D(RenderContext11, Properties.Settings.Default.SolarSystemMilkyWay.Opacity * skyOpacity * milkyWayBlendIn); // } // if (Properties.Settings.Default.SolarSystemStars.State) // { // Grids.DrawStars3D(RenderContext11, Properties.Settings.Default.SolarSystemStars.Opacity * skyOpacity); // } // matLocal = matOld; // matLocal.Multiply(Matrix3d.Translation(-viewCamera.ViewTarget)); // RenderContext11.World = matLocal; // Earth3d.MainWindow.MakeFrustum(); // LayerManager.Draw(RenderContext11, 1.0f, true, "Sky", true, false); // RenderContext11.World = matOld; // Earth3d.MainWindow.MakeFrustum(); //} if (RenderContext.SolarSystemCameraDistance < 15000) { RenderContext.SetupMatricesSolarSystem(false); //if (Properties.Settings.Default.SolarSystemMinorPlanets.State)// && !RenderContext11.Downlevel) //{ // MinorPlanets.DrawMPC3D(RenderContext11, Properties.Settings.Default.SolarSystemMinorPlanets.Opacity, viewCamera.ViewTarget); //} Planets.DrawPlanets3D(RenderContext, 1, RenderContext.ViewCamera.ViewTarget); } //double p = Math.Log(zoom); //double d = (180 / SolarSystemCameraDistance) * 100; // (SolarSystemCameraDistance * SolarSystemCameraDistance) * 10000000; //float sunAtDistance = (float)Math.Min(1, Math.Max(0, (Math.Log(zoom) - 7.5)) / 3); //if (sunAtDistance > 0) //{ // Planets.DrawPointPlanet(RenderContext11, new Vector3d(0, 0, 0), (float)d * sunAtDistance, Color.FromArgb(192, 191, 128), false, 1); //} //if ((SolarSystemMode) && label != null && !TourPlayer.Playing) //{ // label.Draw(RenderContext11, true); //} } } else { if (RenderType == ImageSetType.Earth || RenderType == ImageSetType.Planet) { RenderContext.SetupMatricesLand3d(); } else { RenderContext.SetupMatricesSpace3d(RenderContext.Width, RenderContext.Height); } RenderContext.DrawImageSet(RenderContext.BackgroundImageset, 100); if (RenderContext.ForegroundImageset != null) { if (RenderContext.ViewCamera.Opacity != 100 && RenderContext.gl == null) { if (foregroundCanvas.Width != RenderContext.Width || foregroundCanvas.Height != RenderContext.Height) { foregroundCanvas.Width = (int)RenderContext.Width; foregroundCanvas.Height = (int)RenderContext.Height; } CanvasContext2D saveDevice = RenderContext.Device; fgDevice.ClearRect(0, 0, RenderContext.Width, RenderContext.Height); RenderContext.Device = fgDevice; RenderContext.DrawImageSet(RenderContext.ForegroundImageset, 100); RenderContext.Device = saveDevice; RenderContext.Device.Save(); RenderContext.Device.Alpha = RenderContext.ViewCamera.Opacity / 100; RenderContext.Device.DrawImage(foregroundCanvas, 0, 0); RenderContext.Device.Restore(); } else { RenderContext.DrawImageSet(RenderContext.ForegroundImageset, RenderContext.ViewCamera.Opacity); } } if (RenderType == ImageSetType.Sky) { Planets.DrawPlanets(RenderContext, 1); Constellation = Constellations.Containment.FindConstellationForPoint(RenderContext.ViewCamera.RA, RenderContext.ViewCamera.Dec); DrawSkyOverlays(); LayerManager.Draw(RenderContext, 1.0f, true, "Sky", true, true); } if (RenderType == ImageSetType.Earth) { LayerManager.Draw(RenderContext, 1.0f, false, "Earth", false, false); } if (Settings.Current.ShowCrosshairs) { DrawCrosshairs(RenderContext); } if (uiController != null) { uiController.Render(RenderContext); } else { int index = 0; foreach (Annotation item in annotations) { item.Draw(RenderContext); index++; } if ((Date.Now - lastMouseMove) > 400) { Vector2d raDecDown = GetCoordinatesForScreenPoint(hoverTextPoint.X, hoverTextPoint.Y); this.AnnotationHover(raDecDown.X, raDecDown.Y, hoverTextPoint.X, hoverTextPoint.Y); lastMouseMove = new Date(2100, 1, 1); } if (!string.IsNullOrEmpty(hoverText)) { DrawHoverText(RenderContext); } } } //int tilesInView = Tile.TilesInView; //int itlesTouched = Tile.TilesTouched; frameCount++; //TileCache.PurgeLRU(); TileCache.DecimateQueue(); TileCache.ProcessQueue(RenderContext); Tile.CurrentRenderGeneration++; Date now = Date.Now; int ms = now-lastUpdate; if (ms > 1000) { lastUpdate = now; frameCount = 0; RenderTriangle.TrianglesRendered = 0; RenderTriangle.TrianglesCulled = 0; } //TileCache.PurgeLRU(); Script.SetTimeout(delegate() { Render(); }, 20); }
public Imageset GetDefaultImageset(ImageSetType imageSetType, BandPass bandPass) { foreach (Imageset imageset in ImageSets) { if (imageset.DefaultSet && imageset.BandPass == bandPass && imageset.DataSetType == imageSetType) { return imageset; } } foreach (Imageset imageset in ImageSets) { if (imageset.BandPass == bandPass && imageset.DataSetType == imageSetType) { return imageset; } } foreach (Imageset imageset in ImageSets) { if (imageset.DataSetType == imageSetType) { return imageset; } } return ImageSets[0]; }
public static Place CreateCameraParams(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { Place temp = new Place(); temp.constellation = constellation; temp.name = name; temp.Classification = classification; temp.camParams = camParams; temp.Type = type; temp.Target = target; return temp; }
public static Place CreateCameraParams(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { Place temp = new Place(); temp.constellation = constellation; temp.name = name; temp.Classification = classification; temp.camParams = camParams; temp.Type = type; temp.Target = target; return(temp); }
//public Place(string name, double lat, double lng) //{ // this.name = name; // Lat = lat; // Lng = lng; // Type = DataSetType.Geo; // ZoomLevel = -1; //} public static Place Create(string name, double lat, double lng, Classification classification, string constellation, ImageSetType type, double zoomFactor) { Place temp = new Place(); temp.ZoomLevel = zoomFactor; temp.constellation = constellation; temp.name = name; if (type == ImageSetType.Sky || type == ImageSetType.SolarSystem) { temp.camParams.RA = lng; } else { temp.Lng = lng; } temp.Lat = lat; temp.Classification = classification; temp.Type = type; return(temp); }
public ImageSetHelper(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame) { ReferenceFrame = referenceFrame; MeanRadius = meanRadius; altUrl = alturl; demUrl = demUrlIn; creditsText = credits; this.creditsUrl = creditsUrl; this.offsetY = offsetY; this.offsetX = offsetX; widthFactor = wf; this.elevationModel = elevationModel; this.defaultSet = defaultSet; this.name = name; this.sparse = sparse; this.dataSetType = dataSetType; this.bandPass = bandPass; quadTreeTileMap = quadTreeMap; this.url = url; this.levels = levels; this.baseTileDegrees = baseTileDegrees; this.imageSetID = imageSetID; this.extension = extension; this.projection = projection; this.bottomsUp = bottomsUp; this.baseLevel = baseLevel; mercator = (projection == ProjectionType.Mercator); this.centerX = centerX; this.centerY = centerY; this.rotation = rotation; this.thumbnailUrl = thumbnailUrl; ComputeMatrix(); //if (Earth3d.multiMonClient) { Earth3d.AddImageSetToTable(GetHash(), this); } }
public static Imageset FromXMLNode(XmlNode node) { try { ImageSetType type = ImageSetType.Sky; ProjectionType projection = ProjectionType.Tangent; if (node.Attributes.GetNamedItem("DataSetType") != null) { type = (ImageSetType)Enums.Parse("ImageSetType", node.Attributes.GetNamedItem("DataSetType").Value); } BandPass bandPass = BandPass.Visible; bandPass = (BandPass)Enums.Parse("BandPass", node.Attributes.GetNamedItem("BandPass").Value); int wf = 1; if (node.Attributes.GetNamedItem("WidthFactor") != null) { wf = int.Parse(node.Attributes.GetNamedItem("WidthFactor").Value); } if (node.Attributes.GetNamedItem("Generic") == null || !bool.Parse(node.Attributes.GetNamedItem("Generic").Value.ToString())) { projection = (ProjectionType)Enums.Parse("ProjectionType", node.Attributes.GetNamedItem("Projection").Value); string fileType = node.Attributes.GetNamedItem("FileType").Value.ToString(); if (!fileType.StartsWith(".")) { fileType = "." + fileType; } string thumbnailUrl = ""; XmlNode thumbUrl = Util.SelectSingleNode(node, "ThumbnailUrl"); if (thumbUrl != null) { if (string.IsNullOrEmpty(thumbUrl.InnerText)) { ChromeNode cn = (ChromeNode)(object)thumbUrl; thumbnailUrl = cn.TextContent; } else { thumbnailUrl = thumbUrl.InnerText; } } bool stockSet = false; bool elevationModel = false; if (node.Attributes.GetNamedItem("StockSet") != null) { stockSet = bool.Parse(node.Attributes.GetNamedItem("StockSet").Value.ToString()); } if (node.Attributes.GetNamedItem("ElevationModel") != null) { elevationModel = bool.Parse(node.Attributes.GetNamedItem("ElevationModel").Value.ToString()); } string demUrl = ""; if (node.Attributes.GetNamedItem("DemUrl") != null) { demUrl = node.Attributes.GetNamedItem("DemUrl").Value.ToString(); } string alturl = ""; if (node.Attributes.GetNamedItem("AltUrl") != null) { alturl = node.Attributes.GetNamedItem("AltUrl").Value.ToString(); } double offsetX = 0; if (node.Attributes.GetNamedItem("OffsetX") != null) { offsetX = double.Parse(node.Attributes.GetNamedItem("OffsetX").Value.ToString()); } double offsetY = 0; if (node.Attributes.GetNamedItem("OffsetY") != null) { offsetY = double.Parse(node.Attributes.GetNamedItem("OffsetY").Value.ToString()); } string creditText = ""; XmlNode credits = Util.SelectSingleNode(node, "Credits"); if (credits != null) { creditText = Util.GetInnerText(credits); } string creditsUrl = ""; credits = Util.SelectSingleNode(node, "CreditsUrl"); if (credits != null) { creditsUrl = Util.GetInnerText(credits); } double meanRadius = 0; if (node.Attributes.GetNamedItem("MeanRadius") != null) { meanRadius = double.Parse(node.Attributes.GetNamedItem("MeanRadius").Value.ToString()); } string referenceFrame = null; if (node.Attributes.GetNamedItem("ReferenceFrame") != null) { referenceFrame = node.Attributes.GetNamedItem("ReferenceFrame").Value; } string name = ""; if (node.Attributes.GetNamedItem("Name") != null) { name = node.Attributes.GetNamedItem("Name").Value.ToString(); } string url = ""; if (node.Attributes.GetNamedItem("Url") != null) { url = node.Attributes.GetNamedItem("Url").Value.ToString(); } int baseTileLevel = 0; if (node.Attributes.GetNamedItem("BaseTileLevel") != null) { baseTileLevel = int.Parse(node.Attributes.GetNamedItem("BaseTileLevel").Value.ToString()); } int tileLevels = 0; if (node.Attributes.GetNamedItem("TileLevels") != null) { tileLevels = int.Parse(node.Attributes.GetNamedItem("TileLevels").Value.ToString()); } double baseDegreesPerTile = 0; if (node.Attributes.GetNamedItem("BaseDegreesPerTile") != null) { baseDegreesPerTile = double.Parse(node.Attributes.GetNamedItem("BaseDegreesPerTile").Value.ToString()); } bool bottomsUp = false; if (node.Attributes.GetNamedItem("BottomsUp") != null) { bottomsUp = bool.Parse(node.Attributes.GetNamedItem("BottomsUp").Value.ToString()); } string quadTreeMap = ""; if (node.Attributes.GetNamedItem("QuadTreeMap") != null) { quadTreeMap = node.Attributes.GetNamedItem("QuadTreeMap").Value.ToString(); } double centerX = 0; if (node.Attributes.GetNamedItem("CenterX") != null) { centerX = double.Parse(node.Attributes.GetNamedItem("CenterX").Value.ToString()); } double centerY = 0; if (node.Attributes.GetNamedItem("CenterY") != null) { centerY = double.Parse(node.Attributes.GetNamedItem("CenterY").Value.ToString()); } double rotation = 0; if (node.Attributes.GetNamedItem("Rotation") != null) { rotation = double.Parse(node.Attributes.GetNamedItem("Rotation").Value.ToString()); } bool sparse = false; if (node.Attributes.GetNamedItem("Sparse") != null) { sparse = bool.Parse(node.Attributes.GetNamedItem("Sparse").Value.ToString()); } return(Imageset.Create(name, url, type, bandPass, projection, Math.Abs(Util.GetHashCode(url)), baseTileLevel, tileLevels, 256, baseDegreesPerTile, fileType, bottomsUp, quadTreeMap, centerX, centerY, rotation, sparse, thumbnailUrl, stockSet, elevationModel, wf, offsetX, offsetY, creditText, creditsUrl, demUrl, alturl, meanRadius, referenceFrame)); } else { return(Imageset.CreateGeneric(type, bandPass)); } } catch { return(null); } }
public static ImageSetHelper Create(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame) { ImageSetHelper temp = new ImageSetHelper(); temp.ReferenceFrame = referenceFrame; temp.MeanRadius = meanRadius; temp.altUrl = alturl; temp.demUrl = demUrlIn; temp.creditsText = credits; temp.creditsUrl = creditsUrl; temp.offsetY = offsetY; temp.offsetX = offsetX; temp.widthFactor = wf; temp.elevationModel = elevationModel; temp.defaultSet = defaultSet; temp.name = name; temp.sparse = sparse; temp.dataSetType = dataSetType; temp.bandPass = bandPass; temp.quadTreeTileMap = quadTreeMap; temp.url = url; temp.levels = levels; temp.baseTileDegrees = baseTileDegrees; temp.imageSetID = imageSetID; temp.extension = extension; temp.projection = projection; temp.bottomsUp = bottomsUp; temp.baseLevel = baseLevel; temp.mercator = (projection == ProjectionType.Mercator); temp.centerX = centerX; temp.centerY = centerY; temp.rotation = rotation; temp.thumbnailUrl = thumbnailUrl; temp.ComputeMatrix(); return temp; }
public static ImageSetHelper CreateGeneric(ImageSetType dataSetType, BandPass bandPass) { ImageSetHelper temp = new ImageSetHelper(); temp.generic = true; temp.name = "Generic"; temp.sparse = false; temp.dataSetType = dataSetType; temp.bandPass = bandPass; temp.quadTreeTileMap = ""; temp.url = ""; temp.levels = 0; temp.baseTileDegrees = 0; temp.imageSetID = 0; temp.extension = ""; temp.projection = ProjectionType.Equirectangular; temp.bottomsUp = false; temp.baseLevel = 0; temp.mercator = (temp.projection == ProjectionType.Mercator); temp.centerX = 0; temp.centerY = 0; temp.rotation = 0; //todo add scale temp.thumbnailUrl = ""; temp.matrix = Matrix3d.Identity; temp.matrix.Multiply(Matrix3d.RotationX((((temp.Rotation)) / 180f * Math.PI))); temp.matrix.Multiply(Matrix3d.RotationZ(((temp.CenterY) / 180f * Math.PI))); temp.matrix.Multiply(Matrix3d.RotationY((((360 - temp.CenterX) + 180) / 180f * Math.PI))); return temp; }
public static ImageSetHelper FromXMLNode(XmlNode node) { try { ImageSetType type = ImageSetType.Sky; ProjectionType projection = ProjectionType.Tangent; if (node.Attributes["DataSetType"] != null) { type = (ImageSetType)Enum.Parse(typeof(ImageSetType), node.Attributes["DataSetType"].Value.ToString(), true); } BandPass bandPass = BandPass.Visible; if (node.Attributes["BandPass"] != null) { bandPass = (BandPass)Enum.Parse(typeof(BandPass), node.Attributes["BandPass"].Value.ToString()); } int wf = 1; if (node.Attributes["WidthFactor"] != null) { wf = Convert.ToInt32(node.Attributes["WidthFactor"].Value); } if (node.Attributes["Generic"] == null || !Convert.ToBoolean(node.Attributes["Generic"].Value.ToString())) { switch (node.Attributes["Projection"].Value.ToString().ToLower()) { case "tan": case "tangent": projection = ProjectionType.Tangent; break; case "mercator": projection = ProjectionType.Mercator; break; case "equirectangular": projection = ProjectionType.Equirectangular; break; case "toast": projection = ProjectionType.Toast; break; case "spherical": projection = ProjectionType.Spherical; break; case "plotted": projection = ProjectionType.Plotted; break; case "skyimage": projection = ProjectionType.SkyImage; break; } string fileType = node.Attributes["FileType"].Value.ToString(); if (!fileType.StartsWith(".")) { fileType = "." + fileType; } string thumbnailUrl; XmlNode thumbUrl = node["ThumbnailUrl"]; thumbnailUrl = thumbUrl.InnerText; bool stockSet = false; bool elevationModel = false; if (node.Attributes["StockSet"] != null) { stockSet = Convert.ToBoolean(node.Attributes["StockSet"].Value.ToString()); } if (node.Attributes["ElevationModel"] != null) { elevationModel = Convert.ToBoolean(node.Attributes["ElevationModel"].Value.ToString()); } string demUrl = ""; if (node.Attributes["DemUrl"] != null) { demUrl = node.Attributes["DemUrl"].Value.ToString(); } string alturl = ""; if (node.Attributes["AltUrl"] != null) { alturl = node.Attributes["AltUrl"].Value.ToString(); } double offsetX = 0; if (node.Attributes["OffsetX"] != null) { offsetX = Convert.ToDouble(node.Attributes["OffsetX"].Value.ToString()); } double offsetY = 0; if (node.Attributes["OffsetY"] != null) { offsetY = Convert.ToDouble(node.Attributes["OffsetY"].Value.ToString()); } string creditText = ""; XmlNode credits = node["Credits"]; if (credits != null) { creditText = credits.InnerText; } string creditsUrl = ""; credits = node["CreditsUrl"]; if (credits != null) { creditsUrl = credits.InnerText; } double meanRadius = 0; if (node.Attributes["MeanRadius"] != null) { meanRadius = Convert.ToDouble(node.Attributes["MeanRadius"].Value.ToString()); } string referenceFrame = null; if (node.Attributes["ReferenceFrame"] != null) { referenceFrame = node.Attributes["ReferenceFrame"].Value; } return(new ImageSetHelper(node.Attributes["Name"].Value.ToString(), node.Attributes["Url"].Value.ToString(), type, bandPass, projection, Math.Abs(node.Attributes["Url"].Value.GetHashCode32()), Convert.ToInt32(node.Attributes["BaseTileLevel"].Value), Convert.ToInt32(node.Attributes["TileLevels"].Value), 256, Convert.ToDouble(node.Attributes["BaseDegreesPerTile"].Value), fileType, Convert.ToBoolean(node.Attributes["BottomsUp"].Value.ToString()), node.Attributes["QuadTreeMap"].Value.ToString(), Convert.ToDouble(node.Attributes["CenterX"].Value), Convert.ToDouble(node.Attributes["CenterY"].Value), Convert.ToDouble(node.Attributes["Rotation"].Value), Convert.ToBoolean(node.Attributes["Sparse"].Value.ToString()), thumbnailUrl, stockSet, elevationModel, wf, offsetX, offsetY, creditText, creditsUrl, demUrl, alturl, meanRadius, referenceFrame)); } else { return(new ImageSetHelper(type, bandPass)); } } catch { return(null); } }