public Point GetTranslationInPixels(LatLonZoom center, LatLon point) { Point64 point2 = this.LatLongZoomToPixel(center); Point64 point3 = this.LatLongZoomToPixel(new LatLonZoom(point.lat, point.lon, center.zoom)); return(new Point((int)(point3.X - point2.X), (int)(point3.Y - point2.Y))); }
public LatLonZoom GetTranslationInLatLon(LatLonZoom oldCenterPosition, Point mouseMotion) { return(new LatLonZoom( oldCenterPosition.lat + pixelsToDegrees(mouseMotion.Y, oldCenterPosition.zoom), oldCenterPosition.lon - pixelsToDegrees(mouseMotion.X, oldCenterPosition.zoom), oldCenterPosition.zoom)); }
private LatLonZoom GetUnclippedDraggedView(LatLonZoom centerMapPosition, Point mouseMotion) { Point64 point = this.LatLongZoomToPixel(centerMapPosition); point.X -= (long)mouseMotion.X; point.Y -= (long)mouseMotion.Y; return this.PixelToLatLong(point, centerMapPosition.zoom); }
public static LatLonZoom GetZoomedView(CoordinateSystemIfc coordinateSystem, LatLonZoom oldCenterPosition, int steps) { int num = oldCenterPosition.zoom + steps; num = coordinateSystem.GetZoomRange().Constrain(num); return(new LatLonZoom(oldCenterPosition.lat, oldCenterPosition.lon, num)); }
public static MapRectangle GetBounds(CoordinateSystemIfc coordinateSystem, LatLonZoom center, Size size) { LatLon latlon = coordinateSystem.GetTranslationInLatLon(center, new Point(size.Width / 2, size.Height / 2)).latlon; LatLon latlon2 = coordinateSystem.GetTranslationInLatLon(center, new Point(-size.Width / 2, -size.Height / 2)).latlon; return(new MapRectangle(latlon, latlon2)); }
public LatLonZoom GetTranslationInLatLon(LatLonZoom centerMapPosition, Point mouseMotion) { LatLonZoom unclippedDraggedView = GetUnclippedDraggedView(centerMapPosition, mouseMotion); if (unclippedDraggedView.lon > 180.0) { unclippedDraggedView = new LatLonZoom(unclippedDraggedView.lat, unclippedDraggedView.lon - 360.0, unclippedDraggedView.zoom); } if (unclippedDraggedView.lon < -180.0) { unclippedDraggedView = new LatLonZoom(unclippedDraggedView.lat, unclippedDraggedView.lon + 360.0, unclippedDraggedView.zoom); } if (unclippedDraggedView.lat > 85.0) { unclippedDraggedView = new LatLonZoom(85.0, unclippedDraggedView.lon, unclippedDraggedView.zoom); } if (unclippedDraggedView.lat < -85.0) { unclippedDraggedView = new LatLonZoom(-85.0, unclippedDraggedView.lon, unclippedDraggedView.zoom); } return(unclippedDraggedView); }
public TileDisplayDescriptorArray GetTileArrayDescriptor(LatLonZoom center, Size windowSize) { TileDisplayDescriptorArray tileDisplayDescriptorArray = new TileDisplayDescriptorArray(); MapRectangle mapWindow = this.GetMapWindow(center, windowSize); tileDisplayDescriptorArray.topLeftTile = this.GetTileContainingLatLonZoom(new LatLonZoom(mapWindow.GetNW(), center.zoom)); TileAddress tileContainingLatLonZoom = this.GetTileContainingLatLonZoom(new LatLonZoom(mapWindow.GetSE(), center.zoom)); tileDisplayDescriptorArray.tileCountX = tileContainingLatLonZoom.TileX - tileDisplayDescriptorArray.topLeftTile.TileX + 1; tileDisplayDescriptorArray.tileCountY = tileContainingLatLonZoom.TileY - tileDisplayDescriptorArray.topLeftTile.TileY + 1; int x = this.GetTranslationInPixels(center, this.GetLatLonOfTileNW(tileDisplayDescriptorArray.topLeftTile)).X; int x2 = this.GetTranslationInPixels(center, this.GetLatLonOfTileNW(new TileAddress(tileDisplayDescriptorArray.topLeftTile.TileX + tileDisplayDescriptorArray.tileCountX, tileDisplayDescriptorArray.topLeftTile.TileY, tileDisplayDescriptorArray.topLeftTile.ZoomLevel))).X; int num = x2 - x; int num2 = windowSize.Width + 512; if (num > num2) { D.Sayf(0, "break", new object[0]); } tileDisplayDescriptorArray.layout = this.addressLayout; tileDisplayDescriptorArray.tileSize = this.GetTileSize(); Point64 point = this.LatLongZoomToPixel(new LatLonZoom(mapWindow.GetNW(), center.zoom)); tileDisplayDescriptorArray.topLeftTileOffset = new Point64((long)tileDisplayDescriptorArray.topLeftTile.TileX * 256L - point.X, (long)tileDisplayDescriptorArray.topLeftTile.TileY * 256L - point.Y).ToPoint(); tileDisplayDescriptorArray.topLeftTile.TileX = VEAddressLayout.WrapLongitude(tileDisplayDescriptorArray.topLeftTile.TileX, tileDisplayDescriptorArray.topLeftTile.ZoomLevel); return(tileDisplayDescriptorArray); }
public MapRectangle GetUnclippedMapWindow(LatLonZoom centerPosition, Size windowSize) { return(new MapRectangle( GetTranslationInLatLon(centerPosition, new Point(windowSize.Width / 2, windowSize.Height / 2)) .latlon, GetTranslationInLatLon(centerPosition, new Point(-(windowSize.Width / 2 + 1), -(windowSize.Height / 2 + 1))).latlon)); }
private Point64 LatLongZoomToPixel(LatLonZoom p) { double num = Math.Sin(CoordinateSystemUtilities.DegreesToRadians(p.lat)); double num2 = 6378137.0 * CoordinateSystemUtilities.DegreesToRadians(p.lon); double num3 = 3189068.5 * Math.Log((1.0 + num) / (1.0 - num)); double num4 = this.MetersPerPixel(p.zoom); return new Point64((long)Math.Round((20037508.342789244 + num2) / num4), (long)Math.Round((20037508.342789244 - num3) / num4)); }
private TileAddress GetTileContainingLatLonZoom(LatLonZoom llz) { Point64 point = LatLongZoomToPixel(llz); return(new TileAddress((int)Math.Floor(point.X / 256.0), (int)Math.Floor(point.Y / 256.0), llz.zoom)); }
private LatLonZoom GetUnclippedDraggedView(LatLonZoom centerMapPosition, Point mouseMotion) { Point64 point = this.LatLongZoomToPixel(centerMapPosition); point.X -= (long)mouseMotion.X; point.Y -= (long)mouseMotion.Y; return(this.PixelToLatLong(point, centerMapPosition.zoom)); }
private MapRectangle GetMapWindow(LatLonZoom centerPosition, Size windowSize) { return(new MapRectangle( GetUnclippedDraggedView(centerPosition, new Point(windowSize.Width / 2, windowSize.Height / 2)) .latlon, GetUnclippedDraggedView(centerPosition, new Point(-(windowSize.Width / 2 + 1), -(windowSize.Height / 2 + 1))).latlon)); }
private Point64 LatLongZoomToPixel(LatLonZoom p) { double num = Math.Sin(CoordinateSystemUtilities.DegreesToRadians(p.lat)); double num2 = 6378137.0 * CoordinateSystemUtilities.DegreesToRadians(p.lon); double num3 = 3189068.5 * Math.Log((1.0 + num) / (1.0 - num)); double num4 = this.MetersPerPixel(p.zoom); return(new Point64((long)Math.Round((20037508.342789244 + num2) / num4), (long)Math.Round((20037508.342789244 - num3) / num4))); }
private TileAddress GetTileContainingLatLonZoom(LatLonZoom llz) { Point64 point = new Point64(degreesToPixels(llz.lon, llz.zoom), degreesToPixels(llz.lat, llz.zoom)); return(new TileAddress((int)Math.Floor(point.X / 512.0), (int)Math.Floor(point.Y / 512.0), llz.zoom)); }
public TileDisplayDescriptorArray GetTileArrayDescriptor(LatLonZoom center, Size windowSize) { TileDisplayDescriptorArray tileDisplayDescriptorArray = new TileDisplayDescriptorArray(); MapRectangle unclippedMapWindow = this.GetUnclippedMapWindow(center, windowSize); tileDisplayDescriptorArray.topLeftTile = this.GetTileContainingLatLonZoom(new LatLonZoom(unclippedMapWindow.GetNW(), center.zoom)); TileAddress tileContainingLatLonZoom = this.GetTileContainingLatLonZoom(new LatLonZoom(unclippedMapWindow.GetSE(), center.zoom)); tileDisplayDescriptorArray.tileCountX = tileContainingLatLonZoom.TileX - tileDisplayDescriptorArray.topLeftTile.TileX + 1; tileDisplayDescriptorArray.tileCountY = -(tileContainingLatLonZoom.TileY - tileDisplayDescriptorArray.topLeftTile.TileY) + 1; Point64 point = new Point64(this.degreesToPixels(unclippedMapWindow.GetNW().lon, center.zoom), this.degreesToPixels(unclippedMapWindow.GetNW().lat, center.zoom)); tileDisplayDescriptorArray.topLeftTileOffset = new Point((int)((long)(tileDisplayDescriptorArray.topLeftTile.TileX * 512) - point.X), (int)(point.Y - (long)((tileDisplayDescriptorArray.topLeftTile.TileY + 1) * 512))); tileDisplayDescriptorArray.layout = this.addressLayout; tileDisplayDescriptorArray.tileSize = this.GetTileSize(); return tileDisplayDescriptorArray; }
public TileDisplayDescriptorArray GetTileArrayDescriptor(LatLonZoom center, Size windowSize) { TileDisplayDescriptorArray tileDisplayDescriptorArray = new TileDisplayDescriptorArray(); MapRectangle unclippedMapWindow = this.GetUnclippedMapWindow(center, windowSize); tileDisplayDescriptorArray.topLeftTile = this.GetTileContainingLatLonZoom(new LatLonZoom(unclippedMapWindow.GetNW(), center.zoom)); TileAddress tileContainingLatLonZoom = this.GetTileContainingLatLonZoom(new LatLonZoom(unclippedMapWindow.GetSE(), center.zoom)); tileDisplayDescriptorArray.tileCountX = tileContainingLatLonZoom.TileX - tileDisplayDescriptorArray.topLeftTile.TileX + 1; tileDisplayDescriptorArray.tileCountY = -(tileContainingLatLonZoom.TileY - tileDisplayDescriptorArray.topLeftTile.TileY) + 1; Point64 point = new Point64(this.degreesToPixels(unclippedMapWindow.GetNW().lon, center.zoom), this.degreesToPixels(unclippedMapWindow.GetNW().lat, center.zoom)); tileDisplayDescriptorArray.topLeftTileOffset = new Point((int)((long)(tileDisplayDescriptorArray.topLeftTile.TileX * 512) - point.X), (int)(point.Y - (long)((tileDisplayDescriptorArray.topLeftTile.TileY + 1) * 512))); tileDisplayDescriptorArray.layout = this.addressLayout; tileDisplayDescriptorArray.tileSize = this.GetTileSize(); return(tileDisplayDescriptorArray); }
public LatLonZoom GetBestViewContaining(MapRectangle newBounds, Size size) { LatLon center = newBounds.GetCenter(); int i; for (i = this.ZoomRange.max; i >= this.ZoomRange.min; i--) { LatLonZoom p = new LatLonZoom(newBounds.lat0, newBounds.lon0, i); LatLonZoom p2 = new LatLonZoom(newBounds.lat1, newBounds.lon1, i); Point64 point = this.LatLongZoomToPixel(p); Point64 point2 = this.LatLongZoomToPixel(p2); if (point.Y - point2.Y < (long)size.Height) { break; } } return(new LatLonZoom(center.lat, center.lon, i)); }
public LatLonZoom GetTranslationInLatLon(LatLonZoom centerMapPosition, Point mouseMotion) { LatLonZoom unclippedDraggedView = this.GetUnclippedDraggedView(centerMapPosition, mouseMotion); if (unclippedDraggedView.lon > 180.0) { unclippedDraggedView = new LatLonZoom(unclippedDraggedView.lat, unclippedDraggedView.lon - 360.0, unclippedDraggedView.zoom); } if (unclippedDraggedView.lon < -180.0) { unclippedDraggedView = new LatLonZoom(unclippedDraggedView.lat, unclippedDraggedView.lon + 360.0, unclippedDraggedView.zoom); } if (unclippedDraggedView.lat > 85.0) { unclippedDraggedView = new LatLonZoom(85.0, unclippedDraggedView.lon, unclippedDraggedView.zoom); } if (unclippedDraggedView.lat < -85.0) { unclippedDraggedView = new LatLonZoom(-85.0, unclippedDraggedView.lon, unclippedDraggedView.zoom); } return unclippedDraggedView; }
public RenderBounds MakeRenderBounds(MapRectangle imageBounds) { RenderBounds renderBounds = new RenderBounds(); renderBounds.MinZoom = this.ZoomRange.min; renderBounds.MaxZoom = this.ZoomRange.max; renderBounds.TileSize = this.GetTileSize(); renderBounds.imageBounds = imageBounds; renderBounds.tileRectangle = new TileRectangle[renderBounds.MaxZoom + 1]; for (int i = renderBounds.MinZoom; i <= renderBounds.MaxZoom; i++) { renderBounds.tileRectangle[i] = new TileRectangle(); renderBounds.tileRectangle[i].zoom = i; LatLonZoom llz = new LatLonZoom(imageBounds.GetNW().lat, imageBounds.GetNW().lon, i); renderBounds.tileRectangle[i].TopLeft = this.GetTileContainingLatLonZoom(llz); llz = new LatLonZoom(imageBounds.GetSE().lat, imageBounds.GetSE().lon, i); renderBounds.tileRectangle[i].BottomRight = this.GetTileContainingLatLonZoom(llz); renderBounds.tileRectangle[i].StrideX = 1; renderBounds.tileRectangle[i].StrideY = 1; } return(renderBounds); }
public Point GetTranslationInPixels(LatLonZoom center, LatLon point) { return new Point((int)this.degreesToPixels(point.lon - center.lon, center.zoom), (int)this.degreesToPixels(center.lat - point.lat, center.zoom)); }
public LatLonZoom GetBestViewContaining(MapRectangle newBounds, Size size) { LatLon center = newBounds.GetCenter(); int i; for (i = this.ZoomRange.max; i >= this.ZoomRange.min; i--) { LatLonZoom p = new LatLonZoom(newBounds.lat0, newBounds.lon0, i); LatLonZoom p2 = new LatLonZoom(newBounds.lat1, newBounds.lon1, i); Point64 point = this.LatLongZoomToPixel(p); Point64 point2 = this.LatLongZoomToPixel(p2); if (point.Y - point2.Y < (long)size.Height) { break; } } return new LatLonZoom(center.lat, center.lon, i); }
public LatLonZoom GetTranslationInLatLon(LatLonZoom oldCenterPosition, Point mouseMotion) { return new LatLonZoom(oldCenterPosition.lat + this.pixelsToDegrees((long)mouseMotion.Y, oldCenterPosition.zoom), oldCenterPosition.lon - this.pixelsToDegrees((long)mouseMotion.X, oldCenterPosition.zoom), oldCenterPosition.zoom); }
public DefaultReferenceView(LatLonZoom llz) { present = true; this.llz = llz; }
public Point GetTranslationInPixels(LatLonZoom center, LatLon point) { Point64 point2 = this.LatLongZoomToPixel(center); Point64 point3 = this.LatLongZoomToPixel(new LatLonZoom(point.lat, point.lon, center.zoom)); return new Point((int)(point3.X - point2.X), (int)(point3.Y - point2.Y)); }
public void PositionUpdated(LatLonZoom llz) { PositionUpdated(); }
internal static LatLonZoom ConstrainLLZ(CoordinateSystemIfc coordSys, LatLonZoom src) { return new LatLonZoom(coordSys.GetLatRange().Constrain(src.lat), coordSys.GetLonRange().Constrain(src.lon), coordSys.GetZoomRange().Constrain(src.zoom)); }
public TileDisplayDescriptorArray GetTileArrayDescriptor(LatLonZoom center, Size windowSize) { TileDisplayDescriptorArray tileDisplayDescriptorArray = new TileDisplayDescriptorArray(); MapRectangle mapWindow = this.GetMapWindow(center, windowSize); tileDisplayDescriptorArray.topLeftTile = this.GetTileContainingLatLonZoom(new LatLonZoom(mapWindow.GetNW(), center.zoom)); TileAddress tileContainingLatLonZoom = this.GetTileContainingLatLonZoom(new LatLonZoom(mapWindow.GetSE(), center.zoom)); tileDisplayDescriptorArray.tileCountX = tileContainingLatLonZoom.TileX - tileDisplayDescriptorArray.topLeftTile.TileX + 1; tileDisplayDescriptorArray.tileCountY = tileContainingLatLonZoom.TileY - tileDisplayDescriptorArray.topLeftTile.TileY + 1; int x = this.GetTranslationInPixels(center, this.GetLatLonOfTileNW(tileDisplayDescriptorArray.topLeftTile)).X; int x2 = this.GetTranslationInPixels(center, this.GetLatLonOfTileNW(new TileAddress(tileDisplayDescriptorArray.topLeftTile.TileX + tileDisplayDescriptorArray.tileCountX, tileDisplayDescriptorArray.topLeftTile.TileY, tileDisplayDescriptorArray.topLeftTile.ZoomLevel))).X; int num = x2 - x; int num2 = windowSize.Width + 512; if (num > num2) { D.Sayf(0, "break", new object[0]); } tileDisplayDescriptorArray.layout = this.addressLayout; tileDisplayDescriptorArray.tileSize = this.GetTileSize(); Point64 point = this.LatLongZoomToPixel(new LatLonZoom(mapWindow.GetNW(), center.zoom)); tileDisplayDescriptorArray.topLeftTileOffset = new Point64((long)tileDisplayDescriptorArray.topLeftTile.TileX * 256L - point.X, (long)tileDisplayDescriptorArray.topLeftTile.TileY * 256L - point.Y).ToPoint(); tileDisplayDescriptorArray.topLeftTile.TileX = VEAddressLayout.WrapLongitude(tileDisplayDescriptorArray.topLeftTile.TileX, tileDisplayDescriptorArray.topLeftTile.ZoomLevel); return tileDisplayDescriptorArray; }
public RenderBounds MakeRenderBounds(MapRectangle imageBounds) { RenderBounds renderBounds = new RenderBounds(); renderBounds.MinZoom = this.ZoomRange.min; renderBounds.MaxZoom = this.ZoomRange.max; renderBounds.TileSize = this.GetTileSize(); renderBounds.imageBounds = imageBounds; renderBounds.tileRectangle = new TileRectangle[renderBounds.MaxZoom + 1]; for (int i = renderBounds.MinZoom; i <= renderBounds.MaxZoom; i++) { renderBounds.tileRectangle[i] = new TileRectangle(); renderBounds.tileRectangle[i].zoom = i; LatLonZoom llz = new LatLonZoom(imageBounds.GetNW().lat, imageBounds.GetNW().lon, i); renderBounds.tileRectangle[i].TopLeft = this.GetTileContainingLatLonZoom(llz); llz = new LatLonZoom(imageBounds.GetSE().lat, imageBounds.GetSE().lon, i); renderBounds.tileRectangle[i].BottomRight = this.GetTileContainingLatLonZoom(llz); renderBounds.tileRectangle[i].StrideX = 1; renderBounds.tileRectangle[i].StrideY = 1; } return renderBounds; }
private TileAddress GetTileContainingLatLonZoom(LatLonZoom llz) { Point64 point = this.LatLongZoomToPixel(llz); return new TileAddress((int)Math.Floor((double)point.X / 256.0), (int)Math.Floor((double)point.Y / 256.0), llz.zoom); }
private MapRectangle GetMapWindow(LatLonZoom centerPosition, Size windowSize) { return new MapRectangle(this.GetUnclippedDraggedView(centerPosition, new Point(windowSize.Width / 2, windowSize.Height / 2)).latlon, this.GetUnclippedDraggedView(centerPosition, new Point(-(windowSize.Width / 2 + 1), -(windowSize.Height / 2 + 1))).latlon); }
public static LatLonZoom GetZoomedView(CoordinateSystemIfc coordinateSystem, LatLonZoom oldCenterPosition, int steps) { int num = oldCenterPosition.zoom + steps; num = coordinateSystem.GetZoomRange().Constrain(num); return new LatLonZoom(oldCenterPosition.lat, oldCenterPosition.lon, num); }
public LatLonZoom GetDefaultView() { return(LatLonZoom.World()); }
public static MapRectangle GetBounds(CoordinateSystemIfc coordinateSystem, LatLonZoom center, Size size) { LatLon latlon = coordinateSystem.GetTranslationInLatLon(center, new Point(size.Width / 2, size.Height / 2)).latlon; LatLon latlon2 = coordinateSystem.GetTranslationInLatLon(center, new Point(-size.Width / 2, -size.Height / 2)).latlon; return new MapRectangle(latlon, latlon2); }
private TileAddress GetTileContainingLatLonZoom(LatLonZoom llz) { Point64 point = new Point64(this.degreesToPixels(llz.lon, llz.zoom), this.degreesToPixels(llz.lat, llz.zoom)); return new TileAddress((int)Math.Floor((double)point.X / 512.0), (int)Math.Floor((double)point.Y / 512.0), llz.zoom); }
public Point GetTranslationInPixels(LatLonZoom center, LatLon point) { return(new Point((int)degreesToPixels(point.lon - center.lon, center.zoom), (int)degreesToPixels(center.lat - point.lat, center.zoom))); }
public MapRectangle GetUnclippedMapWindow(LatLonZoom centerPosition, Size windowSize) { return new MapRectangle(this.GetTranslationInLatLon(centerPosition, new Point(windowSize.Width / 2, windowSize.Height / 2)).latlon, this.GetTranslationInLatLon(centerPosition, new Point(-(windowSize.Width / 2 + 1), -(windowSize.Height / 2 + 1))).latlon); }
public void Record(LatLonZoom llz) { smvm.RecordSource(llz); }
public void Record(LatLonZoom llz) { smvm.RecordRef(llz); }
internal static LatLonZoom ConstrainLLZ(CoordinateSystemIfc coordSys, LatLonZoom src) { return(new LatLonZoom(coordSys.GetLatRange().Constrain(src.lat), coordSys.GetLonRange().Constrain(src.lon), coordSys.GetZoomRange().Constrain(src.zoom))); }