public override latlong_area_class calc_latlong_area_by_tile(latlong_class latlong, tile_class tile, double zoom, int resolution, Vector2 bresolution, Vector2 offset) { float num = Mathf.Pow((float)2, (float)((double)19 - zoom)); zoom = (double)19; resolution = (int)((float)resolution * num); bresolution *= num; latlong_area_class latlong_area_class = new latlong_area_class(); map_pixel_class map_pixel_class = this.latlong_to_pixel2(latlong, zoom); Vector2 vector = new Vector2((float)0, (float)0); map_pixel_class.x += (double)((float)(tile.x * resolution) + offset.x); map_pixel_class.y += (double)((float)(tile.y * resolution) + offset.y); if (tile.x > 0) { map_pixel_class.x += (double)num; vector.x = num; } if (tile.y > 0) { map_pixel_class.y += (double)num; vector.y = num; } latlong_class latlong_class = this.pixel_to_latlong2(map_pixel_class, zoom); latlong_area_class.latlong1 = latlong_class; map_pixel_class.x += (double)(bresolution.x - vector.x); map_pixel_class.y += (double)(bresolution.y - vector.y); latlong_class = this.pixel_to_latlong2(map_pixel_class, zoom); latlong_area_class.latlong2 = latlong_class; return(latlong_area_class); }
public override double calc_latlong_area_resolution(latlong_class latlong, double zoom) { double num = (double)3.14159274f; map_pixel_class map_pixel_class = this.latlong_to_pixel2(latlong, zoom); return((double)(156543.047f * Mathf.Cos((float)(latlong.latitude * (num / (double)180))) / Mathf.Pow((float)2, (float)zoom))); }
static public latlong_area_class calc_latlong_area_by_tile(latlong_class latlong, tile_class tile, double zoom, int resolution, Vector2 bresolution, Vector2 offset) { float num = Mathf.Pow(2, (float)(19 - zoom)); zoom = 19; resolution = (int)(resolution * num); bresolution *= num; latlong_area_class latlong_area_class = new latlong_area_class(); map_pixel_class map_pixel_class = latlong_to_pixel2(latlong, zoom); Vector2 vector = new Vector2(0, 0); map_pixel_class.x += tile.x * resolution + offset.x; map_pixel_class.y += tile.y * resolution + offset.y; if (tile.x > 0) { map_pixel_class.x += num; vector.x = num; } if (tile.y > 0) { map_pixel_class.y += num; vector.y = num; } latlong_class latlong_class = pixel_to_latlong2(map_pixel_class, zoom); latlong_area_class.latlong1 = latlong_class; map_pixel_class.x += bresolution.x - vector.x; map_pixel_class.y += bresolution.y - vector.y; latlong_class = pixel_to_latlong2(map_pixel_class, zoom); latlong_area_class.latlong2 = latlong_class; return(latlong_area_class); }
public override latlong_class calc_mercator_to_latlong(map_pixel_class pixel) { latlong_class latlong_class = new latlong_class(); latlong_class.longitude = pixel.x / (double)20037508f * (double)180; latlong_class.latitude = pixel.y / (double)20037508f * (double)180; latlong_class.latitude = (double)(57.2957764f * ((float)2 * Mathf.Atan(Mathf.Exp((float)(latlong_class.latitude * (double)3.14159274f / (double)180))) - 1.57079637f)); return(latlong_class); }
static public map_pixel_class calc_latlong_to_mercator(latlong_class latlong) { map_pixel_class map_pixel_class = new map_pixel_class(); map_pixel_class.x = latlong.latitude * 20037508f / 180; map_pixel_class.y = Mathf.Log(Mathf.Tan((float)((90 + latlong.longitude) * 3.14159274f / 360))) / 0.0174532924f; map_pixel_class.y = map_pixel_class.y * 20037508f / 180; return(map_pixel_class); }
public override map_pixel_class calc_latlong_to_mercator(latlong_class latlong) { map_pixel_class map_pixel_class = new map_pixel_class(); map_pixel_class.x = latlong.latitude * (double)20037508f / (double)180; map_pixel_class.y = (double)(Mathf.Log(Mathf.Tan((float)(((double)90 + latlong.longitude) * (double)3.14159274f / (double)360))) / 0.0174532924f); map_pixel_class.y = map_pixel_class.y * (double)20037508f / (double)180; return(map_pixel_class); }
static public latlong_class calc_mercator_to_latlong(map_pixel_class pixel) { latlong_class latlong_class = new latlong_class(); latlong_class.longitude = pixel.x / 20037508f * 180; latlong_class.latitude = pixel.y / 20037508f * 180; latlong_class.latitude = 57.2957764f * (2 * Mathf.Atan(Mathf.Exp((float)(latlong_class.latitude * 3.14159274f / 180))) - 1.57079637f); return(latlong_class); }
static public tile_class calc_latlong_area_tiles(latlong_class latlong1, latlong_class latlong2, double zoom, int resolution) { tile_class tile_class = new tile_class(); map_pixel_class map_pixel_class = latlong_to_pixel2(latlong1, zoom); map_pixel_class map_pixel_class2 = latlong_to_pixel2(latlong2, zoom); tile_class.x = (int)Mathf.Round((float)((map_pixel_class2.x - map_pixel_class.x) / resolution)); tile_class.y = (int)Mathf.Round((float)((map_pixel_class2.y - map_pixel_class.y) / resolution)); return(tile_class); }
public override latlong_class calc_latlong_center(latlong_class latlong1, latlong_class latlong2, double zoom, Vector2 screen_resolution) { map_pixel_class map_pixel_class = this.latlong_to_pixel2(latlong1, zoom); map_pixel_class map_pixel_class2 = this.latlong_to_pixel2(latlong2, zoom); return(this.pixel_to_latlong2(new map_pixel_class { x = (map_pixel_class.x + map_pixel_class2.x) / (double)2, y = (map_pixel_class.y + map_pixel_class2.y) / (double)2 }, zoom)); }
static public latlong_class calc_latlong_center(latlong_class latlong1, latlong_class latlong2, double zoom, Vector2 screen_resolution) { map_pixel_class map_pixel_class = latlong_to_pixel2(latlong1, zoom); map_pixel_class map_pixel_class2 = latlong_to_pixel2(latlong2, zoom); return(pixel_to_latlong2(new map_pixel_class { x = (map_pixel_class.x + map_pixel_class2.x) / 2, y = (map_pixel_class.y + map_pixel_class2.y) / 2 }, zoom)); }
public override map_pixel_class calc_latlong_area_size(latlong_class latlong1, latlong_class latlong2, latlong_class latlong_center) { double num = (double)3.14159274f; map_pixel_class map_pixel_class = this.latlong_to_pixel2(latlong1, (double)19); map_pixel_class map_pixel_class2 = this.latlong_to_pixel2(latlong2, (double)19); double num2 = (double)(156543.047f * Mathf.Cos((float)(latlong_center.latitude * (num / (double)180))) / Mathf.Pow((float)2, (float)19)); return(new map_pixel_class { x = (map_pixel_class2.x - map_pixel_class.x) * num2, y = (map_pixel_class2.y - map_pixel_class.y) * num2 }); }
static public map_pixel_class calc_latlong_area_size(latlong_class latlong1, latlong_class latlong2, latlong_class latlong_center) { double num = 3.14159274f; map_pixel_class map_pixel_class = latlong_to_pixel2(latlong1, 19); map_pixel_class map_pixel_class2 = latlong_to_pixel2(latlong2, 19); double num2 = 156543.047f * Mathf.Cos((float)(latlong_center.latitude * (num / 180))) / Mathf.Pow(2, 19); return(new map_pixel_class { x = (map_pixel_class2.x - map_pixel_class.x) * num2, y = (map_pixel_class2.y - map_pixel_class.y) * num2 }); }
static public latlong_class pixel_to_latlong2(map_pixel_class map_pixel, double zoom) { map_pixel = clip_pixel(map_pixel, zoom); double num = 3.14159274f; double num2 = 256f * Mathf.Pow(2f, (float)zoom); double num3 = map_pixel.x / num2 - 0.5f; double num4 = 0.5f - map_pixel.y / num2; return(new latlong_class { latitude = 90f - 360f * Mathf.Atan(Mathf.Exp((float)(-(float)num4 * (double)2f * num))) / num, longitude = 360f * num3 }); }
static public latlong_class calc_latlong_center_by_tile(latlong_class latlong, tile_class tile, tile_class subtile, tile_class subtiles, double zoom, int resolution, Vector2 offset) { float num = Mathf.Pow(2, (float)(19 - zoom)); zoom = 19; resolution = (int)(resolution * num); map_pixel_class map_pixel_class = latlong_to_pixel2(latlong, zoom); map_pixel_class.x += tile.x * subtiles.x * resolution + subtile.x * resolution; map_pixel_class.y += tile.y * subtiles.y * resolution + subtile.y * resolution; map_pixel_class.x += resolution / 2 + offset.x; map_pixel_class.y += resolution / 2 + offset.y; return(pixel_to_latlong2(map_pixel_class, zoom)); }
public override latlong_class pixel_to_latlong2(map_pixel_class map_pixel, double zoom) { map_pixel = this.clip_pixel(map_pixel, zoom); double num = (double)3.14159274f; double num2 = (double)(256f * Mathf.Pow(2f, (float)zoom)); double num3 = map_pixel.x / num2 - (double)0.5f; double num4 = (double)0.5f - map_pixel.y / num2; return(new latlong_class { latitude = (double)90f - (double)(360f * Mathf.Atan(Mathf.Exp((float)(-(float)num4 * (double)2f * num)))) / num, longitude = (double)360f * num3 }); }
void GetLatLong(Vector3 pos, out double latitude, out double longitude) { map_pixel_class map_pixel = new map_pixel_class(); map_pixel_class map_pixel_center = latlong_to_pixel2(latlong_center, 19); double map_resolution = calc_latlong_area_resolution(latlong_center, 19); map_pixel.x = ((pos.x - offset.x) / map_resolution) + map_pixel_center.x; map_pixel.y = (-(pos.z - offset.y) / map_resolution) + map_pixel_center.y; latlong_class returnVal = pixel_to_latlong2(map_pixel, 19); latitude = returnVal.latitude; longitude = returnVal.longitude; }
public override latlong_class calc_latlong_center_by_tile(latlong_class latlong, tile_class tile, tile_class subtile, tile_class subtiles, double zoom, int resolution, Vector2 offset) { float num = Mathf.Pow((float)2, (float)((double)19 - zoom)); zoom = (double)19; resolution = (int)((float)resolution * num); latlong_class latlong_class = new latlong_class(); map_pixel_class map_pixel_class = this.latlong_to_pixel2(latlong, zoom); map_pixel_class.x += (double)(tile.x * subtiles.x * resolution + subtile.x * resolution); map_pixel_class.y += (double)(tile.y * subtiles.y * resolution + subtile.y * resolution); map_pixel_class.x += (double)((float)(resolution / 2) + offset.x); map_pixel_class.y += (double)((float)(resolution / 2) + offset.y); return(this.pixel_to_latlong2(map_pixel_class, zoom)); }
static public latlong_area_class calc_latlong_area_by_tile2(latlong_class latlong, tile_class tile, double zoom, int resolution, Vector2 bresolution) { latlong_area_class latlong_area_class = new latlong_area_class(); map_pixel_class map_pixel_class = latlong_to_pixel2(latlong, zoom); map_pixel_class.x += tile.x * resolution; map_pixel_class.y += tile.y * resolution; latlong_class latlong_class = pixel_to_latlong2(map_pixel_class, zoom); latlong_area_class.latlong1 = latlong_class; map_pixel_class.x += bresolution.x; map_pixel_class.y += bresolution.y; latlong_class = pixel_to_latlong2(map_pixel_class, zoom); latlong_area_class.latlong2 = latlong_class; return(latlong_area_class); }
public override latlong_area_class calc_latlong_area_by_tile2(latlong_class latlong, tile_class tile, double zoom, int resolution, Vector2 bresolution) { latlong_area_class latlong_area_class = new latlong_area_class(); map_pixel_class map_pixel_class = this.latlong_to_pixel2(latlong, zoom); Vector2 vector = new Vector2((float)0, (float)0); map_pixel_class.x += (double)(tile.x * resolution); map_pixel_class.y += (double)(tile.y * resolution); latlong_class latlong_class = this.pixel_to_latlong2(map_pixel_class, zoom); latlong_area_class.latlong1 = latlong_class; map_pixel_class.x += (double)bresolution.x; map_pixel_class.y += (double)bresolution.y; latlong_class = this.pixel_to_latlong2(map_pixel_class, zoom); latlong_area_class.latlong2 = latlong_class; return(latlong_area_class); }
public override void calc_latlong_area_from_center(map_area_class area, latlong_class center, double zoom, Vector2 resolution) { map_pixel_class map_pixel_class = this.latlong_to_pixel2(area.center, zoom); map_pixel_class map_pixel_class2 = this.latlong_to_pixel2(center, zoom); map_pixel_class map_pixel_class3 = this.latlong_to_pixel2(area.upper_left, zoom); map_pixel_class map_pixel_class4 = this.latlong_to_pixel2(area.lower_right, zoom); map_pixel_class map_pixel_class5 = new map_pixel_class(); map_pixel_class5.x = map_pixel_class2.x - map_pixel_class.x; map_pixel_class5.y = map_pixel_class2.y - map_pixel_class.y; map_pixel_class3.x += map_pixel_class5.x; map_pixel_class3.y += map_pixel_class5.y; map_pixel_class4.x = map_pixel_class3.x + (double)resolution.x; map_pixel_class4.y = map_pixel_class3.y + (double)resolution.y; area.upper_left = this.pixel_to_latlong2(map_pixel_class3, zoom); area.lower_right = this.pixel_to_latlong2(map_pixel_class4, zoom); area.center = center; }
public override latlong_class pixel_to_latlong(Vector2 offset, latlong_class latlong_center, double zoom) { double num = (double)3.14159274f; double num2 = (double)((float)256 * Mathf.Pow((float)2, (float)zoom)); map_pixel_class map_pixel_class = this.latlong_to_pixel2(latlong_center, zoom); map_pixel_class map_pixel_class2 = new map_pixel_class(); map_pixel_class2.x = map_pixel_class.x + (double)offset.x; map_pixel_class2.y = map_pixel_class.y + (double)offset.y; double num3 = map_pixel_class2.x / num2 - (double)0.5f; double num4 = (double)0.5f - map_pixel_class2.y / num2; return(this.clip_latlong(new latlong_class { latitude = (double)90 - (double)((float)360 * Mathf.Atan(Mathf.Exp((float)(-(float)num4 * (double)2 * num)))) / num, longitude = (double)360 * num3 })); }
static public latlong_class pixel_to_latlong(Vector2 offset, latlong_class latlong_center, double zoom) { double num = 3.14159274f; double num2 = 256 * Mathf.Pow(2, (float)zoom); map_pixel_class map_pixel_class = latlong_to_pixel2(latlong_center, zoom); map_pixel_class map_pixel_class2 = new map_pixel_class(); map_pixel_class2.x = map_pixel_class.x + offset.x; map_pixel_class2.y = map_pixel_class.y + offset.y; double num3 = map_pixel_class2.x / num2 - 0.5f; double num4 = 0.5f - map_pixel_class2.y / num2; return(clip_latlong(new latlong_class { latitude = 90 - 360 * Mathf.Atan(Mathf.Exp((float)(-(float)num4 * (double)2 * num))) / num, longitude = 360 * num3 })); }
public latlong_class pixel_to_latlong2(map_pixel_class map_pixel, double zoom) { map_pixel = clip_pixel(map_pixel, zoom); double pi = 3.14159265358979323846264338327950288419716939937510; double mapSize = 256.0f * Mathf.Pow(2.0f, (float)zoom); double x = (map_pixel.x / mapSize) - 0.5; double y = 0.5 - (map_pixel.y / mapSize); latlong_class latlong = new latlong_class(); latlong.latitude = 90.0 - 360.0 * Mathf.Atan(Mathf.Exp((float)(-y * 2.0 * pi))) / pi; latlong.longitude = 360.0 * x; return(latlong); }
static public void calc_latlong2_area_from_center(map_area_class area, latlong_class center, double zoom) { map_pixel_class map_pixel_class = latlong_to_pixel2(area.lower_right, zoom); map_pixel_class map_pixel_class2 = latlong_to_pixel2(center, zoom); map_pixel_class map_pixel_class3 = latlong_to_pixel2(area.center, zoom); map_pixel_class map_pixel_class4 = latlong_to_pixel2(area.upper_left, zoom); map_pixel_class map_pixel_class5 = new map_pixel_class(); map_pixel_class5.x = map_pixel_class2.x - map_pixel_class.x; map_pixel_class5.y = map_pixel_class2.y - map_pixel_class.y; map_pixel_class3.x += map_pixel_class5.x; map_pixel_class3.y += map_pixel_class5.y; map_pixel_class4.x += map_pixel_class5.x; map_pixel_class4.y += map_pixel_class5.y; area.lower_right = center; area.center = pixel_to_latlong2(map_pixel_class3, zoom); area.upper_left = pixel_to_latlong2(map_pixel_class4, zoom); }
Vector2 GetPosition(double lat, double lon) { var latlong = new latlong_class(lat, lon); Vector2 returnVal; map_pixel_class map_pixel = latlong_to_pixel2(latlong, 19); map_pixel_class map_pixel_center = latlong_to_pixel2(latlong_center, 19); double map_resolution = calc_latlong_area_resolution(latlong_center, 19); returnVal.x = (float)((map_pixel.x - map_pixel_center.x) * map_resolution); returnVal.y = (float)((-map_pixel.y + map_pixel_center.y) * map_resolution); returnVal += offset; return(returnVal); }
public map_pixel_class latlong_to_pixel2(latlong_class latlong, double zoom) { latlong = clip_latlong(latlong); double pi = 3.14159265358979323846264338327950288419716939937510; double x = (latlong.longitude + 180.0) / 360.0; double sinLatitude = Mathf.Sin((float)latlong.latitude * (float)pi / 180.0f); double y = 0.5 - Mathf.Log((float)((1.0f + sinLatitude) / (1.0f - sinLatitude))) / (4.0f * pi); x *= 256.0 * Mathf.Pow(2.0f, (float)zoom); y *= 256.0 * Mathf.Pow(2.0f, (float)zoom); map_pixel_class map_pixel = new map_pixel_class(); map_pixel.x = x; map_pixel.y = y; return(map_pixel); }
static public map_pixel_class clip_pixel(map_pixel_class map_pixel, double zoom) { double num = 256 * Mathf.Pow(2, (float)zoom); if (map_pixel.x > num - 1) { map_pixel.x -= num - 1; } else if (map_pixel.x < 0) { map_pixel.x = num - 1 - map_pixel.x; } if (map_pixel.y > num - 1) { map_pixel.y -= num - 1; } else if (map_pixel.y < 0) { map_pixel.y = num - 1 - map_pixel.y; } return(map_pixel); }
public override map_pixel_class clip_pixel(map_pixel_class map_pixel, double zoom) { double num = (double)((float)256 * Mathf.Pow((float)2, (float)zoom)); if (map_pixel.x > num - (double)1) { map_pixel.x -= num - (double)1; } else if (map_pixel.x < (double)0) { map_pixel.x = num - (double)1 - map_pixel.x; } if (map_pixel.y > num - (double)1) { map_pixel.y -= num - (double)1; } else if (map_pixel.y < (double)0) { map_pixel.y = num - (double)1 - map_pixel.y; } return(map_pixel); }
public map_area_class(string name1, int index) { this.name = "Untitled"; this.upper_left = new latlong_class(); this.lower_right = new latlong_class(); this.center = new latlong_class(); this.size = new map_pixel_class(); this.heightmap_offset = new Vector2((float)0, (float)0); this.smooth_strength = (float)1; this.resolution = 2048; this.image_zoom = 18; this.start_tile = new tile_class(); this.tiles = new tile_class(); this.export_heightmap_path = string.Empty; this.export_heightmap_filename = string.Empty; this.export_image_path = string.Empty; this.export_image_filename = string.Empty; this.export_terrain_path = string.Empty; this.export_to_terraincomposer = true; this.converter_source_path_full = string.Empty; this.converter_destination_path_full = string.Empty; this.converter_height = (float)9000; this.terrain_asset_name = string.Empty; this.terrain_scene_name = string.Empty; this.terrain_height = (float)9000; this.terrain_scale = (float)1; this.do_heightmap = true; this.do_image = true; this.mipmapEnabled = true; this.anisoLevel = 9; this.maxTextureSize_select = 6; this.auto_import_settings_apply = true; this.preimage_path = string.Empty; this.name = name1 + index.ToString(); this.terrain_curve = AnimationCurve.Linear((float)0, (float)0, (float)1, (float)1); this.terrain_curve.AddKey((float)1, (float)0); this.terrain_curve = this.set_curve_linear(this.terrain_curve); }
map_pixel_class clip_pixel(map_pixel_class map_pixel, double zoom) { double mapSize = 256 * Mathf.Pow(2, (float)zoom); if (map_pixel.x > mapSize - 1) { map_pixel.x -= mapSize - 1; } else if (map_pixel.x < 0) { map_pixel.x = mapSize - 1 - map_pixel.x; } if (map_pixel.y > mapSize - 1) { map_pixel.y -= mapSize - 1; } else if (map_pixel.y < 0) { map_pixel.y = mapSize - 1 - map_pixel.y; } return(map_pixel); }