private void DrawErrorPosition(PositionAssociationView pav, DisplayablePosition.ErrorMarker errorMarker, Pen pen, Brush brush, PaintSpecification e) { ErrorPosition errorPosition = pav.position.GetErrorPosition(errorMarker); if (errorPosition == null) { return; } PointF pointF = MapPositionToPoint(pav.position.pinPosition.latlon); PointF pointF2 = MapPositionToPoint(errorPosition.latlon); RectangleF rectangleF = new RectangleF(e.ClipRectangle.X - e.ClipRectangle.Width * 2, e.ClipRectangle.Y - e.ClipRectangle.Height * 2, e.ClipRectangle.Width * 5, e.ClipRectangle.Height * 5); if (!rectangleF.Contains(pointF) || !rectangleF.Contains(pointF2)) { return; } if (!pav.position.invertError) { e.Graphics.DrawLine(pen, pointF, pointF2); e.Graphics.FillEllipse(brush, pointF2.X - 6f, pointF2.Y - 6f, 12f, 12f); return; } e.Graphics.DrawEllipse(pen, pointF.X - 20f, pointF.Y - 20f, 40f, 40f); }
private void DrawErrorMarkers(PositionAssociationView pav, PaintSpecification e) { DrawErrorPosition(pav, DisplayablePosition.ErrorMarker.AsContributor, errorContribPen, errorContribBrush, e); DrawErrorPosition(pav, DisplayablePosition.ErrorMarker.AsOutlier, errorOutlierPen, errorOutlierBrush, e); }
private void PrintPage(object sender, PrintPageEventArgs e) { e.Graphics.TranslateTransform((float)e.MarginBounds.X, (float)e.MarginBounds.Y); Rectangle rectangle = new Rectangle(0, 0, e.MarginBounds.Width, e.MarginBounds.Height); e.Graphics.SetClip(rectangle); int num = 4; float num2 = (float)(1 << num); e.Graphics.ScaleTransform(1f / num2, 1f / num2); rectangle.Width = (int)((float)rectangle.Width * num2); rectangle.Height = (int)((float)rectangle.Height * num2); GraphicsContainer container = e.Graphics.BeginContainer(); PaintSpecification e2 = new PaintSpecification(e.Graphics, rectangle, rectangle.Size, true); this.viewer.PaintPrintWindow(e2, num); e.Graphics.EndContainer(container); }
internal void Paint(PaintSpecification e, LatLonZoom center, Size size) { if (this.GetUserRegion() == null) { return; } UserRegionViewController.State state; state.center = center; state.size = size; state.valid = true; this.UpdateState(state); UserRegionViewController.ClickableThing[] array = this.clickableThings; for (int i = 0; i < array.Length; i++) { UserRegionViewController.ClickableThing clickableThing = array[i]; e.Graphics.FillPath(this.segmentFillBrush, clickableThing.path); } }
private void DrawMarker(PositionAssociationView pav, PaintSpecification e) { DrawErrorMarkers(pav, e); e.Graphics.CompositingMode = CompositingMode.SourceOver; string text = pav.pinId.ToString(); outlinePen.MiterLimit = 2f; SizeF size = new SizeF(3f, 3f); PointF pointF = MapPositionToPoint(pav.position.pinPosition.latlon); if (!RectangleF.Inflate(e.ClipRectangle, 100f, 100f).Contains(pointF)) { return; } SizeF sizeF = e.Graphics.MeasureString(text, pinFont); double num = 24.0; double num2 = 3.0; int num3 = 3; RectangleF layoutRectangle = new RectangleF(pointF.X - sizeF.Width / 2f, (float)(pointF.Y - sizeF.Height / 2f - num), sizeF.Width, sizeF.Height); RectangleF rectangleF = new RectangleF(layoutRectangle.Location, layoutRectangle.Size); rectangleF.Inflate(size); PointF[] points = new[] { pointF, new PointF((float)(pointF.X - num2), rectangleF.Bottom), new PointF(rectangleF.Left + num3, rectangleF.Bottom), new PointF(rectangleF.Left, rectangleF.Bottom - num3), new PointF(rectangleF.Left, rectangleF.Top + num3), new PointF(rectangleF.Left + num3, rectangleF.Top), new PointF(rectangleF.Right - num3, rectangleF.Top), new PointF(rectangleF.Right, rectangleF.Top + num3), new PointF(rectangleF.Right, rectangleF.Bottom - num3), new PointF(rectangleF.Right - num3, rectangleF.Bottom), new PointF((float)(pointF.X + num2), rectangleF.Bottom) }; e.Graphics.FillPolygon(fillBrush, points); e.Graphics.DrawPolygon(outlinePen, points); e.Graphics.DrawString(text, pinFont, textBrush, layoutRectangle); }
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); }
private void PaintGraphics(PaintSpecification e, LatLonZoom llz) { this.tilesRequired = 0; this.tilesAvailable = 0; this.asyncRequestGeneration++; if (this.baseLayer == null) { return; } InterestList interestList = this.activeTiles; this.activeTiles = new InterestList(); e.ResetClip(); e.Graphics.FillRectangle(new SolidBrush(Color.LightPink), new Rectangle(new Point(0, 0), e.Size)); List <ViewerControl.PaintKit> list = new List <ViewerControl.PaintKit>(); list.AddRange(this.AssembleLayer(e, llz, this.baseLayer, 0)); int num = 1; foreach (IDisplayableSource current in this.alphaLayers) { list.AddRange(this.AssembleLayer(e, llz, current, num)); num++; } this.activeTiles.Activate(); this.PaintKits(e.Graphics, list); e.ResetClip(); if (this.userRegionViewController != null) { e.ResetClip(); this.userRegionViewController.Paint(e, llz, base.Size); } if (MapDrawingOption.IsEnabled(this.ShowCrosshairs)) { Pen pen = new Pen(Color.Yellow); Pen[] array = new Pen[] { pen, new Pen(Color.Black) { DashStyle = DashStyle.Dash } }; for (int i = 0; i < array.Length; i++) { Pen pen2 = array[i]; e.Graphics.DrawLine(pen2, 0, base.Size.Height / 2, base.Size.Width, base.Size.Height / 2); e.Graphics.DrawLine(pen2, base.Size.Width / 2, 0, base.Size.Width / 2, base.Size.Height); } } if (MapDrawingOption.IsEnabled(this.ShowPushPins) && this.pinList != null) { List <PositionAssociationView> list2 = new List <PositionAssociationView>(); list2.AddRange(this.pinList); list2.Sort(delegate(PositionAssociationView p0, PositionAssociationView p1) { double num2 = p1.position.pinPosition.lat - p0.position.pinPosition.lat; if (num2 != 0.0) { if (num2 <= 0.0) { return(-1); } return(1); } else { double num3 = p1.position.pinPosition.lon - p0.position.pinPosition.lon; if (num3 == 0.0) { return(0); } if (num3 <= 0.0) { return(-1); } return(1); } }); foreach (PositionAssociationView current2 in list2) { this.DrawMarker(current2, e); } } if (interestList != null) { interestList.Dispose(); } if (this.tilesRequired == 0 || this.tilesAvailable == this.tilesRequired) { this.displayProgressBar.Visible = false; return; } this.displayProgressBar.Visible = true; this.displayProgressBar.Minimum = 0; this.displayProgressBar.Maximum = this.tilesRequired; this.displayProgressBar.Value = this.tilesAvailable; }
public void PaintPrintWindow(PaintSpecification e, int extraZoom) { this.PaintGraphics(e, new LatLonZoom(this.center().llz.lat, this.center().llz.lon, this.center().llz.zoom + extraZoom)); }
private void PaintGraphics(PaintSpecification e, LatLonZoom llz) { this.tilesRequired = 0; this.tilesAvailable = 0; this.asyncRequestGeneration++; if (this.baseLayer == null) { return; } InterestList interestList = this.activeTiles; this.activeTiles = new InterestList(); e.ResetClip(); e.Graphics.FillRectangle(new SolidBrush(Color.LightPink), new Rectangle(new Point(0, 0), e.Size)); List<ViewerControl.PaintKit> list = new List<ViewerControl.PaintKit>(); list.AddRange(this.AssembleLayer(e, llz, this.baseLayer, 0)); int num = 1; foreach (IDisplayableSource current in this.alphaLayers) { list.AddRange(this.AssembleLayer(e, llz, current, num)); num++; } this.activeTiles.Activate(); this.PaintKits(e.Graphics, list); e.ResetClip(); if (this.userRegionViewController != null) { e.ResetClip(); this.userRegionViewController.Paint(e, llz, base.Size); } if (MapDrawingOption.IsEnabled(this.ShowCrosshairs)) { Pen pen = new Pen(Color.Yellow); Pen[] array = new Pen[] { pen, new Pen(Color.Black) { DashStyle = DashStyle.Dash } }; for (int i = 0; i < array.Length; i++) { Pen pen2 = array[i]; e.Graphics.DrawLine(pen2, 0, base.Size.Height / 2, base.Size.Width, base.Size.Height / 2); e.Graphics.DrawLine(pen2, base.Size.Width / 2, 0, base.Size.Width / 2, base.Size.Height); } } if (MapDrawingOption.IsEnabled(this.ShowPushPins) && this.pinList != null) { List<PositionAssociationView> list2 = new List<PositionAssociationView>(); list2.AddRange(this.pinList); list2.Sort(delegate(PositionAssociationView p0, PositionAssociationView p1) { double num2 = p1.position.pinPosition.lat - p0.position.pinPosition.lat; if (num2 != 0.0) { if (num2 <= 0.0) { return -1; } return 1; } else { double num3 = p1.position.pinPosition.lon - p0.position.pinPosition.lon; if (num3 == 0.0) { return 0; } if (num3 <= 0.0) { return -1; } return 1; } }); foreach (PositionAssociationView current2 in list2) { this.DrawMarker(current2, e); } } if (interestList != null) { interestList.Dispose(); } if (this.tilesRequired == 0 || this.tilesAvailable == this.tilesRequired) { this.displayProgressBar.Visible = false; return; } this.displayProgressBar.Visible = true; this.displayProgressBar.Minimum = 0; this.displayProgressBar.Maximum = this.tilesRequired; this.displayProgressBar.Value = this.tilesAvailable; }
private void DrawMarker(PositionAssociationView pav, PaintSpecification e) { this.DrawErrorMarkers(pav, e); e.Graphics.CompositingMode = CompositingMode.SourceOver; string text = pav.pinId.ToString(); this.outlinePen.MiterLimit = 2f; SizeF size = new SizeF(3f, 3f); PointF pointF = this.MapPositionToPoint(pav.position.pinPosition.latlon); if (!RectangleF.Inflate(e.ClipRectangle, 100f, 100f).Contains(pointF)) { return; } SizeF sizeF = e.Graphics.MeasureString(text, this.pinFont); double num = 24.0; double num2 = 3.0; int num3 = 3; RectangleF layoutRectangle = new RectangleF(pointF.X - sizeF.Width / 2f, (float)((double)(pointF.Y - sizeF.Height / 2f) - num), sizeF.Width, sizeF.Height); RectangleF rectangleF = new RectangleF(layoutRectangle.Location, layoutRectangle.Size); rectangleF.Inflate(size); PointF[] points = new PointF[] { pointF, new PointF((float)((double)pointF.X - num2), rectangleF.Bottom), new PointF(rectangleF.Left + (float)num3, rectangleF.Bottom), new PointF(rectangleF.Left, rectangleF.Bottom - (float)num3), new PointF(rectangleF.Left, rectangleF.Top + (float)num3), new PointF(rectangleF.Left + (float)num3, rectangleF.Top), new PointF(rectangleF.Right - (float)num3, rectangleF.Top), new PointF(rectangleF.Right, rectangleF.Top + (float)num3), new PointF(rectangleF.Right, rectangleF.Bottom - (float)num3), new PointF(rectangleF.Right - (float)num3, rectangleF.Bottom), new PointF((float)((double)pointF.X + num2), rectangleF.Bottom) }; e.Graphics.FillPolygon(this.fillBrush, points); e.Graphics.DrawPolygon(this.outlinePen, points); e.Graphics.DrawString(text, this.pinFont, this.textBrush, layoutRectangle); }
private void DrawErrorPosition(PositionAssociationView pav, DisplayablePosition.ErrorMarker errorMarker, Pen pen, Brush brush, PaintSpecification e) { ErrorPosition errorPosition = pav.position.GetErrorPosition(errorMarker); if (errorPosition == null) { return; } PointF pointF = this.MapPositionToPoint(pav.position.pinPosition.latlon); PointF pointF2 = this.MapPositionToPoint(errorPosition.latlon); RectangleF rectangleF = new RectangleF((float)(e.ClipRectangle.X - e.ClipRectangle.Width * 2), (float)(e.ClipRectangle.Y - e.ClipRectangle.Height * 2), (float)(e.ClipRectangle.Width * 5), (float)(e.ClipRectangle.Height * 5)); if (!rectangleF.Contains(pointF) || !rectangleF.Contains(pointF2)) { return; } if (!pav.position.invertError) { e.Graphics.DrawLine(pen, pointF, pointF2); e.Graphics.FillEllipse(brush, pointF2.X - 6f, pointF2.Y - 6f, 12f, 12f); return; } e.Graphics.DrawEllipse(pen, pointF.X - 20f, pointF.Y - 20f, 40f, 40f); }
private void DrawErrorMarkers(PositionAssociationView pav, PaintSpecification e) { this.DrawErrorPosition(pav, DisplayablePosition.ErrorMarker.AsContributor, this.errorContribPen, this.errorContribBrush, e); this.DrawErrorPosition(pav, DisplayablePosition.ErrorMarker.AsOutlier, this.errorOutlierPen, this.errorOutlierBrush, e); }
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; }