Skip to content

Commit

Permalink
add DefineConstants NETFRAMEWORK, NETSTANDARD, NETCORE
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurgen De Leon committed Jun 5, 2022
1 parent d178b13 commit fd21709
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 19 deletions.
14 changes: 12 additions & 2 deletions GMap.NET/GMap.NET.Avalonia/GMap.NET.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@
History Release Notes
https://github.com/judero01col/GMap.NET/blob/master/README.md#release-notes
</PackageReleaseNotes>
</PropertyGroup>

</PropertyGroup>

<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
<DefineConstants>NETFRAMEWORK</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
<DefineConstants>NETSTANDARD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
<DefineConstants>NETCORE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.6" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.6" />
Expand Down
2 changes: 1 addition & 1 deletion GMap.NET/GMap.NET.Avalonia/GMapControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,7 @@ public void ReloadMap()
_core.ReloadMap();
}

#if !NET46
#if !NETFRAMEWORK

public Task ReloadMapAsync()
{
Expand Down
15 changes: 12 additions & 3 deletions GMap.NET/GMap.NET.Core/GMap.NET.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<Product>GMap.NET.Core</Product>
<AssemblyTitle>GMap.NET.Core</AssemblyTitle>
<RootNamespace>GMap.NET</RootNamespace>
<TargetFrameworks>net46;net47;net48;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<DefineConstants>MONO_disabled;SQLite;MySQL_disabled;PostgreSQL_disabled;$(DefineConstants)</DefineConstants>
<TargetFrameworks>net46;net47;net48;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>

<PackageReleaseNotes>
- New Provider OpenStreetMapGraphHopper
Expand All @@ -18,7 +17,17 @@ History Release Notes
https://github.com/judero01col/GMap.NET/blob/master/README.md#release-notes
</PackageReleaseNotes>
</PropertyGroup>


<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
<DefineConstants>NETFRAMEWORK;MONO_disabled;SQLite;MySQL_disabled;PostgreSQL_disabled;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
<DefineConstants>NETSTANDARD;MONO_disabled;SQLite;MySQL_disabled;PostgreSQL_disabled;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
<DefineConstants>NETCORE;MONO_disabled;SQLite;MySQL_disabled;PostgreSQL_disabled;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
Expand Down
23 changes: 11 additions & 12 deletions GMap.NET/GMap.NET.Core/Internals/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Threading.Tasks;
using GMap.NET.MapProviders;
using GMap.NET.Projections;
#if NET46
#if NETFRAMEWORK
using System.Collections.Concurrent;
#endif

Expand Down Expand Up @@ -57,7 +57,7 @@ internal sealed class Core : IDisposable
internal List<DrawTile> TileDrawingList = new List<DrawTile>();
internal FastReaderWriterLock TileDrawingListLock = new FastReaderWriterLock();

#if !NET46
#if !NETFRAMEWORK
public readonly Stack<LoadTask> TileLoadQueue = new Stack<LoadTask>();
#endif

Expand Down Expand Up @@ -351,10 +351,9 @@ public bool SetZoomToFitRect(RectLatLng rect)
public event MapTypeChanged OnMapTypeChanged;

readonly List<Thread> _gThreadPool = new List<Thread>();
// ^

// should be only one pool for multiply controls, any ideas how to fix?
//static readonly List<Thread> GThreadPool = new List<Thread>();

// windows forms or wpf
internal string SystemType;

Expand Down Expand Up @@ -615,7 +614,7 @@ public void ReloadMap()
}
}

#if !NET46
#if !NETFRAMEWORK
public Task ReloadMapAsync()
{
ReloadMap();
Expand Down Expand Up @@ -768,7 +767,7 @@ public void CancelAsyncTasks()
{
if (IsStarted)
{
#if NET46
#if NETFRAMEWORK
//TODO: clear loading
#else
Monitor.Enter(TileLoadQueue);
Expand All @@ -794,7 +793,7 @@ public void CancelAsyncTasks()
volatile int _okZoom;
volatile int _skipOverZoom;

#if NET46
#if NETFRAMEWORK
static readonly BlockingCollection<LoadTask> TileLoadQueue4 =
new BlockingCollection<LoadTask>(new ConcurrentStack<LoadTask>());

Expand Down Expand Up @@ -1208,7 +1207,7 @@ void UpdateBounds()
TileDrawingListLock.ReleaseWriterLock();
}

#if NET46
#if NETFRAMEWORK
Interlocked.Exchange(ref _loadWaitCount, 0);
#else
Monitor.Enter(TileLoadQueue);
Expand All @@ -1221,7 +1220,7 @@ void UpdateBounds()
foreach (var p in TileDrawingList)
{
var task = new LoadTask(p.PosXY, Zoom, this);
#if NET46
#if NETFRAMEWORK
AddLoadTask(task);
#else
{
Expand All @@ -1238,7 +1237,7 @@ void UpdateBounds()
TileDrawingListLock.ReleaseReaderLock();
}

#if !NET46
#if !NETFRAMEWORK
#region -- starts loader threads if needed --

lock (_gThreadPool)
Expand All @@ -1265,7 +1264,7 @@ void UpdateBounds()
_lastTileLoadStart = DateTime.Now;
Debug.WriteLine("OnTileLoadStart - at zoom " + Zoom + ", time: " + _lastTileLoadStart.TimeOfDay);
}
#if !NET46
#if !NETFRAMEWORK
_loadWaitCount = 0;
Monitor.PulseAll(TileLoadQueue);
}
Expand Down Expand Up @@ -1355,7 +1354,7 @@ void Dispose(bool disposing)
TileDrawingListLock.ReleaseWriterLock();
}

#if NET46
#if NETFRAMEWORK
//TODO: maybe
#else
// cancel waiting loaders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
Use .DumpMarkers() or .DumpRoute() to add markers or route lines to a map in a new result pane
</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
<DefineConstants>NETFRAMEWORK</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
<DefineConstants>NETSTANDARD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
<DefineConstants>NETCORE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LINQPad" Version="5.40.0" />
Expand Down
10 changes: 10 additions & 0 deletions GMap.NET/GMap.NET.WindowsForms/GMap.NET.WindowsForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ https://github.com/judero01col/GMap.NET/blob/master/README.md#release-notes
</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
<DefineConstants>NETFRAMEWORK;ContinuesMapNo;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
<DefineConstants>NETSTANDARD;ContinuesMapNo;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
<DefineConstants>NETCORE;ContinuesMapNo;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GMap.NET.Core\GMap.NET.Core.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ https://github.com/judero01col/GMap.NET/blob/master/README.md#release-notes
</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
<DefineConstants>NETFRAMEWORK</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
<DefineConstants>NETSTANDARD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
<DefineConstants>NETCORE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GMap.NET.Core\GMap.NET.Core.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion GMap.NET/GMap.NET.WindowsPresentation/GMapControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2529,7 +2529,7 @@ public void ReloadMap()
_core.ReloadMap();
}

#if !NET46
#if !NETFRAMEWORK
public Task ReloadMapAsync()
{
return _core.ReloadMapAsync();
Expand Down

0 comments on commit fd21709

Please sign in to comment.