Skip to content

Commit 77870d1

Browse files
committed
Lang: template
1 parent ad63f3f commit 77870d1

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

Controls/OpenGLtest2.cs

+26-23
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using System.Diagnostics;
1717
using System.Drawing;
1818
using System.Drawing.Imaging;
19+
using System.IO;
1920
using System.Linq;
2021
using System.Runtime.CompilerServices;
2122
using System.Runtime.InteropServices;
@@ -350,9 +351,12 @@ void imageLoader()
350351
if (_center.GetDistance(core.Position) > 30)
351352
{
352353
core.Position = _center;
353-
//core.Zoom = minzoom;
354354
}
355355

356+
if (DateTime.Now.Second % 3 == 1 && tileArea != null)
357+
lock(tileArea)
358+
CleanupOldTextures(tileArea);
359+
356360
// wait for current to load
357361
if (core.tileLoadQueue.Count > 0)
358362
{
@@ -366,15 +370,7 @@ void imageLoader()
366370

367371
// current has loaded - process
368372
generateTextures();
369-
// change zoom and loop
370-
if (core.Zoom >= zoom)
371-
{
372-
//System.Threading.Thread.Sleep(5000);
373-
//core.Zoom = minzoom;
374-
//continue;
375-
}
376373

377-
//core.Zoom = core.Zoom + 1;
378374
System.Threading.Thread.Sleep(100);
379375
}
380376
}
@@ -403,8 +399,9 @@ public Utilities.Vector3 Velocity
403399
Vector3 myrpy = Vector3.UnitX;
404400
private bool fogon = true;
405401
private Lines _flightPlanLines;
406-
private DateTime _centerTime;
407-
402+
private DateTime _centerTime;
403+
private List<tileZoomArea> tileArea = new List<tileZoomArea>();
404+
408405
double[] convertCoords(PointLatLngAlt plla)
409406
{
410407
var utm = plla.ToUTM(utmzone);
@@ -716,9 +713,9 @@ private void generateTextures()
716713
core.LevelsKeepInMemmory = 10;
717714
core.Provider = type;
718715
//core.ReloadMap();
719-
List<tileZoomArea> tileArea = new List<tileZoomArea>();
720-
//if (center.GetDistance(oldcenter) > 30)
716+
lock (tileArea)
721717
{
718+
tileArea = new List<tileZoomArea>();
722719
for (int a = minzoom; a <= zoom; a++)
723720
{
724721
var area2 = new RectLatLng(_center.Lat, _center.Lng, 0, 0);
@@ -751,16 +748,17 @@ private void generateTextures()
751748
}
752749
}
753750
}
754-
}
755-
756-
//Minimumtile(tileArea);
751+
}
752+
753+
//Minimumtile(tileArea);
754+
755+
var totaltiles = 0;
756+
foreach (var a in tileArea) totaltiles += a.points.Count;
757+
Console.Write(DateTime.Now.Millisecond + " Total tiles " + totaltiles + " \r");
758+
if (DateTime.Now.Second % 3 == 1)
759+
CleanupOldTextures(tileArea);
757760
}
758-
759-
var totaltiles = 0;
760-
foreach (var a in tileArea) totaltiles += a.points.Count;
761-
Console.Write(DateTime.Now.Millisecond + " Total tiles " + totaltiles + " \r");
762-
if (DateTime.Now.Second % 3 == 1)
763-
CleanupOldTextures(tileArea);
761+
764762
//https://wiki.openstreetmap.org/wiki/Zoom_levels
765763
var C = 2 * Math.PI * 6378137.000;
766764
// horizontal distance by each tile square
@@ -769,7 +767,10 @@ private void generateTextures()
769767
//https://wiki.openstreetmap.org/wiki/Zoom_levels
770768
// zoom 20 = 38m
771769
// get tiles & combine into one
772-
foreach (var tilearea in tileArea)
770+
tileZoomArea[] talist;
771+
lock (tileArea)
772+
talist = tileArea.ToArray();
773+
foreach (var tilearea in talist)
773774
{
774775
stile = C * Math.Cos(_center.Lat) / Math.Pow(2, tilearea.zoom);
775776
pxstep = (int)(stile / 45);
@@ -855,6 +856,8 @@ private void generateTextures()
855856
}
856857

857858
textureid[p] = ti;
859+
860+
//File.WriteAllText(p.ToString(), ti.ToJSON());
858861
}
859862
}
860863
catch

crowdin.bat

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
"c:\Program Files\7-Zip\7z.exe" a -r -x!*.id-ID.resx -x!*.tr.resx -x!*.ru-KZ.resx -x!*.pt.resx -x!*.ko-KR.resx -x!*.ja-JP.resx -x!*.zh-TW.resx -x!*.zh-Hant.resx -x!*.zh-Hans.resx -x!*.az-Latn-AZ.resx -x!*.pl.resx -x!*.it-IT.resx -x!*.fr.resx -x!*.es-ES.resx -x!*.de-DE.resx -x!*.ar.resx -x!*.ru-RU.resx -xr!mono -xr!zedgraph crowdin.zip *.resx
3+
4+
"c:\Program Files\7-Zip\7z.exe" a -r -xr!mono -xr!zedgraph crowdin-all.zip *.resx

0 commit comments

Comments
 (0)