Example #1
0
 public map_region_class(int index)
 {
     this.name   = "Untitled";
     this.area   = new List <map_area_class>();
     this.center = new latlong_class();
     this.name  += index.ToString();
 }
Example #2
0
 public ext_class()
 {
     this.tile           = new tile_class();
     this.subtile        = new tile_class();
     this.latlong_area   = new latlong_area_class();
     this.latlong_center = new latlong_class();
 }
Example #3
0
    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)));
    }
Example #4
0
    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);
    }
Example #5
0
 public ext_class()
 {
     this.tile = new tile_class();
     this.subtile = new tile_class();
     this.latlong_area = new latlong_area_class();
     this.latlong_center = new latlong_class();
 }
Example #6
0
    public override bool draw_latlong_raster(latlong_class latlong1, latlong_class latlong2, Vector2 offset, double zoom, double current_zoom, int resolution, Rect screen, Color color, int width)
    {
        bool    result  = true;
        Vector2 vector  = this.latlong_to_pixel(latlong1, this.map_latlong_center, current_zoom, new Vector2(screen.width, screen.height));
        Vector2 a       = this.latlong_to_pixel(latlong2, this.map_latlong_center, current_zoom, new Vector2(screen.width, screen.height));
        Vector2 vector2 = a - vector;

        vector += new Vector2(-offset.x, offset.y);
        a      += new Vector2(-offset.x, offset.y);
        double num  = (double)Mathf.Pow((float)2, (float)(zoom - current_zoom));
        float  num2 = (float)((double)resolution / num);

        if (Mathf.Abs(Mathf.Round(vector2.x / num2) - vector2.x / num2) > 0.01f || Mathf.Abs(Mathf.Round(vector2.y / num2) - vector2.y / num2) > 0.01f)
        {
            result = false;
            color  = Color.red;
        }
        for (float num3 = vector.x; num3 < vector.x + vector2.x; num3 += num2)
        {
            Drawing_tc1.DrawLine(new Vector2(num3, vector.y), new Vector2(num3, a.y), color, (float)width, false, screen);
        }
        for (float num4 = vector.y; num4 < vector.y + vector2.y; num4 += num2)
        {
            Drawing_tc1.DrawLine(new Vector2(vector.x, num4), new Vector2(a.x, num4), color, (float)width, false, screen);
        }
        return(result);
    }
Example #7
0
    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);
    }
Example #8
0
    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);
    }
Example #9
0
    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));
    }
Example #10
0
    public override 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  = this.latlong_to_pixel2(latlong1, zoom);
        map_pixel_class map_pixel_class2 = this.latlong_to_pixel2(latlong2, zoom);
        map_pixel_class map_pixel_class3 = new map_pixel_class();

        tile_class.x = (int)Mathf.Round((float)((map_pixel_class2.x - map_pixel_class.x) / (double)resolution));
        tile_class.y = (int)Mathf.Round((float)((map_pixel_class2.y - map_pixel_class.y) / (double)resolution));
        return(tile_class);
    }
Example #11
0
    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
        });
    }
Example #12
0
    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));
    }
Example #13
0
    public override map_pixel_class latlong_to_pixel2(latlong_class latlong, double zoom)
    {
        latlong = this.clip_latlong(latlong);
        double num  = (double)3.14159274f;
        double num2 = (latlong.longitude + (double)180f) / (double)360f;
        double num3 = (double)Mathf.Sin((float)(latlong.latitude * num / (double)180f));
        double num4 = (double)0.5f - (double)Mathf.Log((float)(((double)1f + num3) / ((double)1f - num3))) / ((double)4f * num);

        num2 *= (double)(256f * Mathf.Pow(2f, (float)zoom));
        num4 *= (double)(256f * Mathf.Pow(2f, (float)zoom));
        return(new map_pixel_class
        {
            x = num2,
            y = num4
        });
    }
Example #14
0
    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);
    }
Example #15
0
    public override void calc_latlong2_area_from_center(map_area_class area, latlong_class center, double zoom)
    {
        map_pixel_class map_pixel_class  = this.latlong_to_pixel2(area.lower_right, zoom);
        map_pixel_class map_pixel_class2 = this.latlong_to_pixel2(center, zoom);
        map_pixel_class map_pixel_class3 = this.latlong_to_pixel2(area.center, zoom);
        map_pixel_class map_pixel_class4 = this.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         = this.pixel_to_latlong2(map_pixel_class3, zoom);
        area.upper_left     = this.pixel_to_latlong2(map_pixel_class4, zoom);
    }
Example #16
0
    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
        }));
    }
