internal class RotateTheMap : Button { private static double _angle = 0; protected override void OnClick() { if (LayoutView.Active == null) return; var layout = LayoutView.Active.Layout; var mapFrame = layout.Elements.OfType<MapFrame>().FirstOrDefault(); if (mapFrame == null) return; QueuedTask.Run(() => { var def = mapFrame.GetDefinition() as CIMMapFrame; if (def.View.ViewingMode != MapViewingMode.Map) return; //2D only _angle -= 15;//Counter-clockwise if (_angle < -345) _angle = 0; var autoCamera = def.AutoCamera; if (autoCamera == null) { //unusual def.AutoCamera = new CIMAutoCamera() { Camera = new CIMViewCamera(), AutoCameraType = AutoCameraType.Extent }; } else if (autoCamera.Source != AutoCameraSource.None && autoCamera.Source != AutoCameraSource.Fixed) { return; } def.View.Camera.Heading = _angle; mapFrame.SetDefinition(def); }); } }
标签:autoCamera,angle,Pro,ArcGIS,mapFrame,var,return,def,sdk From: https://www.cnblogs.com/gisoracle/p/17162167.html