laptop and a wrench

Bogue

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

Dernière publication: August 25, 2014 ArcGIS Runtime for Windows Mobile
Numéro d’ID de bogue NIM038935
EnvoiOctober 1, 2008
Dernière modificationJune 5, 2024
S’applique àArcGIS Runtime for Windows Mobile
Version trouvée9.3
Système d’exploitationWindows OS
Version du système d’exploitationXP
Version de correctionN/A
StatutFixed

Solution de contournement

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();

Étapes pour reproduire

ID de bogue: NIM038935

Logiciel:

  • ArcGIS Runtime for Windows Mobile

Recevoir une notification lorsque le statut d’un bogue change

Télécharger l’application Esri Support

En savoir plus sur ce sujet

Obtenir de l’aide auprès des experts ArcGIS

Contacter le support technique

Télécharger l’application Esri Support

Accéder aux options de téléchargement