private void SetLandmarks(IFastList <HexCoords> landmarkCoords) { ILandmarks tempLandmarks = null; ILandmarks landmarks = null; try { tempLandmarks = LandmarkCollection.CreateLandmarks(this, landmarkCoords); landmarks = tempLandmarks; tempLandmarks = null; } finally { if (tempLandmarks != null) { tempLandmarks.Dispose(); } } Landmarks = landmarks; }
/// <summary>String representation of the distance from a given landmark to a specified hex</summary> /// <param name="this"></param> /// <param name="coords">Type HexCoords - Hex for which to return Landmark distanace.</param> /// <param name="landmarkToShow">Type int - Index of the Landmark from which to display distances.</param> public static string DistanceTo(this ILandmarks @this, HexCoords coords, int landmarkToShow) => $"{@this?[landmarkToShow]?.DistanceTo(coords),3}";
/// <summary>Paint the base layer of the display, graphics that changes rarely between refreshes.</summary> /// <param name="this">Type: MapDisplay{THex} - The map to be painted.</param> /// <param name="graphics">Type: Graphics - Object representing the canvas being painted.</param> /// <remarks>For each visible hex: perform <c>paintAction</c> and then draw its hexgrid outline.</remarks> public static void PaintMap <THex>(this MapDisplay <THex> @this, DrawingContext dc, bool showHexgrid, Hexes boardHexes, ILandmarks landmarks) where THex : class, IHex { ; }