public GetExtents ( string in_coord ) : Envelope | ||
in_coord | string | The in_ngr_coord. |
Результат | Envelope |
public void TestGetExtentsHandlesIncorrectValues(string gridRef) { BindRunTime(); TranslateGridReference translate = new TranslateGridReference(); Envelope envelope = translate.GetExtents(gridRef); Assert.IsTrue(envelope == null); }
public void TestGetExtentsReturnsCorrectValues(string gridRef, double expectedX, double expectedY) { BindRunTime(); TranslateGridReference translate = new TranslateGridReference(); Envelope envelope = translate.GetExtents(gridRef); Assert.IsTrue(envelope.XMin == expectedX); Assert.IsTrue(envelope.YMin == expectedY); }
/// <summary> /// </summary> /// <param name="queryString">The string to search for, either XXXXXX,YYYYY or with sheet SSXXXXYYYY</param> /// <returns>An ArcObjects envelope object</returns> private Envelope DoMatchLookup(string queryString) { _log.Debug("BNGLocator DoMatchLookup"); Envelope envelope = null; string matchText; string[] parts; // Removes '," and spaces and split into parts based on a "," delimiter matchText = queryString.Replace("'", ""); matchText = matchText.Replace("\"", ""); matchText = matchText.TrimStart(' ').TrimEnd(' '); // Split the search string parts = matchText.Split(','); if (parts.Length == 1) { parts = matchText.Split(' '); } // If there are two parts then it's a co-ordinate X,Y so we construct an // envelope and return it. If there is one part then we assume it's a // tile reference e.g. TQ1234 so we call TranslateGridReference to get // the OS envelope. if (parts.Length == 2) { double xCoordinate; double yCoordinate; if ((double.TryParse(parts[0], out xCoordinate) == true) & (double.TryParse(parts[1], out yCoordinate) == true)) { try { envelope = new EnvelopeClass(); envelope.XMin = xCoordinate; envelope.YMin = yCoordinate; envelope.XMax = xCoordinate; envelope.YMax = yCoordinate; } catch (Exception) { envelope = null; } } } else { TranslateGridReference translate = new TranslateGridReference(); matchText = matchText.Replace(" ", string.Empty); envelope = translate.GetExtents(matchText); } return envelope; }