private Coordinate PointToCoord(int x, int y) { Projection p = new Projection(bounds.Width, this.Width, new Coordinate(bounds.XMin, bounds.YMax)); return p.PointToCoord(new Point(x, y)); }
private int LonToX(double lon) { Projection p = new Projection(bounds.Width, this.Width, new Coordinate(bounds.XMin, bounds.YMax)); Point point = p.CoordToPoint(new Coordinate(lon, 0)); return point.X; //return (int)(this.Width * (lon - bounds.XMin) / bounds.Width); }
private double LonFromX(int x) { Projection p = new Projection(bounds.Width, this.Width, new Coordinate(bounds.XMin, bounds.YMax)); Coordinate c = p.PointToCoord(new Point(x, 0)); return c.Longitude; //return bounds.XMin + bounds.Width * ((double)x / this.Width); }
private double LatFromY(int y) { //Projection p = new Projection(bounds.Height, this.Height); Projection p = new Projection(bounds.Width, this.Width, new Coordinate(bounds.XMin, bounds.YMax)); Coordinate c = p.PointToCoord(new Point(0, y)); return c.Latitude; //return bounds.YMin + bounds.Height * ((double)y / this.Height); }
private Point CoordToPoint(double lon, double lat) { Projection p = new Projection(bounds.Width, this.Width, new Coordinate(bounds.XMin, bounds.YMax)); return p.CoordToPoint(new Coordinate(lon, lat)); }
/// <summary> /// Returns a Point in pixel-coordinates from a Node with /// geological coordinates. The Point is in coordinates for the /// entire map so it should be converted to coordinates for the /// specific tile that is drawn. /// </summary> private Point nodeToTilePoint(BBox box, Bitmap tile, Node node) { Coordinate c = new Coordinate(node.Longitude, node.Latitude); Projection p = new Projection(box.Width, tile.Width, new Coordinate(box.XMin, box.YMax)); return p.CoordToPoint(c); }