Example #17
0
    public override Vector2 latlong_to_pixel(latlong_class latlong, latlong_class latlong_center, double zoom, Vector2 screen_resolution)
    {
        latlong        = this.clip_latlong(latlong);
        latlong_center = this.clip_latlong(latlong_center);
        double  num  = (double)3.14159274f;
        double  num2 = (latlong.longitude + (double)180) / (double)360;
        double  num3 = (double)Mathf.Sin((float)(latlong.latitude * num / (double)180));
        double  num4 = (double)0.5f - (double)Mathf.Log((float)(((double)1 + num3) / ((double)1 - num3))) / ((double)4 * num);
        Vector2 a    = new Vector2((float)num2, (float)num4);

        num2 = (latlong_center.longitude + (double)180) / (double)360;
        num3 = (double)Mathf.Sin((float)(latlong_center.latitude * num / (double)180));
        num4 = (double)0.5f - (double)Mathf.Log((float)(((double)1 + num3) / ((double)1 - num3))) / ((double)4 * num);
        Vector2 b  = new Vector2((float)num2, (float)num4);
        Vector2 a2 = a - b;

        a2 *= (float)256 * Mathf.Pow((float)2, (float)zoom);
        return(a2 + screen_resolution / (float)2);
    }
Example #18
0
 public override latlong_class clip_latlong(latlong_class latlong)
 {
     if (latlong.latitude > this.maxLatitude)
     {
         latlong.latitude -= this.maxLatitude * (double)2;
     }
     else if (latlong.latitude < this.minLatitude)
     {
         latlong.latitude += this.maxLatitude * (double)2;
     }
     if (latlong.longitude > (double)180)
     {
         latlong.longitude -= (double)360;
     }
     else if (latlong.longitude < (double)-180)
     {
         latlong.longitude += (double)360;
     }
     return(latlong);
 }
Example #19
0
 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);
 }
Example #20
0
 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);
 }
Example #21
0
 public latlong_area_class()
 {
     this.latlong1 = new latlong_class();
     this.latlong2 = new latlong_class();
 }
Example #22
0
 public global_settings_tc()
 {
     this.examples = new string[]
     {
         "Procedural Mountains",
         "Procedural Canyons",
         "Procedural Plateaus",
         "Procedural Islands",
         "Island Example"
     };
     this.layer_count                      = true;
     this.placed_count                     = true;
     this.display_project                  = true;
     this.tabs                             = true;
     this.color_scheme                     = true;
     this.color_layout                     = new color_settings_class();
     this.display_mix_curves               = true;
     this.filter_select_text               = true;
     this.object_fast                      = true;
     this.preview_texture                  = true;
     this.preview_texture_buffer           = 100;
     this.preview_colors                   = true;
     this.preview_texture_resolution       = 128;
     this.preview_texture_resolution1      = 128;
     this.preview_quick_resolution_min     = 16;
     this.preview_splat_brightness         = (float)1;
     this.preview_texture_dock             = true;
     this.preview_target_frame             = 30;
     this.splat_colors                     = new List <Color>();
     this.splat_custom_texture_resolution  = 128;
     this.splat_custom_texture_resolution1 = 128;
     this.tree_colors                      = new List <Color>();
     this.grass_colors                     = new List <Color>();
     this.object_colors                    = new List <Color>();
     this.toggle_text_short                = true;
     this.tooltip_text_long                = true;
     this.tooltip_mode                     = 2;
     this.video_help                       = true;
     this.run_in_background                = true;
     this.display_bar_auto_generate        = true;
     this.auto_speed                       = true;
     this.target_frame                     = 40;
     this.auto_save                        = true;
     this.auto_save_tc_instances           = 2;
     this.auto_save_scene_instances        = 2;
     this.auto_save_tc                     = true;
     this.auto_save_tc_list                = new List <string>();
     this.auto_save_scene                  = true;
     this.auto_save_scene_list             = new List <string>();
     this.auto_save_timer                  = (float)10;
     this.auto_save_on_play                = true;
     this.terrain_tiles_max                = 15;
     this.auto_search_list                 = new List <auto_search_class>();
     this.map                = new map_class();
     this.select_window      = new select_window_class();
     this.preview_window     = new List <int>();
     this.PI                 = 3.14159274f;
     this.map_latlong        = new latlong_class();
     this.map_latlong_center = new latlong_class();
     this.map_zoom           = 17;
     this.settings           = new global_settings_class();
     this.minLatitude        = (double)-85.05113f;
     this.maxLatitude        = (double)85.05113f;
     this.minLongitude       = (double)-180;
     this.maxLongitude       = (double)180;
 }
