private static string GetComments(IDocumentInfo2 documentInfo, Uri uri) { string comments = documentInfo.Comments.Trim(); if (string.IsNullOrEmpty(comments)) { comments = uri.LocalPath; } return comments; }
// Export map frame kml as raster public static void exportMapFrameKmlAsRaster(IMxDocument pMxDoc, string dataFrame, string filePathName, string scale) { IGeoProcessor2 gp = new GeoProcessorClass(); IVariantArray parameters = new VarArrayClass(); // Get the mxd path to pass as the first variable IDocumentInfo2 docInfo = pMxDoc as IDocumentInfo2; string path = docInfo.Path; // Get the bounding box of the map frame //############### This function needs to be updated to incorporate projected map frames, it currently only works if the frame is wgs84 ############# var dict = Utilities.getMapFrameWgs84BoundingBox(pMxDoc, dataFrame); string boundingBox = dict["xMin"] + " " + dict["yMin"] + " " + dict["xMax"] + " " + dict["yMax"]; Debug.WriteLine("Bounding box: " + boundingBox); Debug.WriteLine("mxd path: " + path); // Add parameters parameters.Add(@path); parameters.Add(dataFrame); parameters.Add(@filePathName); parameters.Add(scale); parameters.Add("COMPOSITE"); parameters.Add(false); parameters.Add(boundingBox); // Execute the tool try { Debug.WriteLine("Starting KML output.."); gp.Execute("MapToKML_conversion", parameters, null); Debug.WriteLine("Finished KML output"); } catch (Exception e) { Debug.WriteLine(e); } }
private static string GetTitle(IDocumentInfo2 documentInfo, Uri uri) { string title = documentInfo.DocumentTitle.Trim(); if (string.IsNullOrEmpty(title)) { string filename = Path.GetFileName(uri.LocalPath); title = filename; } return title; }
private static string GetSubject(IDocumentInfo2 documentInfo, Uri uri) { string subject = documentInfo.Subject.Trim(); if (string.IsNullOrEmpty(subject)) { subject = uri.LocalPath; } return subject; }