Skip to content

Commit 4e33728

Browse files
committed
clarify names, make methods protected
1 parent 946da5f commit 4e33728

File tree

8 files changed

+27
-44
lines changed

8 files changed

+27
-44
lines changed

J4JMapLibrary/projections/base/IProjection.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public interface IProjection : IEquatable<IProjection>
4444
string Copyright { get; }
4545
Uri? CopyrightUri { get; }
4646

47-
string MapStyle { get; set; }
4847
event EventHandler<bool>? LoadComplete;
4948

5049
int GetHeightWidth( int scale );
@@ -53,20 +52,20 @@ public interface IProjection : IEquatable<IProjection>
5352
MinMax<int> GetTileRange( int scale );
5453
int GetNumTiles( int scale );
5554

56-
HttpRequestMessage? CreateMessage( MapTile mapTile );
55+
//HttpRequestMessage? CreateMessage( MapTile mapTile );
5756

5857
bool SetCredentials( object credentials );
5958
Task<bool> SetCredentialsAsync( object credentials, CancellationToken ctx = default );
6059

61-
Task<MapTile> GetMapTileByProjectionCoordinatesAsync( int x, int y, int scale, CancellationToken ctx = default );
62-
Task<MapTile> GetMapTileByRegionCoordinatesAsync( int x, int y, int scale, CancellationToken ctx = default );
60+
Task<MapTile> GetMapTileWraparoundAsync( int x, int y, int scale, CancellationToken ctx = default );
61+
Task<MapTile> GetMapTileAbsoluteAsync( int x, int y, int scale, CancellationToken ctx = default );
6362

6463
Task<bool> LoadRegionAsync(
6564
MapRegion.MapRegion region,
6665
CancellationToken ctx = default
6766
);
6867

69-
byte[]? GetImage( MapTile mapTile );
68+
//byte[]? GetImage( MapTile mapTile );
7069
Task<byte[]?> GetImageAsync( MapTile mapTile, CancellationToken ctx = default );
7170

7271
Task<bool> LoadImageAsync( MapTile mapTile, CancellationToken ctx = default );

