public static Tile GetCachedTile(int level, int x, int y, IImageSet dataset, Tile parent) { if (level < dataset.BaseLevel) { return(null); } Tile retTile = null; long tileKey = ImageSetHelper.GetTileKey(dataset, level, x, y); try { if (!tiles.ContainsKey(tileKey)) { return(null); } else { retTile = tiles[tileKey]; } } catch { if (Earth3d.Logging) { Earth3d.WriteLogMessage("Tile Initialize: Exception"); } } return(retTile); }
public ToastTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; this.topDown = !dataset.BottomsUp; demSize = 513; if (dataset.MeanRadius != 0) { this.DemScaleFactor = dataset.MeanRadius; } else { if (dataset.DataSetType == ImageSetType.Earth) { DemScaleFactor = 6371000; } else { DemScaleFactor = 3396010; } } ComputeQuadrant(); ComputeBoundingSphere(parent, parent != null ? parent.demAverage : 0); insideOut = this.Dataset.DataSetType == ImageSetType.Sky || this.Dataset.DataSetType == ImageSetType.Panorama; }
public void AddSeriesDisplaySets(IImageSet imageSet, Series series) { var factory = GetDisplaySetFactory(series.Modality); if (factory == null) { factory = _defaultDisplaySetFactory; } else { var modalityDisplaySetExists = null != (from displaySet in imageSet.DisplaySets where displaySet.Descriptor is ModalityDisplaySetDescriptor && ((ModalityDisplaySetDescriptor) displaySet.Descriptor).Modality == series.Modality select displaySet).FirstOrDefault(); //Tell the factory whether we've created an "all images" display set containing //all the images in the entire study for the given modality. ((DisplaySetFactory)factory).ModalityDisplaySetExists = modalityDisplaySetExists; } //Add all the display sets derived from single series next. List<IDisplaySet> displaySets = factory.CreateDisplaySets(series); foreach (IDisplaySet displaySet in displaySets) imageSet.DisplaySets.Add(displaySet); }
public ToastTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; topDown = !dataset.BottomsUp; demSize = 513; if (dataset.MeanRadius != 0) { DemScaleFactor = dataset.MeanRadius; } else { if (dataset.DataSetType == ImageSetType.Earth) { DemScaleFactor = 6371000; } else { DemScaleFactor = 3396010; } } ComputeQuadrant(); ComputeBoundingSphere( parent, parent !=null ? parent.demAverage : 0); insideOut = Dataset.DataSetType == ImageSetType.Sky || Dataset.DataSetType == ImageSetType.Panorama; }
public static void ShowHistogram(IImageSet imageset, bool toggle, Point pnt) { if (imageset.WcsImage is FitsImage) { if (singleton == null) { singleton = new Histogram(); singleton.Owner = Earth3d.MainWindow; } else { if (toggle) { HideHistogram(); return; } else { singleton.Hide(); } } singleton.Top = pnt.Y - singleton.Height; singleton.Left = pnt.X; singleton.Show(); singleton.Top = pnt.Y - singleton.Height; singleton.Left = pnt.X; singleton.Image = (FitsImage)imageset.WcsImage; singleton.Tile = (SkyImageTile)TileCache.GetTile(0, 0, 0, imageset, null); } }
public void AddSeriesDisplaySets(IImageSet imageSet, Series series) { var factory = GetDisplaySetFactory(series.Modality); if (factory == null) { factory = _defaultDisplaySetFactory; } else { var modalityDisplaySetExists = null != (from displaySet in imageSet.DisplaySets where displaySet.Descriptor is ModalityDisplaySetDescriptor && ((ModalityDisplaySetDescriptor)displaySet.Descriptor).Modality == series.Modality select displaySet).FirstOrDefault(); //Tell the factory whether we've created an "all images" display set containing //all the images in the entire study for the given modality. ((DisplaySetFactory)factory).ModalityDisplaySetExists = modalityDisplaySetExists; } //Add all the display sets derived from single series next. List <IDisplaySet> displaySets = factory.CreateDisplaySets(series); foreach (IDisplaySet displaySet in displaySets) { imageSet.DisplaySets.Add(displaySet); } }
public DisplaySetTreeGroupItem(IImageSet imageSet, ITreeItemBinding binding) { _imageSet = imageSet; _tree = new Tree <IDisplaySetTreeItem>(binding); Initialize(); IsExpanded = false; }
/// <summary> /// Updates the contents of the given <see cref="IImageSet"/> by populating it with <see cref="IDisplaySet"/>s created /// from the given <see cref="Study"/>. /// </summary> protected virtual void FillImageSet(IImageSet imageSet, Study study) { foreach (Series series in study.Series) { UpdateImageSet(imageSet, series); } }
public Bitmap CreateStackIcon(IImageSet imageSet) { Platform.CheckForNullReference(imageSet, "imageSet"); IPresentationImage image = GetMiddlePresentationImage(imageSet); return(GetStackIcon(delegate(int width, int height) { return image.DrawToBitmap(width, height); })); }
public static IImageSet GetImageSet(string namespaceQualifiedType, ImageSetParameters parameters) { Type type = Type.GetType(namespaceQualifiedType); if (type == null) { throw ExceptionHelper.CreateException <PixelServerException>("The type {0} was not found.", namespaceQualifiedType); } if (type.GetInterface("IImageSetProvider") == null) { throw ExceptionHelper.CreateException <PixelServerException>("The type {0} doesn't implement interface IImageSetProvider.", namespaceQualifiedType); } ConstructorInfo ctor = type.GetConstructor(Type.EmptyTypes); if (ctor == null) { throw ExceptionHelper.CreateException <PixelServerException>("The type {0} doesn't have a parameterless constructor defined.", namespaceQualifiedType); } object invokeTarget = ctor.Invoke(null); MethodInfo method = type.GetMethod("GetImageSet"); IImageSet retVal = (IImageSet)method.Invoke(invokeTarget, new object[] { parameters }); return(retVal); }
/// <summary> /// Updates the contents of the given <see cref="IImageSet"/> by populating it with <see cref="IDisplaySet"/>s created /// from the given <see cref="Series"/>. /// </summary> protected virtual void UpdateImageSet(IImageSet imageSet, Series series) { foreach (IDisplaySet displaySet in BasicDisplaySetFactory.CreateSeriesDisplaySets(series, StudyTree)) { imageSet.DisplaySets.Add(displaySet); } }
private void ShowImageCredits(IImageSet imageSet) { if (imageSet != null) { if (!string.IsNullOrEmpty(imageSet.CreditsText)) { this.creditsText.Text = imageSet.CreditsText; } else { this.creditsText.Text = Language.GetLocalizedText(288, "No information available"); } if (!string.IsNullOrEmpty(imageSet.CreditsUrl)) { this.creditsLink.Text = imageSet.CreditsUrl; } else { this.creditsLink.Text = Language.GetLocalizedText(288, "No information available"); } } else { this.creditsText.Text = Language.GetLocalizedText(288, "No information available"); this.creditsLink.Text = Language.GetLocalizedText(288, "No information available"); } }
private void FillPanoramaList() { if (contextResults.Items.Count > 0) { IImageSet im = contextResults.Items[0] as IImageSet; if (im != null) { if (im.DataSetType == ImageSetType.Panorama) { return; } } } contextResults.Clear(); paginator1.CurrentPage = 1; paginator1.TotalPages = 1; foreach (object o in Earth3d.MainWindow.ExplorerRoot.Children) { if (o is Folder) { Folder f = (Folder)o; if (f.Name == "Panoramas") { AddChildern(f); } } } contextResults.Invalidate(); }
void MainWindow_ImageSetChanged(object sender, EventArgs e) { if (deferUpdate) { return; } deferUpdate = true; int index = 0; foreach (string name in viewTarget.Items) { if (name == Earth3d.MainWindow.CurrentImageSet.DataSetType.ToString()) { viewTarget.SelectedIndex = index; break; } index++; } index = 0; foreach (object o in ImageDataSetsCombo.Items) { if (o is IImageSet) { IImageSet imageset = (IImageSet)o; if (imageset == Earth3d.MainWindow.CurrentImageSet) { ImageDataSetsCombo.SelectedIndex = index; break; } index++; } } deferUpdate = false; }
public MercatorTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; if (dataset.MeanRadius != 0) { this.DemScaleFactor = dataset.MeanRadius; } else { if (dataset.DataSetType == ImageSetType.Earth) { DemScaleFactor = 6371000; } else { DemScaleFactor = 3396000; } } if (parent != null) { ComputeBoundingSphere(parent as MercatorTile, parent.demAverage); } else { ComputeBoundingSphere(parent as MercatorTile, 0); } VertexCount = ((SubDivisions + 1) * (SubDivisions + 1)); }
public static string ToJSON(IImageSet imageset) { StringBuilder sb = new StringBuilder(); sb.Append(" {"); sb.Append(string.Format("{0}:\"{1}\"{2}", "name", imageset.Name, ",")); // sb.Append(string.Format("{0}:{1:###.####}{2}", "r", place.RA, ",")); // sb.Append(string.Format("{0}:\"{1}\"{2}", "DemUrl", imageset.DemUrl, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "bandPass", imageset.BandPass, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "baseLevel", imageset.BaseLevel, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "baseTileDegrees", imageset.BaseTileDegrees, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "bottomsUp", imageset.BottomsUp ? "true" :"false", ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "centerX", imageset.CenterX, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "centerY", imageset.CenterY, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "creditsText", imageset.CreditsText, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "dataSetType", imageset.DataSetType, ",")); // sb.Append(string.Format("{0}:\"{1}\"{2}", "ElevationModel", imageset.ElevationModel, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "levels", imageset.Levels, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "offsetX", imageset.OffsetX, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "offsetY", imageset.OffsetY, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "projection", imageset.Projection, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "quadTreeTileMap", imageset.QuadTreeTileMap, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "rotation", imageset.Rotation, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "thumbnailUrl", imageset.ThumbnailUrl, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "url", imageset.Url, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "widthFactor", imageset.WidthFactor, ",")); sb.Append("}"); return(sb.ToString()); }
//mxd private static TreeNode FindImageSet(TreeNode node, int tileindex) { if (node.Name == ALL_IMAGES) { return(null); // Skip "All images" set } // First search in child nodes foreach (TreeNode n in node.Nodes) { TreeNode match = FindImageSet(n, tileindex); if (match != null) { return(match); } } // Then - in current node IImageSet set = ((TreeNodeData)node.Tag).Set; foreach (ImageData img in set.Images) { if (img.TileIndex == tileindex) { return(node); } } return(null); }
private static IPresentationImage GetMiddlePresentationImage(IImageSet imageSet) { if (imageSet.DisplaySets.Count == 0) { throw new ArgumentException("The image set must contain at least one display set."); } return(GetMiddlePresentationImage(imageSet.DisplaySets[0])); }
public static void ShowAt(IImageSet imageSet, Point pnt) { TourPlace tp = new TourPlace(imageSet.Name, 0, 0, Classification.Unidentified, "", imageSet.DataSetType, 360); tp.BackgroundImageSet = imageSet; ShowAt(tp, pnt); }
public PlotTile(int level, int x, int y, IImageSet Imageimageset, Tile parent) { this.level = level; this.x = x; this.y = y; dataset = Imageimageset; InViewFrustum = true; }
public static void ShowNofinder(IImageSet imageSet, Point pnt) { TourPlace tp = new TourPlace(imageSet.Name, 0, 0, Classification.Unidentified, "", imageSet.DataSetType, 360); tp.StudyImageset = imageSet; ShowNofinder(tp, pnt); }
public PlotTile(int level, int x, int y, IImageSet Imageimageset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = Imageimageset; InViewFrustum = true; }
public TangentTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; topDown = !dataset.BottomsUp; ComputeBoundingSphere(parent); VertexCount = ((SubDivisions + 1) * (SubDivisions + 1)); }
private static int Enqueue(ICollection <IPresentationImage> queue, IImageSet iSet) { int count = 0; foreach (IDisplaySet dSet in iSet.DisplaySets) { count += Enqueue(queue, dSet); } return(count); }
public SphericalTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; this.topDown = !dataset.BottomsUp; ComputeBoundingSphere(); VertexCount = ((subDivisionsX + 1) * (subDivisionsY + 1)); }
public EquirectangularTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; topDown = !dataset.BottomsUp; ComputeBoundingSphere(parent); VertexCount = ((SubDivisions + 1) * (SubDivisions + 1)); insideOut = Dataset.DataSetType == ImageSetType.Sky || Dataset.DataSetType == ImageSetType.Panorama; }
public override TestResult Test(IImageSet imageSet) { if (imageSet.PatientInfo == _referenceImageSet.PatientInfo) { return(new TestResult(true)); } else { return(new TestResult(false)); } }
public EquirectangularTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; this.topDown = !dataset.BottomsUp; ComputeBoundingSphere(parent); VertexCount = ((SubDivisions + 1) * (SubDivisions + 1)); insideOut = this.Dataset.DataSetType == ImageSetType.Sky || this.Dataset.DataSetType == ImageSetType.Panorama; }
public static bool ProcessPixelRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; if (!IsPixelRequest(request)) { return(false); } ImageSetParameters parameters = new ImageSetParameters(); string imageName = string.Empty; string nameSpaceQualifiedTypeName = string.Empty; parameters = GetParameters(request, out imageName, out nameSpaceQualifiedTypeName); if (string.IsNullOrEmpty(nameSpaceQualifiedTypeName)) { return(ProcessResourceRequest(imageName, parameters)); } try { //object retVal = method.Invoke(null, (object[])parameters); IImageSet retVal = GetImageSet(nameSpaceQualifiedTypeName, parameters); if (retVal == null) { response.Clear(); response.StatusCode = 404; response.Status = "Image not found"; context.ApplicationInstance.CompleteRequest(); return(true); } IImageSet imageSet = (IImageSet)retVal; MemoryStream ms = new MemoryStream(); // saving to a memory stream isn't necessary for jpeg but I'm leaving this in just in case I change the format to png later imageSet[imageName].Save(ms, ImageFormat.Png); response.Clear(); //TODO: Parameterize the content type/ImageFormat response.ContentType = "image/Png"; // this must match the ImageFormat in the Save call above ms.WriteTo(response.OutputStream); imageSet.Dispose(); context.ApplicationInstance.CompleteRequest(); } catch (Exception ex) { LogManager.CurrentLog.AddEntry("An error occurred processing PixelServer request:\r\n Parameters: {0}", ex, new string[] { parameters.ToString() }); } return(true); }
private void CreateObjects() { _viewer = new ImageViewerComponent(); _imageBox = new ImageBox(); _tile1 = new Tile(); _tile2 = new Tile(); _imageSet = new ImageSet(); _displaySet = new DisplaySet(); _image1 = new TestPresentationImage(); _image2 = new TestPresentationImage(); }
public SkyImageTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; demSize = 513; DemScaleFactor = 800000; GetParameters(); Height = 0; Width = 0; }
public override void ProcessRequest(string request, ref Socket socket, bool authenticated, string body) { QueryString query = new QueryString(request); String sMimeType = "text/xml"; string data = ""; string id = query.GetValues("id")[0]; int hash = 0; try { hash = Convert.ToInt32(id); if (Earth3d.ImagesetHashTable.ContainsKey(hash)) { StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); using (XmlTextWriter xmlWriter = new XmlTextWriter(sw)) { xmlWriter.Formatting = Formatting.Indented; xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); xmlWriter.WriteStartElement("Folder"); IImageSet imageset = (IImageSet)Earth3d.ImagesetHashTable[hash]; string alternateUrl = ""; try { if (File.Exists(imageset.Url)) { alternateUrl = string.Format("http://{0}:5050/imageset/{1}/{2}", MyWebServer.IpAddress, hash, Path.GetFileName(imageset.Url)); } } catch { } ImageSetHelper.SaveToXml(xmlWriter, imageset, alternateUrl); xmlWriter.WriteFullEndElement(); xmlWriter.Close(); } data = sb.ToString(); } } catch { } SendHeaderAndData(data, ref socket, sMimeType); }
//public static bool operator ==(ImageSet left, ImageSet right) //{ // if (left == right ) // { // return true; // } // if (left == null ^ right == null) // { // return false; // } // return (left.Url.GetHashCode() == right.Url.GetHashCode()); //} //public static bool operator !=(ImageSet left, ImageSet right) //{ // if (left == right ) // { // return false; // } // if ( left == null ^ right == null) // { // return true; // } // return (left.Url.GetHashCode() != right.Url.GetHashCode()); //} //public static bool operator ==(ImageSet o1, ImageSet o2) //{ // return (Object)o1 == null ? (Object)o2 == null : o1.Equals(o2); //} //public static bool operator !=(ImageSet o1, ImageSet o2) //{ // return (Object)o1 != null ? (Object)o2 != null : !o1.Equals(o2); //} public bool Equals(object obj) { if (obj == null) { return(false); } if (!(obj is IImageSet)) { return(false); } IImageSet b = (IImageSet)obj; return(Util.GetHashCode(b.Url) == Util.GetHashCode(this.Url) && b.DataSetType == this.DataSetType && b.BandPass == this.BandPass && b.Generic == this.Generic); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (!(obj is IImageSet)) { return(false); } IImageSet b = (IImageSet)obj; return(b.GetHash() == this.GetHash() && b.DataSetType == this.DataSetType && b.BandPass == this.BandPass && b.Generic == this.Generic); }
// URL parameters //{0} ImageSetID //{1} level //{2} x tile id //{3} y tile id //{4} quadtree address (VE style) //{5} quadtree address (Google maps style) //{6} top left corner RA //{7} top left corner Dec //{8} bottom right corner RA //{9} bottom right corner dec //{10} bottom left corner RA //{11} bottom left corner dec //{12} top right corner RA //{13} top right corner dec public static string GetTileKeyString(IImageSet imageset, int level, int x, int y) { StringBuilder sb = new StringBuilder(); sb.Append(imageset.ImageSetID.ToString()); sb.Append(@"\"); sb.Append(level.ToString()); sb.Append(@"\"); sb.Append(y.ToString()); sb.Append("_"); sb.Append(x.ToString()); return(sb.ToString()); }
public void AddMultiSeriesDisplaySets(IImageSet imageSet, Study study) { var multiSeriesModalities = (from option in _displaySetCreationOptions where option.CreateAllImagesDisplaySet join series in study.Series on option.Modality equals series.Modality select option.Modality).Distinct(); foreach (var modality in multiSeriesModalities) { //Add all the "all images" per modality display sets for the entire study at the top of the list. var displaySet = _modalityDisplaySetFactory.CreateDisplaySet(study, modality); if (displaySet != null) imageSet.DisplaySets.Add(displaySet); } }
public TestTree() { _viewer = new ImageViewerComponent(); _imageBox1 = new ImageBox(); _imageBox2 = new ImageBox(); _tile1 = new Tile(); _tile2 = new Tile(); _tile3 = new Tile(); _tile4 = new Tile(); _imageSet1 = new ImageSet(); _displaySet1 = new DisplaySet(); _displaySet2 = new DisplaySet(); _image1 = new TestPresentationImage(); _image2 = new TestPresentationImage(); _image3 = new TestPresentationImage(); _image4 = new TestPresentationImage(); _viewer.PhysicalWorkspace.ImageBoxes.Add(_imageBox1); _viewer.PhysicalWorkspace.ImageBoxes.Add(_imageBox2); _imageBox1.Tiles.Add(_tile1); _imageBox1.Tiles.Add(_tile2); _imageBox2.Tiles.Add(_tile3); _imageBox2.Tiles.Add(_tile4); _viewer.LogicalWorkspace.ImageSets.Add(_imageSet1); _imageSet1.DisplaySets.Add(_displaySet1); _imageSet1.DisplaySets.Add(_displaySet2); _displaySet1.PresentationImages.Add(_image1); _displaySet1.PresentationImages.Add(_image2); _displaySet2.PresentationImages.Add(_image3); _displaySet2.PresentationImages.Add(_image4); _imageBox1.DisplaySet = _displaySet1; _imageBox2.DisplaySet = _displaySet2; }
private static int Enqueue(ICollection<IPresentationImage> queue, IImageSet iSet) { int count = 0; foreach (IDisplaySet dSet in iSet.DisplaySets) { count += Enqueue(queue, dSet); } return count; }
public static void ShowNofinder(IImageSet imageSet, Point pnt) { var tp = new TourPlace(imageSet.Name, 0, 0, Classification.Unidentified, "", imageSet.DataSetType, 360); tp.StudyImageset = imageSet; ShowNofinder(tp, pnt); }
public static Tile GetTileNow(int level, int x, int y, IImageSet dataset, Tile parent) { if (level < dataset.BaseLevel) { return null; } Tile retTile = null; long tileKey = ImageSetHelper.GetTileKey(dataset, level, x, y); try { if (!tiles.ContainsKey(tileKey)) { retTile = ImageSetHelper.GetNewTile(dataset, level, x, y, parent); tileMutex.WaitOne(); tiles.Add(tileKey, retTile); tileMutex.ReleaseMutex(); } else { retTile = tiles[tileKey]; } } catch { if (Earth3d.Logging) { Earth3d.WriteLogMessage("GetTile: Exception"); } } finally { //todoperf get rid of this write for GC retTile.AccessCount = AccessID++; } // Create if not ready to render if (!retTile.ReadyToRender) { TileCache.GetTileFromWeb(retTile, false); retTile.CreateGeometry(Earth3d.MainWindow.RenderContext11, false); } return retTile; }
public static ImageSet FromIImage(IImageSet imageset) { if (imageset == null) { return null; } ImageSet newset = new ImageSet(); IImageSet newImageset = newset; newImageset.BandPass = imageset.BandPass; newImageset.BaseLevel = imageset.BaseLevel; newImageset.BaseTileDegrees = imageset.BaseTileDegrees; newImageset.BottomsUp = imageset.BottomsUp; newImageset.CenterX = imageset.CenterX; newImageset.CenterY = imageset.CenterY; newImageset.CreditsText = imageset.CreditsText; newImageset.CreditsUrl = imageset.CreditsUrl; newImageset.DataSetType = imageset.DataSetType; newImageset.DefaultSet = imageset.DefaultSet; newImageset.ElevationModel = imageset.ElevationModel; newImageset.Extension = imageset.Extension; newImageset.Generic = imageset.Generic; newImageset.ImageSetID = imageset.ImageSetID; newImageset.Levels = imageset.Levels; newImageset.Matrix = imageset.Matrix; newImageset.Mercator = imageset.Mercator; newImageset.Name = imageset.Name; newImageset.OffsetX = imageset.OffsetX; newImageset.OffsetY = imageset.OffsetY; newImageset.Projection = imageset.Projection; newImageset.QuadTreeTileMap = imageset.QuadTreeTileMap; newImageset.Rotation = imageset.Rotation; newImageset.Sparse = imageset.Sparse; newImageset.ThumbnailUrl = imageset.ThumbnailUrl; newImageset.Url = imageset.Url; newImageset.WidthFactor = imageset.WidthFactor; newImageset.WcsImage = imageset.WcsImage; newImageset.MeanRadius = imageset.MeanRadius; newImageset.ReferenceFrame = imageset.ReferenceFrame; newImageset.DemUrl = imageset.DemUrl; return newset; }
public static Tile GetNewTile(IImageSet imageset, int level, int x, int y, Tile parent) { switch (imageset.Projection) { //case ProjectionType.Mercator: // { // MercatorTile newTile = new MercatorTile(level, x, y, imageset, parent); // return newTile; // } //case ProjectionType.Equirectangular: // { // return new EquirectangularTile(level, x, y, imageset, parent); // } //case ProjectionType.Spherical: // { // return new SphericalTile(level, x, y, imageset, parent); // } default: case ProjectionType.Toast: { return ToastTile.Create(level, x, y, imageset, parent); } //case ProjectionType.SkyImage: // { // return new SkyImageTile(level, x, y, imageset, parent); // } //case ProjectionType.Plotted: // { // return new PlotTile(level, x, y, imageset, parent); // } //case ProjectionType.Tangent: // { // TangentTile newTile = new TangentTile(level, x, y, imageset, parent); // return newTile; // } } }
public static Tile GetTile(int level, int x, int y, IImageSet dataset, Tile parent) { if (level < dataset.BaseLevel) { return null; } Tile retTile = null; long tileKey = ImageSetHelper.GetTileKey(dataset, level, x, y); try { if (!tiles.ContainsKey(tileKey)) { retTile = ImageSetHelper.GetNewTile(dataset, level, x, y, parent); tileMutex.WaitOne(); tiles.Add(tileKey, retTile); tileMutex.ReleaseMutex(); } else { retTile = tiles[tileKey]; } } catch { if (Earth3d.Logging) { Earth3d.WriteLogMessage("GetTile: Exception"); } } finally { //todoperf get rid of this write for GC retTile.AccessCount = AccessID++; } return retTile; }
internal static Layer AddImagesetLayer(IImageSet imageSet) { if (!string.IsNullOrEmpty(CurrentMap)) { ImageSetLayer layer = new ImageSetLayer(imageSet); layer.Name = imageSet.Name; LayerList.Add(layer.ID, layer); layer.ReferenceFrame = CurrentMap; AllMaps[CurrentMap].Layers.Add(layer); AllMaps[CurrentMap].Open = true; LoadTree(); version++; return layer; } return null; }
public static void AddImageSetToTable(int hash, IImageSet set) { if (!ImagesetHashTable.ContainsKey(hash)) { if (set != null) { ImagesetHashTable.Add(hash, set); } } }
public static Tile GetNewTile(IImageSet imageset, int level, int x, int y, Tile parent) { switch (imageset.Projection) { case ProjectionType.Mercator: { var newTile = new MercatorTile(level, x, y, imageset, parent); return newTile; } case ProjectionType.Equirectangular: { return new EquirectangularTile(level, x, y, imageset, parent); } case ProjectionType.Spherical: { return new SphericalTile(level, x, y, imageset, parent); } case ProjectionType.Toast: { return new ToastTile(level, x, y, imageset, parent); } case ProjectionType.SkyImage: { return new SkyImageTile(level, x, y, imageset, parent); } case ProjectionType.Plotted: { return new PlotTile(level, x, y, imageset, parent); } default: case ProjectionType.Tangent: { var newTile = new TangentTile(level, x, y, imageset, parent); return newTile; } } }
public MercatorTile(int level, int x, int y, IImageSet dataset, Tile parent) { this.level = level; this.x = x; this.y = y; this.dataset = dataset; if (dataset.MeanRadius != 0) { DemScaleFactor = dataset.MeanRadius; } else { if (dataset.DataSetType == ImageSetType.Earth) { DemScaleFactor = 6371000; } else { DemScaleFactor = 3396000; } } if (parent != null) { ComputeBoundingSphere(parent as MercatorTile, parent.demAverage); } else { ComputeBoundingSphere(parent as MercatorTile, 0); } VertexCount = ((SubDivisions + 1) * (SubDivisions + 1)); }
public static long GetTileKey(IImageSet imageset, int level, int x, int y) { return imageset.InternalID + ((long)level << 16) + ((long)x << 21) + ((long)y << 42); }
// URL parameters //{0} ImageSetID //{1} level //{2} x tile id //{3} y tile id //{4} quadtree address (VE style) //{5} quadtree address (Google maps style) //{6} top left corner RA //{7} top left corner Dec //{8} bottom right corner RA //{9} bottom right corner dec //{10} bottom left corner RA //{11} bottom left corner dec //{12} top right corner RA //{13} top right corner dec public static string GetTileKeyString(IImageSet imageset, int level, int x, int y) { var sb = new StringBuilder(); sb.Append(imageset.ImageSetID.ToString()); sb.Append(@"\"); sb.Append(level.ToString()); sb.Append(@"\"); sb.Append(y.ToString()); sb.Append("_"); sb.Append(x.ToString()); return sb.ToString(); }
public static string GetTileKey(IImageSet imageset, int level, int x, int y) { return imageset.ImageSetID.ToString() + @"\" + level.ToString() + @"\" + y.ToString() + "_" + x.ToString(); }
public static string ToJSON(IImageSet imageset) { var sb = new StringBuilder(); sb.Append(" {"); sb.Append(string.Format("{0}:\"{1}\"{2}", "name", imageset.Name, ",")); // sb.Append(string.Format("{0}:{1:###.####}{2}", "r", place.RA, ",")); // sb.Append(string.Format("{0}:\"{1}\"{2}", "DemUrl", imageset.DemUrl, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "bandPass", imageset.BandPass, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "baseLevel", imageset.BaseLevel, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "baseTileDegrees", imageset.BaseTileDegrees, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "bottomsUp", imageset.BottomsUp ? "true" :"false", ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "centerX", imageset.CenterX, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "centerY", imageset.CenterY, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "creditsText", imageset.CreditsText, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "dataSetType", imageset.DataSetType, ",")); // sb.Append(string.Format("{0}:\"{1}\"{2}", "ElevationModel", imageset.ElevationModel, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "levels", imageset.Levels, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "offsetX", imageset.OffsetX, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "offsetY", imageset.OffsetY, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "projection", imageset.Projection, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "quadTreeTileMap", imageset.QuadTreeTileMap, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "rotation", imageset.Rotation, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "thumbnailUrl", imageset.ThumbnailUrl, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "url", imageset.Url, ",")); sb.Append(string.Format("{0}:\"{1}\"{2}", "widthFactor", imageset.WidthFactor, ",")); sb.Append("}"); return sb.ToString(); }
private void ShowImageCredits(IImageSet imageSet) { if (imageSet != null) { if (!string.IsNullOrEmpty(imageSet.CreditsText)) { creditsText.Text = imageSet.CreditsText; } else { creditsText.Text = Language.GetLocalizedText(288, "No information available"); } if (!string.IsNullOrEmpty(imageSet.CreditsUrl)) { creditsLink.Text = imageSet.CreditsUrl; } else { creditsLink.Text = Language.GetLocalizedText(288, "No information available"); } } else { creditsText.Text = Language.GetLocalizedText(288, "No information available"); creditsLink.Text = Language.GetLocalizedText(288, "No information available"); } }
private void RenderFrame(RenderTargetTexture targetTexture, DepthBuffer depthBuffer, RenderTypes renderType) { CurrentRenderType = renderType; bool offscreenRender = targetTexture != null; Tile.deepestLevel = 0; try { if (offscreenRender) { RenderContext11.SetOffscreenRenderTargets(targetTexture, depthBuffer); } else { RenderContext11.SetDisplayRenderTargets(); } //Clear the backbuffer to a black color RenderContext11.ClearRenderTarget(new SharpDX.Color(SkyColor.R, SkyColor.G, SkyColor.B, SkyColor.A)); RenderContext11.RenderType = CurrentImageSet.DataSetType; RenderContext11.BlendMode = BlendMode.Alpha; if (CurrentImageSet.DataSetType == ImageSetType.Sandbox) { // Start Sandbox mode RenderContext11.SunPosition = LayerManager.GetPrimarySandboxLight(); RenderContext11.SunlightColor = LayerManager.GetPrimarySandboxLightColor(); RenderContext11.ReflectedLightColor = Color.Black; RenderContext11.HemisphereLightColor = Color.Black; SkyColor = Color.Black; if ((int)SolarSystemTrack < (int)SolarSystemObjects.Custom) { double radius = Planets.GetAdjustedPlanetRadius((int)SolarSystemTrack); double distance = SolarSystemCameraDistance; double camAngle = fovLocal; double distrad = distance / (radius * Math.Tan(.5 * camAngle)); if (distrad < 1) { planetFovWidth = Math.Asin(distrad); } else { planetFovWidth = Math.PI; } } else { planetFovWidth = Math.PI; } SetupMatricesSolarSystem11(false, renderType); Matrix3d matLocal = RenderContext11.World; matLocal.Multiply(Matrix3d.Translation(-viewCamera.ViewTarget)); RenderContext11.World = matLocal; RenderContext11.WorldBase = RenderContext11.World; RenderContext11.WorldBaseNonRotating = RenderContext11.World; RenderContext11.NominalRadius = 1; Earth3d.MainWindow.MakeFrustum(); double zoom = Earth3d.MainWindow.ZoomFactor; LayerManager.Draw(RenderContext11, 1.0f, false, "Sandbox", true, false); if ((SolarSystemMode) && label != null && !TourPlayer.Playing) { label.Draw(RenderContext11, true); } RenderContext11.setRasterizerState(TriangleCullMode.Off); // end Sandbox Mode } else if (CurrentImageSet.DataSetType == ImageSetType.SolarSystem) { { SkyColor = Color.Black; if ((int)SolarSystemTrack < (int)SolarSystemObjects.Custom) { double radius = Planets.GetAdjustedPlanetRadius((int)SolarSystemTrack); double distance = SolarSystemCameraDistance; double camAngle = fovLocal; double distrad = distance / (radius * Math.Tan(.5 * camAngle)); if (distrad < 1) { planetFovWidth = Math.Asin(distrad); } else { planetFovWidth = Math.PI; } } else { planetFovWidth = Math.PI; } if (trackingObject == null) { trackingObject = Search.FindCatalogObjectExact("Sun"); } SetupMatricesSolarSystem11(true, renderType); float skyOpacity = 1.0f - Planets.CalculateSkyBrightnessFactor(RenderContext11.View, viewCamera.ViewTarget); if (float.IsNaN(skyOpacity)) { skyOpacity = 0f; } double zoom = Earth3d.MainWindow.ZoomFactor; float milkyWayBlend = (float)Math.Min(1, Math.Max(0, (Math.Log(zoom) - 8.4)) / 4.2); float milkyWayBlendIn = (float)Math.Min(1, Math.Max(0, (Math.Log(zoom) - 17.9)) / 2.3); if (Properties.Settings.Default.SolarSystemMilkyWay.State) { if (milkyWayBlend < 1) // Solar System mode Milky Way background { if (milkyWayBackground == null) { milkyWayBackground = GetImagesetByName("Digitized Sky Survey (Color)"); } if (milkyWayBackground != null) { float c = ((1 - milkyWayBlend)) / 4; Matrix3d matOldMW = RenderContext11.World; Matrix3d matLocalMW = RenderContext11.World; 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(cameraOffset)); RenderContext11.World = matLocalMW; RenderContext11.WorldBase = matLocalMW; Earth3d.MainWindow.MakeFrustum(); RenderContext11.SetupBasicEffect(BasicEffect.TextureColorOpacity, 1, Color.White); RenderContext11.DepthStencilMode = DepthStencilMode.Off; DrawTiledSphere(milkyWayBackground, c * Properties.Settings.Default.SolarSystemMilkyWay.Opacity, Color.FromArgb(255, 255, 255, 255)); RenderContext11.World = matOldMW; RenderContext11.WorldBase = matOldMW; RenderContext11.DepthStencilMode = DepthStencilMode.ZReadWrite; } } } // 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; 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)); RenderContext11.World = matLocalMW; RenderContext11.WorldBase = matLocalMW; Earth3d.MainWindow.MakeFrustum(); RenderContext11.SetupBasicEffect(BasicEffect.TextureColorOpacity, 1, Color.White); 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); } LayerManager.Draw(RenderContext11, 1.0f, true, "Sky", true, false); RenderContext11.World = matOld; Earth3d.MainWindow.MakeFrustum(); } if (SolarSystemCameraDistance < 15000) { SetupMatricesSolarSystem11(false, renderType); if (Properties.Settings.Default.SolarSystemMinorPlanets.State) { MinorPlanets.DrawMPC3D(RenderContext11, Properties.Settings.Default.SolarSystemMinorPlanets.Opacity, viewCamera.ViewTarget); } Planets.DrawPlanets3D(RenderContext11, Properties.Settings.Default.SolarSystemPlanets.Opacity, viewCamera.ViewTarget); } double p = Math.Log(zoom); double d = (180 / SolarSystemCameraDistance) * 100; float sunAtDistance = (float)Math.Min(1, Math.Max(0, (Math.Log(zoom) - 7.5)) / 3); if (sunAtDistance > 0 && Settings.Active.SolarSystemPlanets) { 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); } } RenderContext11.setRasterizerState(TriangleCullMode.Off); } else { if (CurrentImageSet.DataSetType == ImageSetType.Panorama || CurrentImageSet.DataSetType == ImageSetType.Sky) { SkyColor = Color.Black; if ((int)renderType < 5) { SetupMatricesSpaceDome(false, renderType); } else { SetupMatricesSpace11(ZoomFactor, renderType); } RenderContext11.DepthStencilMode = DepthStencilMode.Off; } else { if (Settings.DomeView) { SetupMatricesLandDome(renderType); } else { SetupMatricesLand11(renderType); } RenderContext11.DepthStencilMode = DepthStencilMode.ZReadWrite; } ComputeViewParameters(CurrentImageSet); // Update Context pane CurrentViewCorners = new Coordinates[] { GetCoordinatesForScreenPoint(0, 0), GetCoordinatesForScreenPoint(ViewWidth, 0), GetCoordinatesForScreenPoint(ViewWidth, renderWindow.ClientRectangle.Height), GetCoordinatesForScreenPoint(0, renderWindow.ClientRectangle.Height) }; Coordinates temp = GetCoordinatesForScreenPoint(ViewWidth / 2, renderWindow.ClientRectangle.Height / 2); if (contextPanel != null && ((int)renderType > 4 || renderType == RenderTypes.DomeFront)) { contextPanel.SetViewRect(CurrentViewCorners); } UpdateKmlViewInfo(); if (KmlMarkers != null) { KmlMarkers.ClearGroundOverlays(); } string referenceFrame = GetCurrentReferenceFrame(); if (PlanetLike || Space) { LayerManager.PreDraw(RenderContext11, 1.0f, Space, referenceFrame, true); } if (Properties.Settings.Default.EarthCutawayView.State && !Space && CurrentImageSet.DataSetType == ImageSetType.Earth) { Grids.DrawEarthStructure(RenderContext11, 1f); } RenderContext11.SetupBasicEffect(BasicEffect.TextureColorOpacity, 1, Color.White); if (KmlMarkers != null) { KmlMarkers.SetupGroundOverlays(RenderContext11); } if (PlanetLike) { RenderContext11.setRasterizerState(TriangleCullMode.Off); } // Call DrawTiledSphere instead of PaintLayerFull, because PaintLayerFull // will reset ground layer state DrawTiledSphere(CurrentImageSet, 1.0f, Color.White); if (imageStackVisible) { foreach (ImageSet set in ImageStackList) { PaintLayerFull11(set, StudyOpacity); } } if (studyImageset != null) { if (studyImageset.DataSetType != CurrentImageSet.DataSetType) { StudyImageset = null; } else { PaintLayerFull11(studyImageset, StudyOpacity); } } if (previewImageset != null && PreviewBlend.State) { if (previewImageset.DataSetType != CurrentImageSet.DataSetType) { previewImageset = null; } else { PaintLayerFull11(previewImageset, PreviewBlend.Opacity * 100.0f); } } else { PreviewBlend.State = false; previewImageset = null; } if (Space && (CurrentImageSet.Name == "Plotted Sky")) { Grids.DrawStars(RenderContext11, 1f); } if (Space && Properties.Settings.Default.ShowSolarSystem.State) { Planets.DrawPlanets(RenderContext11, Properties.Settings.Default.ShowSolarSystem.Opacity); } if (PlanetLike || Space) { if (!Space) { //todo fix this for other planets.. double angle = Coordinates.MstFromUTC2(SpaceTimeController.Now, 0) / 180.0 * Math.PI; RenderContext11.WorldBaseNonRotating = Matrix3d.RotationY(angle) * RenderContext11.WorldBase; RenderContext11.NominalRadius = CurrentImageSet.MeanRadius; } else { RenderContext11.WorldBaseNonRotating = RenderContext11.World; RenderContext11.NominalRadius = CurrentImageSet.MeanRadius; RenderContext11.DepthStencilMode = DepthStencilMode.Off; } LayerManager.Draw(RenderContext11, 1.0f, Space, referenceFrame, true, Space); } if (Space && !hemisphereView && Settings.Active.LocalHorizonMode && !Settings.DomeView && !ProjectorServer) { Grids.DrawHorizon(RenderContext11, 1f); } if (Settings.Active.ShowClouds && !Space && CurrentImageSet.DataSetType == ImageSetType.Earth) { DrawClouds(); } // Draw Field of view indicator if (Settings.Active.ShowFieldOfView) { fovBlend.TargetState = true; } else { fovBlend.TargetState = false; } if (fovBlend.State) { if (fov != null && Space) { fov.Draw3D(RenderContext11, fovBlend.Opacity, RA, Dec); } } if (label != null && !TourPlayer.Playing) { label.Draw(RenderContext11, PlanetLike); } if (ShowKmlMarkers && KmlMarkers != null) { KmlMarkers.DrawLabels(RenderContext11); } // End Planet & space } if (uiController != null) { { uiController.Render(this); } } if (videoOverlay != null) { if ((int)renderType < 5) { SetupMatricesVideoOverlayDome(false, renderType); } else { SetupMatricesVideoOverlay(ZoomFactor); } DepthStencilMode mode = RenderContext11.DepthStencilMode = DepthStencilMode.Off; PaintLayerFull11(videoOverlay, 100f); RenderContext11.DepthStencilMode = mode; } if (measuringDrag && measureLines != null) { measureLines.DrawLines(RenderContext11, 1.0f, Color.Yellow); } if (Properties.Settings.Default.ShowCrosshairs && !TourPlayer.Playing && renderType == RenderTypes.Normal) { float aspect = RenderContext11.ViewPort.Height / RenderContext11.ViewPort.Width; crossHairPoints[0].X = .01f * aspect; crossHairPoints[1].X = -.01f * aspect; crossHairPoints[0].Y = 0; crossHairPoints[1].Y = 0; crossHairPoints[0].Z = .9f; crossHairPoints[1].Z = .9f; crossHairPoints[0].W = 1f; crossHairPoints[1].W = 1f; crossHairPoints[0].Color = Color.White; crossHairPoints[1].Color = Color.White; crossHairPoints[2].X = 0; crossHairPoints[3].X = 0; crossHairPoints[2].Y = -.01f; crossHairPoints[3].Y = .01f; crossHairPoints[2].Z = .9f; crossHairPoints[3].Z = .9f; crossHairPoints[2].W = 1f; crossHairPoints[3].W = 1f; crossHairPoints[2].Color = Color.White; crossHairPoints[3].Color = Color.White; Sprite2d.DrawLines(RenderContext11, crossHairPoints, 4, SharpDX.Matrix.OrthoLH(1f, 1f, 1, -1), false); } if (Properties.Settings.Default.ShowTouchControls && (!TourPlayer.Playing || mover == null) && ( renderType == RenderTypes.Normal || renderType == RenderTypes.LeftEye || renderType == RenderTypes.RightEye) && !rift ) { DrawTouchControls(); } DrawKinectUI(); SetupMatricesAltAz(); Reticle.DrawAll(RenderContext11); } catch (Exception e) { if (Earth3d.Logging) { Earth3d.WriteLogMessage("RenderFrame: Exception"); } if (offscreenRender) { throw e; } } finally { if (offscreenRender) { RenderContext11.SetDisplayRenderTargets(); } } PresentFrame11(offscreenRender); }
public static Tile GetCachedTile(int level, int x, int y, IImageSet dataset, Tile parent) { if (level < dataset.BaseLevel) { return null; } Tile retTile = null; long tileKey = ImageSetHelper.GetTileKey(dataset, level, x, y); try { if (!tiles.ContainsKey(tileKey)) { return null; } else { retTile = tiles[tileKey]; } } catch { if (Earth3d.Logging) { Earth3d.WriteLogMessage("Tile Initialize: Exception"); } } return retTile; }
public static void ShowAt(IImageSet imageSet, Point pnt) { var tp = new TourPlace(imageSet.Name, 0, 0, Classification.Unidentified, "", imageSet.DataSetType, 360); tp.BackgroundImageSet = imageSet; ShowAt(tp, pnt); }
public static void SaveToXml(XmlTextWriter xmlWriter, IImageSet imageset, string alternateUrl) { xmlWriter.WriteStartElement("ImageSet"); xmlWriter.WriteAttributeString("Generic", imageset.Generic.ToString()); xmlWriter.WriteAttributeString("DataSetType", imageset.DataSetType.ToString()); xmlWriter.WriteAttributeString("BandPass", imageset.BandPass.ToString()); 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", imageset.Projection.ToString()); 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(); }