Example #23
0
    public override latlong_area_class calc_latlong_area_rounded(latlong_class latlong1, latlong_class latlong2, double zoom, int resolution, bool square, int mode)
    {
        map_pixel_class map_pixel_class  = this.latlong_to_pixel2(latlong1, zoom);
        map_pixel_class map_pixel_class2 = this.latlong_to_pixel2(latlong2, zoom);
        map_pixel_class map_pixel_class3 = new map_pixel_class();

        map_pixel_class3.x = (double)(Mathf.Round((float)((map_pixel_class2.x - map_pixel_class.x) / (double)resolution)) * (float)resolution);
        if (square)
        {
            map_pixel_class3.y = map_pixel_class3.x;
        }
        else
        {
            map_pixel_class3.y = (double)(Mathf.Round((float)((map_pixel_class2.y - map_pixel_class.y) / (double)resolution)) * (float)resolution);
        }
        if (mode == 1)
        {
            if (map_pixel_class.x > map_pixel_class2.x - (double)resolution)
            {
                map_pixel_class.x = map_pixel_class2.x - (double)resolution;
            }
            else
            {
                map_pixel_class.x = map_pixel_class2.x - map_pixel_class3.x;
            }
        }
        else if (mode == 2)
        {
            if (map_pixel_class2.x < map_pixel_class.x + (double)resolution)
            {
                map_pixel_class2.x = map_pixel_class.x + (double)resolution;
            }
            else
            {
                map_pixel_class2.x = map_pixel_class.x + map_pixel_class3.x;
            }
        }
        else if (mode == 3)
        {
            if (map_pixel_class.y > map_pixel_class2.y - (double)resolution)
            {
                map_pixel_class.y = map_pixel_class2.y - (double)resolution;
            }
            else
            {
                map_pixel_class.y = map_pixel_class2.y - map_pixel_class3.y;
            }
        }
        else if (mode == 4)
        {
            if (map_pixel_class2.y < map_pixel_class.y + (double)resolution)
            {
                map_pixel_class2.y = map_pixel_class.y + (double)resolution;
            }
            else
            {
                map_pixel_class2.y = map_pixel_class.y + map_pixel_class3.y;
            }
        }
        else if (mode == 5)
        {
            if (map_pixel_class.x > map_pixel_class2.x - (double)resolution)
            {
                map_pixel_class.x = map_pixel_class2.x - (double)resolution;
            }
            else
            {
                map_pixel_class.x = map_pixel_class2.x - map_pixel_class3.x;
            }
            if (map_pixel_class.y > map_pixel_class2.y - (double)resolution)
            {
                map_pixel_class.y = map_pixel_class2.y - (double)resolution;
            }
            else
            {
                map_pixel_class.y = map_pixel_class2.y - map_pixel_class3.y;
            }
        }
        else if (mode == 6)
        {
            if (map_pixel_class2.x < map_pixel_class.x + (double)resolution)
            {
                map_pixel_class2.x = map_pixel_class.x + (double)resolution;
            }
            else
            {
                map_pixel_class2.x = map_pixel_class.x + map_pixel_class3.x;
            }
            if (map_pixel_class.y > map_pixel_class2.y - (double)resolution)
            {
                map_pixel_class.y = map_pixel_class2.y - (double)resolution;
            }
            else
            {
                map_pixel_class.y = map_pixel_class2.y - map_pixel_class3.y;
            }
        }
        else if (mode == 7)
        {
            if (map_pixel_class.x > map_pixel_class2.x - (double)resolution)
            {
                map_pixel_class.x = map_pixel_class2.x - (double)resolution;
            }
            else
            {
                map_pixel_class.x = map_pixel_class2.x - map_pixel_class3.x;
            }
            if (map_pixel_class2.y < map_pixel_class.y + (double)resolution)
            {
                map_pixel_class2.y = map_pixel_class.y + (double)resolution;
            }
            else
            {
                map_pixel_class2.y = map_pixel_class.y + map_pixel_class3.y;
            }
        }
        else if (mode == 8)
        {
            if (map_pixel_class2.x - (double)resolution < map_pixel_class.x)
            {
                map_pixel_class2.x = map_pixel_class.x + (double)resolution;
            }
            else
            {
                map_pixel_class2.x = map_pixel_class.x + map_pixel_class3.x;
            }
            if (map_pixel_class2.y - (double)resolution < map_pixel_class.y)
            {
                map_pixel_class2.y = map_pixel_class.y + (double)resolution;
            }
            else
            {
                map_pixel_class2.y = map_pixel_class.y + map_pixel_class3.y;
            }
        }
        return(new latlong_area_class
        {
            latlong1 = this.pixel_to_latlong2(map_pixel_class, zoom),
            latlong2 = this.pixel_to_latlong2(map_pixel_class2, zoom)
        });
    }