1 /*
2  *  This file is part of the "GKMap".
3  *  GKMap project borrowed from GMap.NET (by radioman).
4  *
5  *  Copyright (C) 2009-2018 by radioman (email@radioman.lt).
6  *  This program is licensed under the FLAT EARTH License.
7  */
8 
9 using System;
10 using System.Collections.Generic;
11 
12 namespace GKMap
13 {
14     /// <summary>
15     /// tile load task
16     /// </summary>
17     internal struct LoadTask : IEquatable<LoadTask>
18     {
19         public GPoint Pos;
20         public int Zoom;
21 
LoadTaskGKMap.LoadTask22         public LoadTask(GPoint pos, int zoom)
23         {
24             Pos = pos;
25             Zoom = zoom;
26         }
27 
ToStringGKMap.LoadTask28         public override string ToString()
29         {
30             return Zoom + " - " + Pos.ToString();
31         }
32 
EqualsGKMap.LoadTask33         public bool Equals(LoadTask other)
34         {
35             return (Zoom == other.Zoom && Pos == other.Pos);
36         }
37     }
38 
39     internal class LoadTaskComparer : IEqualityComparer<LoadTask>
40     {
Equals(LoadTask x, LoadTask y)41         public bool Equals(LoadTask x, LoadTask y)
42         {
43             return x.Zoom == y.Zoom && x.Pos == y.Pos;
44         }
45 
GetHashCode(LoadTask obj)46         public int GetHashCode(LoadTask obj)
47         {
48             return obj.Zoom ^ obj.Pos.GetHashCode();
49         }
50     }
51 }
52