Public Function GetMapView( _ ByVal layoutView As LayoutView _ ) As MapView
public MapView GetMapView( LayoutView layoutView )
Parameters
- layoutView
Return Value
Returns a MapView.
Public Function GetMapView( _ ByVal layoutView As LayoutView _ ) As MapView
public MapView GetMapView( LayoutView layoutView )
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
{
//Export the map view associated with a map frame to BMP.
string filePath = @"Path and file name for the output export file";
//Create BMP format with appropriate settings
//EMF, EPS, GIF, JPEG, PDF, PNG, SVG, TGA, and TFF formats are also available for export
BMPFormat BMP = new BMPFormat()
{
Resolution = 300,
Height = 500,
Width = 800,
HasWorldFile = true,
OutputFileName = filePath
};
//Export on the worker thread
await QueuedTask.Run(() =>
{
MapView mv_bmp = mapFrame.GetMapView(layoutView);
if (mv_bmp != null)
{
//Check to see if the path is valid and export
if (BMP.ValidateOutputFilePath())
{
mv_bmp.Export(BMP); //Export to BMP
}
}
});
}
{
//Note: run within the QueuedTask
var autoCamera = mapFrame.GetAutoCamera();
autoCamera.Source = AutoCameraSource.Fixed;
autoCamera.AutoCameraType = AutoCameraType.CenterAndScale;
var camera = mapFrame.GetMapView(LayoutView.Active).Camera;
var center = mapFrame.GetViewCenter();
//var extent = EnvelopeBuilderEx.CreateEnvelope(
// 400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference);
//autoCamera.Extent = extent;
var camera2 = new CIMViewCamera()
{
Heading = 0,
Pitch = -90,
Roll = 0,
Scale = 21169571,
X = 1310669.0 + ((400748.5 - 1310669.0) / 2.0),
Y = 800296.4 + ((1424520.74 - 800296.4) / 2.0),
Z = double.NaN
};
autoCamera.Camera = camera2;
var states = mapFrame.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
//autoCamera.IntersectLayerPath = states.URI;
if (mapFrame.ValidateAutoCamera(autoCamera) &&
!mapFrame.IsMapSeriesMapFrame())
mapFrame.SetAutoCamera(autoCamera);
}
{
//Note: run within the QueuedTask
var autoCamera = mapFrame.GetAutoCamera();
autoCamera.Source = AutoCameraSource.Fixed;
autoCamera.AutoCameraType = AutoCameraType.Center;
var camera = mapFrame.GetMapView(LayoutView.Active).Camera;
var center = mapFrame.GetViewCenter();
//var extent = EnvelopeBuilderEx.CreateEnvelope(
// 400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference);
//autoCamera.Extent = extent;
var camera2 = new CIMViewCamera()
{
Heading = 0,
Pitch = -90,
Roll = 0,
Scale = 21169571,
X = 855708,
Y = 1112409,
Z = double.NaN
};
autoCamera.Camera = camera2;
var states = mapFrame.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
autoCamera.IntersectLayerPath = states.URI;
if (mapFrame.ValidateAutoCamera(autoCamera) &&
!mapFrame.IsMapSeriesMapFrame())
mapFrame.SetAutoCamera(autoCamera);
}
{
//Note: run within the QueuedTask
var autoCamera = mapFrame.GetAutoCamera();
autoCamera.Source = AutoCameraSource.Fixed;
autoCamera.AutoCameraType = AutoCameraType.Scale;
var camera = mapFrame.GetMapView(LayoutView.Active).Camera;
var center = mapFrame.GetViewCenter();
//var extent = EnvelopeBuilderEx.CreateEnvelope(
// 400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference);
//autoCamera.Extent = extent;
var camera2 = new CIMViewCamera()
{
Heading = 0,
Pitch = -90,
Roll = 0,
Scale = 20000571,
X = 1310669.0 + ((400748.5 - 1310669.0) / 2.0),
Y = 800296.4 + ((1424520.74 - 800296.4) / 2.0),
Z = double.NaN
};
autoCamera.Camera = camera2;
var states = mapFrame.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
//autoCamera.IntersectLayerPath = states.URI;
if (mapFrame.ValidateAutoCamera(autoCamera) &&
!mapFrame.IsMapSeriesMapFrame())
mapFrame.SetAutoCamera(autoCamera);
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)