laptop and a wrench

Bug

Map::SetExtent does not work consistently when the aspect ratio of the new extent differs from the map display's aspect ratio.

Last Published: August 25, 2014 ArcGIS Runtime for Windows Mobile
Bug ID Number NIM038935
SubmittedOctober 1, 2008
Last ModifiedJune 5, 2024
Applies toArcGIS Runtime for Windows Mobile
Version found9.3
Operating SystemWindows OS
Operating System VersionXP
Version FixedN/A
StatusFixed

Workaround

For code to work in all aspect ratios try the following code- // Assign the new envelope to be the map's envelopedouble dWHAspect = Convert.ToDouble(theMap.Width) / Convert.ToDouble(theMap.Height);double dWHExtent = envelope.Width / envelope.Height;if (dWHAspect > dWHExtent){ // make width wider double dCenterX = envelope.MinX + (envelope.MaxX - envelope.MinX) / 2; double dCenterY = envelope.MinY + (envelope.MaxY - envelope.MinY) / 2; double dHeight = envelope.MaxY - envelope.MinY; double dWidth = dHeight * dWHAspect; envelope = new Envelope(new Coordinate(dCenterX, dCenterY), dWidth, dHeight);}else{ // make height wider double dCenterX = envelope.MinX + (envelope.MaxX - envelope.MinX)/2; double dCenterY = envelope.MinY + (envelope.MaxY - envelope.MinY) / 2; double dWidth = envelope.MaxX - envelope.MinX; double dHeight = dWidth / dWHAspect; envelope = new Envelope(new Coordinate(dCenterX, dCenterY), dWidth, dHeight);}envelope.Resize(1.5);theMap.SetExtent(envelope);theMap.Invalidate();

Steps to Reproduce

Bug ID: NIM038935

Software:

  • ArcGIS Runtime for Windows Mobile

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options