Skip to content

Commit

Permalink
Release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Gigas002 committed Feb 27, 2019
1 parent 7c7c69a commit cbde8d4
Show file tree
Hide file tree
Showing 21 changed files with 106 additions and 95 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 27.02.2019 - Released 1.2.0

Changes since 1.1.0:

* GenerateTiles methods are now async;
* Use static classes instead of structs;
* Fixed black borders issue;
* Multithreading performance improvements;
* Replaced GeoTransform property with more obvious MinX, MinY, MaxX and MaxY;
* Temp directory is now timestamp and not deleted;
* Exceptions (TileException, GdalException, ImageException);
* A lot of error checking;
* Lots of improvements in Image.Gdal class
* Disabled NetVips console warnings;
* Added convertion of bad tiffs to 4326;
* Rewritten Image.Image constructor;
* Fixed some typos;
* Fixed minor issues;

# 03.02.2019 - Released 1.1.0

Changes since 1.0.0:
Expand Down
4 changes: 2 additions & 2 deletions GTiff2Tiles.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ private static async Task Main(string[] args)
switch (Algorithm)
{
case Core.Enums.Algorithms.Join:
await inputImage.GenerateTilesByJoining(consoleProgress, ThreadsCount, OutputDirectoryInfo, MinZ, MaxZ);
await inputImage.GenerateTilesByJoining(OutputDirectoryInfo, MinZ, MaxZ, consoleProgress, ThreadsCount);
break;
case Core.Enums.Algorithms.Crop:
await inputImage.GenerateTilesByCropping(consoleProgress, ThreadsCount, OutputDirectoryInfo, MinZ, MaxZ);
await inputImage.GenerateTilesByCropping(OutputDirectoryInfo, MinZ, MaxZ, consoleProgress, ThreadsCount);
break;
default:
Helpers.ErrorHelper.PrintError("This algorithm is not supported.");
Expand Down
4 changes: 2 additions & 2 deletions GTiff2Tiles.Console/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
5 changes: 0 additions & 5 deletions GTiff2Tiles.Core/Enums/DateTimePatterns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,5 @@ public static class DateTimePatterns
/// yyyyMMddHHmmssfff
/// </summary>
public const string LongWithMs = "yyyyMMddHHmmssfff";

/// <summary>
/// yyyyMMdd
/// </summary>
public const string ShortToDate = "yyyyMMdd";
}
}
9 changes: 2 additions & 7 deletions GTiff2Tiles.Core/Enums/Image/Gdal.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace GTiff2Tiles.Core.Enums.Image
{
/// <summary>
/// Static class with Gdal enums.
/// Static class with Gdal constants.
/// </summary>
public static class Gdal
{
Expand Down Expand Up @@ -31,11 +31,6 @@ public static class Gdal
/// </summary>
public const string Byte = "Byte";

/// <summary>
/// EPSG:4326 (WGS84) projection string.
/// </summary>
public const string Projection = "AUTHORITY[\"EPSG\",\"4326\"]]";

#endregion

#region GdalWarp
Expand All @@ -45,7 +40,7 @@ public static class Gdal
/// </summary>
public static readonly string[] RepairTifOptions =
{
"-overwrite", "-t_srs", "EPSG:4326", "-co", "TILED=YES", "-multi", /*"-s_srs", "EPSG:3857",*/ "-srcnodata", "0",
"-overwrite", "-t_srs", "EPSG:4326", "-co", "TILED=YES", "-multi", "-srcnodata", "0",
"-nosrcalpha", "-dstalpha", "0"
};

Expand Down
8 changes: 4 additions & 4 deletions GTiff2Tiles.Core/Enums/Image/Image.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
namespace GTiff2Tiles.Core.Enums.Image
{
/// <summary>
/// Image enums.
/// <see cref="Core.Image.Image"/> constants.
/// </summary>
public static class Image
internal static class Image
{
/// <summary>
/// Number of bands in output tiles.
/// </summary>
public const int Bands = 4;
internal const int Bands = 4;

/// <summary>
/// Output tile's size.
/// </summary>
public const int TileSize = 256;
internal const int TileSize = 256;
}
}
4 changes: 2 additions & 2 deletions GTiff2Tiles.Core/Enums/Image/Interpolations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
/// <summary>
/// Represents the interpolation algorithms.
/// </summary>
public static class Interpolations
internal static class Interpolations
{
/// <summary>
/// Bicubic interpoilation.
/// </summary>
public const string Bicubic = "bicubic";
internal const string Bicubic = "bicubic";
}
}
4 changes: 2 additions & 2 deletions GTiff2Tiles.Core/Exceptions/Image/GdalException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public class GdalException : Exception

/// <inheritdoc />
/// <summary>
/// Creates new <see cref="Exception"/> object with passed error message.
/// Creates new <see cref="GdalException"/> object with passed error message.
/// </summary>
/// <param name="errorMessage">Error message.</param>
public GdalException(string errorMessage) : base(errorMessage)
{ }

/// <inheritdoc />
/// <summary>
/// Creates new <see cref="Exception"/> object with passed error message
/// Creates new <see cref="GdalException"/> object with passed error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="errorMessage">Error message.</param>
Expand Down
4 changes: 2 additions & 2 deletions GTiff2Tiles.Core/Exceptions/Image/ImageException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public class ImageException : Exception

/// <inheritdoc />
/// <summary>
/// Creates new <see cref="Exception"/> object with passed error message.
/// Creates new <see cref="ImageException"/> object with passed error message.
/// </summary>
/// <param name="errorMessage">Error message.</param>
public ImageException(string errorMessage) : base(errorMessage)
{ }

/// <inheritdoc />
/// <summary>
/// Creates new <see cref="Exception"/> object with passed error message
/// Creates new <see cref="ImageException"/> object with passed error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="errorMessage">Error message.</param>
Expand Down
4 changes: 2 additions & 2 deletions GTiff2Tiles.Core/Exceptions/Tile/TileException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public class TileException : Exception

/// <inheritdoc />
/// <summary>
/// Creates new <see cref="Exception"/> object with passed error message.
/// Creates new <see cref="TileException"/> object with passed error message.
/// </summary>
/// <param name="errorMessage">Error message.</param>
public TileException(string errorMessage) : base(errorMessage)
{ }

/// <inheritdoc />
/// <summary>
/// Creates new <see cref="Exception"/> object with passed error message
/// Creates new <see cref="TileException"/> object with passed error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="errorMessage">Error message.</param>
Expand Down
3 changes: 3 additions & 0 deletions GTiff2Tiles.Core/GTiff2Tiles.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
<PackageReference Include="NetVips">
<Version>1.0.7</Version>
</PackageReference>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<Version>4.5.2</Version>
</PackageReference>
<PackageReference Include="System.Threading.Tasks.Extensions">
<Version>4.5.2</Version>
</PackageReference>
Expand Down
16 changes: 8 additions & 8 deletions GTiff2Tiles.Core/Helpers/GdalHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ namespace GTiff2Tiles.Core.Helpers
/// <summary>
/// Class for initializing gdal. Analogue of <see cref="GdalConfiguration"/> class.
/// </summary>
public static class GdalHelper
internal static class GdalHelper
{
#region Fields and properties

/// <summary>
/// Shows if Ogr drivers are configured.
/// </summary>
public static bool IsOgrConfigured { get; private set; }
internal static bool IsOgrConfigured { get; private set; }

/// <summary>
/// Shows if Gdal drivers are configured.
/// </summary>
public static bool IsGdalConfigured { get; private set; }
internal static bool IsGdalConfigured { get; private set; }

/// <summary>
/// Shows, if Gdal's binaries are found and have system paths.
/// </summary>
public static bool Usable { get; private set; }
internal static bool Usable { get; private set; }

#region P/Invoke

Expand Down Expand Up @@ -115,12 +115,12 @@ private static void PrintDriversGdal()

#endregion

#region Public
#region internal

/// <summary>
/// Looks for Gdal's binaries and sets PATHs if needed.
/// </summary>
public static void Initialize()
internal static void Initialize()
{
try
{
Expand Down Expand Up @@ -186,7 +186,7 @@ public static void Initialize()
/// Configures Ogr.
/// </summary>
/// <remarks>Make sure to call this method before using Ogr.</remarks>
public static void ConfigureOgr()
internal static void ConfigureOgr()
{
if (!Usable)
throw new Exception("Can't find Gdal binaries, unable to configure Ogr.");
Expand All @@ -213,7 +213,7 @@ public static void ConfigureOgr()
/// Configures Gdal.
/// </summary>
/// <remarks>Make sure to call this method before using Gdal.</remarks>
public static void ConfigureGdal()
internal static void ConfigureGdal()
{
if (!Usable)
throw new Exception("Can't find Gdal binaries, unable to configure Gdal.");
Expand Down
4 changes: 2 additions & 2 deletions GTiff2Tiles.Core/Helpers/NetVipsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ namespace GTiff2Tiles.Core.Helpers
/// <summary>
/// Some methods for initializing NetVips.
/// </summary>
public static class NetVipsHelper
internal static class NetVipsHelper
{
//todo initialize NetVips location.

/// <summary>
/// Disables NetVips log warnings.
/// </summary>
public static void DisableLog() => Log.SetLogHandler("VIPS", NetVips.Enums.LogLevelFlags.Warning, (domain, level, message) => { });
internal static void DisableLog() => Log.SetLogHandler("VIPS", NetVips.Enums.LogLevelFlags.Warning, (domain, level, message) => { });
}
}
8 changes: 4 additions & 4 deletions GTiff2Tiles.Core/Image/Gdal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ private static double[] GetGeoTransform(FileInfo inputFileInfo)

#endregion

#region Public
#region Internal

/// <summary>
/// Gets proj4 string of input file.
/// </summary>
/// <param name="inputFileInfo">Object of <see cref="FileInfo"/> class, representing input file.</param>
/// <remarks>Throws <see cref="GdalException"/>.</remarks>
/// <returns><see cref="string"/> proj4.</returns>
public static string GetProj4String(FileInfo inputFileInfo)
internal static string GetProj4String(FileInfo inputFileInfo)
{
#region Parameters checking

Expand Down Expand Up @@ -242,7 +242,7 @@ public static string GetProj4String(FileInfo inputFileInfo)
/// <param name="rasterYSize">Raster's height.</param>
/// <remarks>Throws <see cref="GdalException"/>.</remarks>
/// <returns><see cref="ValueTuple{T1, T2, T3, T4}"/> with WGS84 coordinates.</returns>
public static (double minX, double minY, double maxX, double maxY) GetImageBorders(FileInfo inputFileInfo, int rasterXSize, int rasterYSize)
internal static (double minX, double minY, double maxX, double maxY) GetImageBorders(FileInfo inputFileInfo, int rasterXSize, int rasterYSize)
{
#region Parameters checking

Expand Down Expand Up @@ -271,7 +271,7 @@ public static (double minX, double minY, double maxX, double maxY) GetImageBorde
/// <param name="inputFileInfo">Object of <see cref="FileInfo"/> class, representing input file.</param>
/// <remarks>Throws <see cref="GdalException"/>.</remarks>
/// <returns><see cref="ValueTuple{T1, T2}"/> with image sizes in pixels.</returns>
public static (int rasterXSize, int rasterYSize) GetImageSizes(FileInfo inputFileInfo)
internal static (int rasterXSize, int rasterYSize) GetImageSizes(FileInfo inputFileInfo)
{
#region Parameters checking.

Expand Down
25 changes: 7 additions & 18 deletions GTiff2Tiles.Core/Image/Image.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using GTiff2Tiles.Core.Exceptions.Image;
Expand Down Expand Up @@ -676,17 +675,7 @@ private void SetCropProperties(DirectoryInfo outputDirectoryInfo, int minZ, int
if (string.IsNullOrWhiteSpace(outputDirectoryInfo.FullName))
throw new ImageException("Output directory path is empty.");

try
{
outputDirectoryInfo.Create();
}
catch (Exception exception)
{
throw new ImageException("Unable to create output directory.", exception);
}

if (outputDirectoryInfo.EnumerateFileSystemInfos().Any())
throw new ImageException("Output directory isn't empty.");
Helpers.CheckHelper.CheckOutputDirectory(outputDirectoryInfo);

if (maxZ < minZ) throw new ImageException("Maximum zoom is lesser than minimum zoom.");
if (minZ < 0) throw new ImageException("Minimum zoom is lesser than 0.");
Expand Down Expand Up @@ -727,13 +716,13 @@ private void SetCropProperties(DirectoryInfo outputDirectoryInfo, int minZ, int
/// <summary>
/// Create tiles. Crops input tiff only for lowest zoom and then join the higher ones from it.
/// </summary>
/// <param name="progress">Progress.</param>
/// <param name="threadsCount">Threads count.</param>
/// <param name="outputDirectoryInfo">Object of <see cref="DirectoryInfo"/> class, representing output directory.</param>
/// <param name="minZ">Minimum cropped zoom.</param>
/// <param name="maxZ">Maximum cropped zoom.</param>
/// <param name="progress">Progress.</param>
/// <param name="threadsCount">Threads count.</param>
/// <returns></returns>
public async ValueTask GenerateTilesByJoining(IProgress<double> progress, int threadsCount, DirectoryInfo outputDirectoryInfo, int minZ, int maxZ)
public async ValueTask GenerateTilesByJoining(DirectoryInfo outputDirectoryInfo, int minZ, int maxZ, IProgress<double> progress, int threadsCount)
{
#region Parameters checking

Expand Down Expand Up @@ -762,13 +751,13 @@ public async ValueTask GenerateTilesByJoining(IProgress<double> progress, int th
/// <summary>
/// Crops input tiff for each zoom.
/// </summary>
/// <param name="progress">Progress.</param>
/// <param name="threadsCount">Threads count.</param>
/// <param name="outputDirectoryInfo">Object of <see cref="DirectoryInfo"/> class, representing output directory.</param>
/// <param name="minZ">Minimum cropped zoom.</param>
/// <param name="maxZ">Maximum cropped zoom.</param>
/// <param name="progress">Progress.</param>
/// <param name="threadsCount">Threads count.</param>
/// <returns></returns>
public async ValueTask GenerateTilesByCropping(IProgress<double> progress, int threadsCount, DirectoryInfo outputDirectoryInfo, int minZ, int maxZ)
public async ValueTask GenerateTilesByCropping(DirectoryInfo outputDirectoryInfo, int minZ, int maxZ, IProgress<double> progress, int threadsCount)
{
#region Parameters checking

Expand Down
2 changes: 1 addition & 1 deletion GTiff2Tiles.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.*")]
[assembly: AssemblyVersion("1.2.0.*")]
4 changes: 2 additions & 2 deletions GTiff2Tiles.GUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
4 changes: 2 additions & 2 deletions GTiff2Tiles.GUI/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ public async void StartButton()
switch (Algorithm)
{
case Core.Enums.Algorithms.Join:
await inputImage.GenerateTilesByJoining(progress, ThreadsCount, outputDirectoryInfo, MinZ, MaxZ);
await inputImage.GenerateTilesByJoining(outputDirectoryInfo, MinZ, MaxZ, progress, ThreadsCount);
break;
case Core.Enums.Algorithms.Crop:
await inputImage.GenerateTilesByCropping(progress, ThreadsCount, outputDirectoryInfo, MinZ, MaxZ);
await inputImage.GenerateTilesByCropping(outputDirectoryInfo, MinZ, MaxZ, progress, ThreadsCount);
break;
default:
Helpers.ErrorHelper.ShowError("This algorithm is not supported.", null);
Expand Down
Loading

0 comments on commit cbde8d4

Please sign in to comment.