J4JMapLibrary/projections/base/Projection.cs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public abstract class Projection<TAuth> : IProjection
2828
where TAuth : class, new()
2929
{
3030
public const int DefaultMaxRequestLatency = 500;
31-
private string _mapStyle = string.Empty;
3231
private float _maxLat = MapConstants.Wgs84MaxLatitude;
3332
private float _maxLong = 180;
3433
private int _maxScale;
@@ -84,7 +83,7 @@ public MinMax<int> GetTileRange( int scale )
8483

8584
public int GetNumTiles( int scale )
8685
{
87-
scale = ScaleRange.ConformValueToRange( scale, "GetNumTiles() Scale" );
86+
scale = ScaleRange.ConformValueToRange( scale, "GetNumTiles()" );
8887
return InternalExtensions.Pow( 2, scale );
8988
}
9089

@@ -105,31 +104,16 @@ public int GetHeightWidth( int scale )
105104
public string Copyright { get; protected set; } = string.Empty;
106105
public Uri? CopyrightUri { get; protected set; }
107106

108-
public string MapStyle
109-
{
110-
get => _mapStyle;
111-
112-
set
113-
{
114-
var changed = !value.Equals( _mapStyle, StringComparison.OrdinalIgnoreCase );
115-
116-
_mapStyle = value;
117-
118-
if( changed )
119-
OnMapStyleChanged( value );
120-
}
121-
}
122-
123-
public abstract HttpRequestMessage? CreateMessage( MapTile mapTile );
107+
protected abstract HttpRequestMessage? CreateMessage( MapTile mapTile );
124108

125-
public abstract Task<MapTile> GetMapTileByProjectionCoordinatesAsync(
109+
public abstract Task<MapTile> GetMapTileWraparoundAsync(
126110
int x,
127111
int y,
128112
int scale,
129113
CancellationToken ctx = default
130114
);
131115

132-
public abstract Task<MapTile> GetMapTileByRegionCoordinatesAsync(
116+
public abstract Task<MapTile> GetMapTileAbsoluteAsync(
133117
int x,
134118
int y,
135119
int scale,
@@ -208,10 +192,10 @@ protected abstract Task<bool> LoadRegionInternalAsync(
208192
CancellationToken ctx = default
209193
);
210194

211-
public byte[]? GetImage( MapTile mapTile )
212-
{
213-
return Task.Run( async () => await GetImageAsync( mapTile ) ).Result;
214-
}
195+
//public byte[]? GetImage( MapTile mapTile )
196+
//{
197+
// return Task.Run( async () => await GetImageAsync( mapTile ) ).Result;
198+
//}
215199

216200
public async Task<byte[]?> GetImageAsync( MapTile mapTile, CancellationToken ctx = default )
217201
{

J4JMapLibrary/projections/base/static-projection/StaticProjection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected StaticProjection(
3232

3333
// there's only ever one valid tile in a static projection (0,0)
3434
// so these next two methods are the same for static projections
35-
public override async Task<MapTile> GetMapTileByProjectionCoordinatesAsync(
35+
public override async Task<MapTile> GetMapTileWraparoundAsync(
3636
int x,
3737
int y,
3838
int scale,
@@ -45,13 +45,13 @@ public override async Task<MapTile> GetMapTileByProjectionCoordinatesAsync(
4545
return retVal;
4646
}
4747

48-
public override async Task<MapTile> GetMapTileByRegionCoordinatesAsync(
48+
public override async Task<MapTile> GetMapTileAbsoluteAsync(
4949
int x,
5050
int y,
5151
int scale,
5252
CancellationToken ctx = default
5353
) =>
54-
await GetMapTileByProjectionCoordinatesAsync( x, y, scale, ctx );
54+
await GetMapTileWraparoundAsync( x, y, scale, ctx );
5555

5656
protected override async Task<bool> LoadRegionInternalAsync(
5757
MapRegion.MapRegion region,

J4JMapLibrary/projections/base/tiled-projection/TiledProjection.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,31 +57,31 @@ public float GroundResolution( float latitude, int scale )
5757
public string ScaleDescription( float latitude, int scale, float dotsPerInch ) =>
5858
$"1 : {GroundResolution( latitude, scale ) * dotsPerInch / MapConstants.MetersPerInch}";
5959

60-
public override async Task<MapTile> GetMapTileByProjectionCoordinatesAsync(
61-
int x,
62-
int y,
60+
public override async Task<MapTile> GetMapTileWraparoundAsync(
61+
int xTile,
62+
int yTile,
6363
int scale,
6464
CancellationToken ctx = default
6565
)
6666
{
6767
var region = new MapRegion.MapRegion( this, LoggerFactory ) { Scale = scale };
6868

69-
var retVal = new MapTile( region, y ).SetXRelative( x );
69+
var retVal = new MapTile( region, yTile ).SetXRelative( xTile );
7070
await LoadImageAsync( retVal, ctx );
7171

7272
return retVal;
7373
}
7474

75-
public override async Task<MapTile> GetMapTileByRegionCoordinatesAsync(
76-
int x,
77-
int y,
75+
public override async Task<MapTile> GetMapTileAbsoluteAsync(
76+
int xTile,
77+
int yTile,
7878
int scale,
7979
CancellationToken ctx = default
8080
)
8181
{
8282
var region = new MapRegion.MapRegion( this, LoggerFactory ) { Scale = scale };
8383

84-
var retVal = new MapTile( region, y ).SetXAbsolute( x );
84+
var retVal = new MapTile( region, yTile ).SetXAbsolute( xTile );
8585
await LoadImageAsync(retVal, ctx);
8686

8787
return retVal;

J4JMapLibrary/projections/bing/BingMapsProjection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected override void OnMapStyleChanged( string value )
185185
return Initialized;
186186
}
187187

188-
public override HttpRequestMessage? CreateMessage( MapTile mapTile )
188+
protected override HttpRequestMessage? CreateMessage( MapTile mapTile )
189189
{
190190
if( !Initialized )
191191
{

J4JMapLibrary/projections/google/GoogleMapsProjection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected override void OnMapStyleChanged( string value )
8383
return true;
8484
}
8585

86-
public override HttpRequestMessage? CreateMessage( MapTile mapTile )
86+
protected override HttpRequestMessage? CreateMessage( MapTile mapTile )
8787
{
8888
if( !Initialized )
8989
{

J4JMapLibrary/projections/openmap/street/OpenStreetMapsProjection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public OpenStreetMapsProjection(
5757
return Initialized;
5858
}
5959

60-
public override HttpRequestMessage? CreateMessage( MapTile mapTile )
60+
protected override HttpRequestMessage? CreateMessage( MapTile mapTile )
6161
{
6262
if( !Initialized )
6363
{

J4JMapLibrary/projections/openmap/topo/OpenTopoMapsProjection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public OpenTopoMapsProjection(
5858
return Initialized;
5959
}
6060

61-
public override HttpRequestMessage? CreateMessage( MapTile mapTile )
61+
protected override HttpRequestMessage? CreateMessage( MapTile mapTile )
6262
{
6363
if( !Initialized )
6464
{

0 commit comments

Comments
 (0)