/// Procedure to clear AFDMapData Structure /// </summary> /// <param name="details">AFDData to be cleared</param> public void ClearAFDMapData(ref afdMapData details) { details.GBGridE = string.Empty; details.GBGridN = string.Empty; details.NIGridE = string.Empty; details.NIGridN = string.Empty; details.Latitude = string.Empty; details.Longitude = string.Empty; details.TextualLatitude = string.Empty; details.TextualLongitude = string.Empty; details.ImageWidth = string.Empty; details.ImageHeight = string.Empty; details.ImageScale = string.Empty; details.OutputType = string.Empty; details.Filename = string.Empty; }
/// <summary> /// Function to lookup Map data - used for map utility functions only /// </summary> /// <param name="dataName">Field Specification String</param> /// <param name="operation">Function Type Constants</param> /// <param name="details">Object containing search/lookup values. Becomes populated with results</param> /// <returns>The function returns a long which is the result code. This will be >= 0 if the function is successful, or < 0 in the case of an error</returns> public long AFDData(string dataName, long operation, ref afdMapData details) { StringBuilder passDetails = new StringBuilder(); long retVal; // Compose the DLL string from the supplied structure passDetails.Append(details.GBGridE.PadRight(10, ' ')); passDetails.Append(details.GBGridN.PadRight(10, ' ')); passDetails.Append(details.NIGridE.PadRight(10, ' ')); passDetails.Append(details.NIGridN.PadRight(10, ' ')); passDetails.Append(details.Latitude.PadRight(10, ' ')); passDetails.Append(details.Longitude.PadRight(10, ' ')); passDetails.Append(details.TextualLatitude.PadRight(15, ' ')); passDetails.Append(details.TextualLongitude.PadRight(15, ' ')); passDetails.Append(details.ImageWidth.PadRight(4, ' ')); passDetails.Append(details.ImageHeight.PadRight(4, ' ')); passDetails.Append(details.ImageScale.PadRight(1, ' ')); passDetails.Append(details.OutputType.PadRight(1, ' ')); passDetails.Append(details.Filename.PadRight(255, ' ')); // Call the DLL function string returnDetails = CallDllFunction(dataName, operation, passDetails, out retVal); // Retrieve the data structure from the string returned by the DLL details.GBGridE = returnDetails.Substring(0, 10).Trim(); details.GBGridN = returnDetails.Substring(10, 10).Trim(); details.NIGridE = returnDetails.Substring(20, 10).Trim(); details.NIGridN = returnDetails.Substring(30, 10).Trim(); details.Latitude = returnDetails.Substring(40, 10).Trim(); details.Longitude = returnDetails.Substring(50, 10).Trim(); details.TextualLatitude = returnDetails.Substring(60, 15).Trim(); details.TextualLongitude = returnDetails.Substring(75, 15).Trim(); details.ImageWidth = returnDetails.Substring(90, 4).Trim(); details.ImageHeight = returnDetails.Substring(94, 4).Trim(); details.ImageScale = returnDetails.Substring(98, 1).Trim(); details.OutputType = returnDetails.Substring(99, 1).Trim(); details.Filename = returnDetails.Substring(100, 255).Trim(); // Return with the function return value return(retVal); }