public class TGAFormat : ExportFormat
Public Class TGAFormat Inherits ExportFormat
public class TGAFormat : ExportFormat
Public Class TGAFormat Inherits ExportFormat
//This example demonstrates how to export a layout to TGA. //Added references using ArcGIS.Desktop.Core; //Project using ArcGIS.Desktop.Layouts; //Layout classes using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //Export formats public class ExportLayoutToTGAExample { public static Task ExportLayoutToTGAAsync(string LayoutName, string Path) { //Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName)); if (layoutItem == null) return Task.FromResult<Layout>(null); //Create TGA format with appropriate settings TGAFormat TGA = new TGAFormat(); TGA.Resolution = 300; TGA.OutputFileName = Path; return QueuedTask.Run(() => { //Export Layout Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem if (TGA.ValidateOutputFilePath()) { lyt.Export(TGA); } }); } }
//This example demonstrates how to export an individual map frame on a layout to TGA. //Added references using ArcGIS.Desktop.Core; //Project using ArcGIS.Desktop.Layouts; //Layout classes using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //Export formats public class ExportMapFrameToTGAExample { public static Task ExportMapFrameToTGAAsync(string LayoutName, string MFName, string Path) { //Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName)); if (layoutItem == null) return Task.FromResult<Layout>(null); //Create TGA format with appropriate settings TGAFormat TGA = new TGAFormat(); TGA.Resolution = 300; TGA.OutputFileName = Path; return QueuedTask.Run(() => { //Export MapFrame Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem MapFrame mf = lyt.FindElement(MFName) as MapFrame; TGA.OutputFileName = Path; if (TGA.ValidateOutputFilePath()) { mf.Export(TGA); } }); } }
//This example demonstrates how to export the active mapview to TGA. //Added references using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //MapView and Export formats public class ExportActiveMapToTGAExample { public static Task ExportActiveMapToTGAAsync(string Path) { return QueuedTask.Run(() => { //Reference the active map view MapView mapv = MapView.Active; //Create TGA format with appropriate settings TGAFormat TGA = new TGAFormat(); TGA.Resolution = 300; TGA.Height = 500; TGA.Width = 800; TGA.OutputFileName = Path; //Export active map view if (TGA.ValidateOutputFilePath()) { mapv.Export(TGA); } }); } }
TGAFormat TGA = new TGAFormat();
System.Object
ArcGIS.Desktop.Mapping.ExportFormat
ArcGIS.Desktop.Mapping.TGAFormat
Target Platforms: Windows 11, Windows 10