Skip to content

Commit b11cab8

Browse files
committed
Mapping the new MapWinGIS.Utils.GetAngle() method.
1 parent 9823a42 commit b11cab8

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

src/MW5.Api/Static/GisUtils.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using MW5.Api.Helpers;
66
using MW5.Api.Interfaces;
77
using MW5.Shared.Log;
8+
// ReSharper disable UnusedMember.Global
89

910
namespace MW5.Api.Static
1011
{
@@ -17,14 +18,11 @@ public class GisUtils: IComWrapper
1718
/// Static instance of MapWinGIS.Utils class.
1819
/// Use whenever there is no need to share callback in multithreading scenario.
1920
/// </summary>
20-
public static GisUtils Instance
21-
{
22-
get { return _staticUilts; }
23-
}
21+
public static GisUtils Instance => _staticUilts;
2422

2523
public IGlobalListener Callback
2624
{
27-
get { return NativeCallback.UnWrap(_utils.GlobalCallback); }
25+
get => NativeCallback.UnWrap(_utils.GlobalCallback);
2826
set
2927
{
3028
var callback = NativeCallback.Wrap(value);
@@ -199,8 +197,8 @@ public string LastError()
199197

200198
public string Key
201199
{
202-
get { return _utils.Key; }
203-
set { _utils.Key = value; }
200+
get => _utils.Key;
201+
set => _utils.Key = value;
204202
}
205203

206204
public string GetComUsageReport()
@@ -230,6 +228,15 @@ public bool ExportSelection(IFeatureSet fs, string outputFilename, bool overwrit
230228
return _utils.ExportSelection(fs.GetInternal(), outputFilename, overwrite);
231229
}
232230

231+
public double GetAngle(ICoordinate firstCoordinate, ICoordinate secondCoordinate, bool inCartesian = true, bool inRadians = true)
232+
{
233+
var angle = _utils.GetAngle(firstCoordinate.GetInternal(), secondCoordinate.GetInternal());
234+
if (inCartesian) angle = (450 - angle) % 360;
235+
if (inRadians) angle = angle * Math.PI / 180.0;
236+
237+
return angle;
238+
}
239+
233240
#region Not implemented
234241

235242
//public IGeometry ClipPolygon(PolygonOperation op, IGeometry subjectPolygon, IGeometry clipPolygon)
@@ -269,20 +276,14 @@ public bool ExportSelection(IFeatureSet fs, string outputFilename, bool overwrit
269276

270277
#endregion
271278

272-
public object InternalObject
273-
{
274-
get { return _utils; }
275-
}
279+
public object InternalObject => _utils;
276280

277-
string IComWrapper.LastError
278-
{
279-
get { return _utils.ErrorMsg[_utils.LastErrorCode]; }
280-
}
281+
string IComWrapper.LastError => _utils.ErrorMsg[_utils.LastErrorCode];
281282

282283
public string Tag
283284
{
284-
get { return _utils.Key; }
285-
set { _utils.Key = value; }
285+
get => _utils.Key;
286+
set => _utils.Key = value;
286287
}
287288
}
288289
}

0 commit comments

Comments
 (0)