The map rotation is set using the map frame camera heading before using MapFrame.MapToPoint(MapPoint).
There is a polyline that has several vertices that I am trying to display on the page. The map is rotated to 136 degrees, but it is displaying the point graphics as if it was 0. They also show up outside of the map frame. I never get any result other than this.
Here is where the camera is set up:
await QueuedTask.Run(() =>
{
try
{
Map_ = Map_Item.GetMap();
MapFrame_.SetMap(Map_);
Camera cam = MapFrame_.Camera;
cam.SpatialReference = Map_.SpatialReference;
MapPoint mp = GeometryEngine.Instance.Centroid(tile.pPolygon);
if (!rightToLeft)
cam.Heading = tile.dRotationAngle;
else
cam.Heading = tile.dRotationAngle - 180;
cam.X = mp.X;
cam.Y = mp.Y;
cam.Scale = (double)iScale;
Layout_ = Layout_Item.GetLayout();
MapFrame_.SetCamera(cam);
ProgressBox.WriteLine("Set camera for page " + tile.iPage);
ProgressBox.WriteLine("Set camera for page " + tile.iPage);
}
catch (Exception ex)
{
ProgressBox.WriteLine($"Error setting camera...Now exiting. {ex.Message}");
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"Error setting camera: {ex.Message}.", "Lightning NexGen", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
});
Here is where I get the points in a loop to a location on my polyline, then use the MapToPage function:
// set up Leader to Map Frame
if (bLeaderToMapFrame && map is not null && mapFrame is not null)
{
// get point at the station in the map
var mapPoint = GeometryEngine.Instance.QueryPoint(portion, SegmentExtensionType.NoExtension, dStationH, AsRatioOrLength.AsLength);
if (mapPoint is not null)
{
var pointOnMapFrame = mapFrame.MapToPage(mapPoint);
var pointSymbolmap = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.RedRGB, 4);
ElementFactory.Instance.CreateGraphicElement(layout, pointOnMapFrame, pointSymbolmap);
}
}
Is there anything that can be done? I have looked all over support and documentation.