public void Configure(Legend legend, IDisplayableSource displayableSource) { Monitor.Enter(this); try { if (this.previewInterest != null) { this.previewInterest.Dispose(); this.previewInterest = null; this.waitingForCI = null; } } finally { Monitor.Exit(this); } if (this._legend == legend) { return; } if (this._legend != null) { this._legend.dirtyEvent.Remove(new DirtyListener(this.LegendChanged)); } this._legend = legend; this.displayableSource = displayableSource; if (this._legend != null) { this._legend.dirtyEvent.Add(new DirtyListener(this.LegendChanged)); this.LegendChanged(); } base.Enabled = (this._legend != null); this.UpdatePreviewImage(null); this.UpdatePreviewPanel(); }
public void RemoveAlphaLayer(IDisplayableSource tileSource) { int index = this.alphaLayers.FindIndex((DisplayableSourceCache dsc0) => dsc0.BackingStoreIs(tileSource)); this.alphaLayers.RemoveAt(index); this.InvalidateView(); }
public IFuturePrototype GetImagePrototype(ImageParameterTypeIfc parameterType, FutureFeatures features) { List <IFuturePrototype> list = new List <IFuturePrototype>(); list.Add(parameterType.GetSizeParameter()); foreach (SourceMap current in layer) { if (current.ReadyToLock()) { IDisplayableSource displayableSource = mapTileSourceFactory.CreateDisplayableWarpedSource(current); list.Add(displayableSource.GetImagePrototype(parameterType, features)); } } IFuturePrototype futurePrototype = new ApplyPrototype(new CompositeImageVerb(), list.ToArray()); if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.DiskCached)) { futurePrototype = new DiskCachePrototype(mapTileSourceFactory.GetCachePackage().diskCache, futurePrototype); } if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached)) { futurePrototype = new MemCachePrototype(mapTileSourceFactory.GetCachePackage().computeCache, futurePrototype); } return(futurePrototype); }
public void SetBaseLayer(IDisplayableSource tileSource) { this.baseLayer = new DisplayableSourceCache(tileSource); this.SetCreditString(tileSource.GetRendererCredit()); this.latentRegionHolder = null; this.userRegionViewController = null; this.InvalidateView(); }
public void AddLayer(IDisplayableSource warpedMapTileSource) { if (this.baseLayer == null) { this.SetBaseLayer(warpedMapTileSource); return; } this.AddAlphaLayer(warpedMapTileSource); }
public ImageRef RenderLegend(IDisplayableSource displayableSource) { Present present = this.GetRenderedLegendFuture(displayableSource, FutureFeatures.Cached).Realize("Legend.RenderLegend"); if (!(present is ImageRef)) { throw new Legend.RenderFailedException("Render failed: " + present.ToString()); } return((ImageRef)present); }
public UserRegionViewController(CoordinateSystemIfc csi, SVDisplayParams svdp, LatentRegionHolder latentRegionHolder, IDisplayableSource unwarpedMapTileSource) { this.csi = csi; this.svdp = svdp; this.latentRegionHolder = latentRegionHolder; this.displayableSource = unwarpedMapTileSource; this.vertexFillBrush = new SolidBrush(Color.LightBlue); this.vertexStrokePen = new Pen(Color.DarkBlue, 1f); this.segmentFillBrush = new SolidBrush(Color.DarkBlue); }
public void Activate() { ViewerControlIfc sMViewerControl = viewControl.GetSMViewerControl(); UIPositionManager uIPositionManager = viewControl.GetUIPositionManager(); foreach (SourceMap current in layer.GetBackToFront()) { IDisplayableSource displayableSource = mapTileSourceFactory.CreateDisplayableWarpedSource(current); if (displayableSource != null) { sMViewerControl.AddLayer(displayableSource); } } uIPositionManager.SetPositionMemory(layer); LayerView layerView = (LayerView)layer.lastView; viewControl.GetUIPositionManager().switchSlaved(); if (layerView != null) { uIPositionManager.GetVEPos().setPosition(layerView.GetReferenceMapView()); uIPositionManager.GetVEPos().setStyle(layerView.GetReferenceMapView().style); return; } MapRectangle mapRectangle = null; try { mapRectangle = layer.GetUserBoundingBox(mapTileSourceFactory); } catch (CorrespondencesAreSingularException) { } catch (InsufficientCorrespondencesException) { } LatLonZoom position; if (mapRectangle != null) { Size size = new Size(600, 600); position = viewControl.GetVEViewerControl().GetCoordinateSystem() .GetBestViewContaining(mapRectangle, size); } else { position = viewControl.GetVEViewerControl().GetCoordinateSystem().GetDefaultView(); } uIPositionManager.GetVEPos().setPosition(position); }
public IFuture GetRenderedLegendFuture(IDisplayableSource displayableSource, FutureFeatures features) { RenderRegion renderRegion = latentRegionHolder.renderRegion; if (renderRegion == null) { throw new RenderFailedException("Region unavailable"); } renderRegion = renderRegion.Copy(new DirtyEvent()); MapRectangleParameter mapRectangleParameter = new MapRectangleParameter(renderRegion.GetBoundingBox()); Size outputSize = OutputSizeFromRenderRegion(renderRegion); IFuturePrototype imagePrototype = displayableSource.GetImagePrototype(new ImageParameterFromRawBounds(outputSize), features); return(imagePrototype.Curry(new ParamDict(new object[] { TermName.ImageBounds, mapRectangleParameter }))); }
public void Configure(Legend legend, IDisplayableSource displayableSource) { Monitor.Enter(this); try { if (previewInterest != null) { previewInterest.Dispose(); previewInterest = null; waitingForCI = null; } } finally { Monitor.Exit(this); } if (_legend == legend) { return; } if (_legend != null) { _legend.dirtyEvent.Remove(LegendChanged); } _legend = legend; this.displayableSource = displayableSource; if (_legend != null) { _legend.dirtyEvent.Add(LegendChanged); LegendChanged(); } Enabled = _legend != null; UpdatePreviewImage(null); UpdatePreviewPanel(); }
public LegendDisplayableSourceWrapper(IDisplayableSource underSource, LatentRegionHolder replacementLatentRegionHolder) { this.underSource = underSource; this.replacementLatentRegionHolder = replacementLatentRegionHolder; }
private List <ViewerControl.PaintKit> AssembleLayer(PaintSpecification e, LatLonZoom llz, IDisplayableSource tileSource, int stackOrder) { List <ViewerControl.PaintKit> list = new List <ViewerControl.PaintKit>(); CoordinateSystemIfc defaultCoordinateSystem = tileSource.GetDefaultCoordinateSystem(); TileDisplayDescriptorArray tileArrayDescriptor = defaultCoordinateSystem.GetTileArrayDescriptor(llz, e.Size); AsyncRef asyncRef; try { asyncRef = (AsyncRef)tileSource.GetUserBounds(null, (FutureFeatures)7).Realize("ViewerControl.PaintLayer boundsRef"); } catch (Exception ex) { ViewerControl.MessagePainter item = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? ex.ToString() : "X", stackOrder == 0); foreach (TileDisplayDescriptor current in tileArrayDescriptor) { list.Add(new ViewerControl.PaintKit(current.paintLocation) { annotations = { item } }); } return(list); } Region clipRegion = null; if (asyncRef.present == null) { asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.BoundsRefAvailable)); asyncRef.SetInterest(524290); } if ((this.ShowSourceCrop == null || this.ShowSourceCrop.Enabled) && asyncRef.present is IBoundsProvider) { clipRegion = ((IBoundsProvider)asyncRef.present).GetRenderRegion().GetClipRegion(defaultCoordinateSystem.GetUnclippedMapWindow(this.center().llz, e.Size), this.center().llz.zoom, defaultCoordinateSystem); this.UpdateUserRegion(); } new PersistentInterest(asyncRef); int num = 0; foreach (TileDisplayDescriptor current2 in tileArrayDescriptor) { ViewerControl.PaintKit paintKit = new ViewerControl.PaintKit(current2.paintLocation); D.Sayf(10, "count {0} tdd {1}", new object[] { num, current2.tileAddress }); num++; if (e.SynchronousTiles) { D.Sayf(0, "PaintLayer({0}, tdd.ta={1})", new object[] { tileSource.GetHashCode(), current2.tileAddress }); } bool arg_1F5_0 = e.SynchronousTiles; Present present = tileSource.GetImagePrototype(null, (FutureFeatures)15).Curry(new ParamDict(new object[] { TermName.TileAddress, current2.tileAddress })).Realize("ViewerControl.PaintLayer imageAsyncRef"); AsyncRef asyncRef2 = (AsyncRef)present; Rectangle rectangle = Rectangle.Intersect(e.ClipRectangle, current2.paintLocation); int interest = rectangle.Height * rectangle.Width + 524296; asyncRef2.SetInterest(interest); if (asyncRef2.present == null) { ViewerControl.AsyncNotifier @object = new ViewerControl.AsyncNotifier(this); asyncRef2.AddCallback(new AsyncRecord.CompleteCallback(@object.AsyncRecordComplete)); } this.activeTiles.Add(asyncRef2); asyncRef2 = (AsyncRef)asyncRef2.Duplicate("ViewerControl.PaintLayer"); if (e.SynchronousTiles) { D.Assert(false, "unimpl"); } if (asyncRef2.present == null) { D.Assert(!e.SynchronousTiles); } bool flag; if (asyncRef2.present != null && asyncRef2.present is ImageRef) { flag = false; ImageRef imageRef = (ImageRef)asyncRef2.present.Duplicate("tpc"); paintKit.meatyParts.Add(new ViewerControl.ImagePainter(imageRef, clipRegion)); } else { if (asyncRef2.present != null && asyncRef2.present is BeyondImageBounds) { flag = false; } else { if (asyncRef2.present != null && asyncRef2.present is PresentFailureCode) { flag = false; PresentFailureCode presentFailureCode = (PresentFailureCode)asyncRef2.present; ViewerControl.MessagePainter item2 = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? StringUtils.breakLines(presentFailureCode.ToString()) : "X", stackOrder == 0); paintKit.annotations.Add(item2); } else { flag = true; ViewerControl.MessagePainter item3 = new ViewerControl.MessagePainter(stackOrder * 12, stackOrder.ToString(), stackOrder == 0); if (stackOrder == 0) { paintKit.meatyParts.Add(item3); } else { paintKit.annotations.Add(item3); } } } } this.tilesRequired++; if (!flag) { this.tilesAvailable++; } if ((flag && stackOrder == 0) || MapDrawingOption.IsEnabled(this.ShowTileBoundaries)) { paintKit.annotations.Add(new ViewerControl.TileBoundaryPainter()); } if (MapDrawingOption.IsEnabled(this.ShowTileNames)) { paintKit.annotations.Add(new ViewerControl.TileNamePainter(current2.tileAddress.ToString())); } asyncRef2.Dispose(); list.Add(paintKit); } return(list); }
public void AddAlphaLayer(IDisplayableSource tileSource) { this.alphaLayers.Add(new DisplayableSourceCache(tileSource)); this.InvalidateView(); }
public Pixel GetBaseLayerCenterPixel() { IDisplayableSource displayableSource = this.baseLayer; CoordinateSystemIfc defaultCoordinateSystem = displayableSource.GetDefaultCoordinateSystem(); TileDisplayDescriptorArray tileArrayDescriptor = defaultCoordinateSystem.GetTileArrayDescriptor(this.center().llz, base.Size); int num = base.Size.Width / 2; int num2 = base.Size.Height / 2; foreach (TileDisplayDescriptor current in tileArrayDescriptor) { Rectangle paintLocation = current.paintLocation; if (paintLocation.Left <= num) { Rectangle paintLocation2 = current.paintLocation; if (paintLocation2.Right > num) { Rectangle paintLocation3 = current.paintLocation; if (paintLocation3.Top <= num2) { Rectangle paintLocation4 = current.paintLocation; if (paintLocation4.Bottom > num2) { int arg_D1_0 = num; Rectangle paintLocation5 = current.paintLocation; int x = arg_D1_0 - paintLocation5.Left; int arg_E6_0 = num2; Rectangle paintLocation6 = current.paintLocation; int y = arg_E6_0 - paintLocation6.Top; Present present = displayableSource.GetImagePrototype(null, (FutureFeatures)19).Curry(new ParamDict(new object[] { TermName.TileAddress, current.tileAddress })).Realize("ViewerControl.GetBaseLayerCenterPixel imageRef"); Pixel result; if (!(present is ImageRef)) { result = new UndefinedPixel(); return(result); } ImageRef imageRef = (ImageRef)present; GDIBigLockedImage image; Monitor.Enter(image = imageRef.image); Pixel pixel2; try { Image image2 = imageRef.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage(); Bitmap bitmap = (Bitmap)image2; Color pixel = bitmap.GetPixel(x, y); pixel2 = new Pixel(pixel); } finally { Monitor.Exit(image); } imageRef.Dispose(); result = pixel2; return(result); } } } } } return(new UndefinedPixel()); }
private List<ViewerControl.PaintKit> AssembleLayer(PaintSpecification e, LatLonZoom llz, IDisplayableSource tileSource, int stackOrder) { List<ViewerControl.PaintKit> list = new List<ViewerControl.PaintKit>(); CoordinateSystemIfc defaultCoordinateSystem = tileSource.GetDefaultCoordinateSystem(); TileDisplayDescriptorArray tileArrayDescriptor = defaultCoordinateSystem.GetTileArrayDescriptor(llz, e.Size); AsyncRef asyncRef; try { asyncRef = (AsyncRef)tileSource.GetUserBounds(null, (FutureFeatures)7).Realize("ViewerControl.PaintLayer boundsRef"); } catch (Exception ex) { ViewerControl.MessagePainter item = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? ex.ToString() : "X", stackOrder == 0); foreach (TileDisplayDescriptor current in tileArrayDescriptor) { list.Add(new ViewerControl.PaintKit(current.paintLocation) { annotations = { item } }); } return list; } Region clipRegion = null; if (asyncRef.present == null) { asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.BoundsRefAvailable)); asyncRef.SetInterest(524290); } if ((this.ShowSourceCrop == null || this.ShowSourceCrop.Enabled) && asyncRef.present is IBoundsProvider) { clipRegion = ((IBoundsProvider)asyncRef.present).GetRenderRegion().GetClipRegion(defaultCoordinateSystem.GetUnclippedMapWindow(this.center().llz, e.Size), this.center().llz.zoom, defaultCoordinateSystem); this.UpdateUserRegion(); } new PersistentInterest(asyncRef); int num = 0; foreach (TileDisplayDescriptor current2 in tileArrayDescriptor) { ViewerControl.PaintKit paintKit = new ViewerControl.PaintKit(current2.paintLocation); D.Sayf(10, "count {0} tdd {1}", new object[] { num, current2.tileAddress }); num++; if (e.SynchronousTiles) { D.Sayf(0, "PaintLayer({0}, tdd.ta={1})", new object[] { tileSource.GetHashCode(), current2.tileAddress }); } bool arg_1F5_0 = e.SynchronousTiles; Present present = tileSource.GetImagePrototype(null, (FutureFeatures)15).Curry(new ParamDict(new object[] { TermName.TileAddress, current2.tileAddress })).Realize("ViewerControl.PaintLayer imageAsyncRef"); AsyncRef asyncRef2 = (AsyncRef)present; Rectangle rectangle = Rectangle.Intersect(e.ClipRectangle, current2.paintLocation); int interest = rectangle.Height * rectangle.Width + 524296; asyncRef2.SetInterest(interest); if (asyncRef2.present == null) { ViewerControl.AsyncNotifier @object = new ViewerControl.AsyncNotifier(this); asyncRef2.AddCallback(new AsyncRecord.CompleteCallback(@object.AsyncRecordComplete)); } this.activeTiles.Add(asyncRef2); asyncRef2 = (AsyncRef)asyncRef2.Duplicate("ViewerControl.PaintLayer"); if (e.SynchronousTiles) { D.Assert(false, "unimpl"); } if (asyncRef2.present == null) { D.Assert(!e.SynchronousTiles); } bool flag; if (asyncRef2.present != null && asyncRef2.present is ImageRef) { flag = false; ImageRef imageRef = (ImageRef)asyncRef2.present.Duplicate("tpc"); paintKit.meatyParts.Add(new ViewerControl.ImagePainter(imageRef, clipRegion)); } else { if (asyncRef2.present != null && asyncRef2.present is BeyondImageBounds) { flag = false; } else { if (asyncRef2.present != null && asyncRef2.present is PresentFailureCode) { flag = false; PresentFailureCode presentFailureCode = (PresentFailureCode)asyncRef2.present; ViewerControl.MessagePainter item2 = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? StringUtils.breakLines(presentFailureCode.ToString()) : "X", stackOrder == 0); paintKit.annotations.Add(item2); } else { flag = true; ViewerControl.MessagePainter item3 = new ViewerControl.MessagePainter(stackOrder * 12, stackOrder.ToString(), stackOrder == 0); if (stackOrder == 0) { paintKit.meatyParts.Add(item3); } else { paintKit.annotations.Add(item3); } } } } this.tilesRequired++; if (!flag) { this.tilesAvailable++; } if ((flag && stackOrder == 0) || MapDrawingOption.IsEnabled(this.ShowTileBoundaries)) { paintKit.annotations.Add(new ViewerControl.TileBoundaryPainter()); } if (MapDrawingOption.IsEnabled(this.ShowTileNames)) { paintKit.annotations.Add(new ViewerControl.TileNamePainter(current2.tileAddress.ToString())); } asyncRef2.Dispose(); list.Add(paintKit); } return list; }
public DisplayableSourceCache(IDisplayableSource backingSource) { this.backingSource = backingSource; }
public IFuture GetRenderedLegendFuture(IDisplayableSource displayableSource, FutureFeatures features) { RenderRegion renderRegion = this.latentRegionHolder.renderRegion; if (renderRegion == null) { throw new Legend.RenderFailedException("Region unavailable"); } renderRegion = renderRegion.Copy(new DirtyEvent()); MapRectangleParameter mapRectangleParameter = new MapRectangleParameter(renderRegion.GetBoundingBox()); Size outputSize = this.OutputSizeFromRenderRegion(renderRegion); IFuturePrototype imagePrototype = displayableSource.GetImagePrototype(new ImageParameterFromRawBounds(outputSize), features); return imagePrototype.Curry(new ParamDict(new object[] { TermName.ImageBounds, mapRectangleParameter })); }
public ImageRef RenderLegend(IDisplayableSource displayableSource) { Present present = this.GetRenderedLegendFuture(displayableSource, FutureFeatures.Cached).Realize("Legend.RenderLegend"); if (!(present is ImageRef)) { throw new Legend.RenderFailedException("Render failed: " + present.ToString()); } return (ImageRef)present; }
internal bool BackingStoreIs(IDisplayableSource backingSource) { return this.backingSource == backingSource; }
internal bool BackingStoreIs(IDisplayableSource backingSource) { return(this.backingSource == backingSource); }