void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e) { if (oldScale != m_mapControl.MapScale) { // Fill with cached map scales double[] cachedScales = new double[] { 1500, 15000, 55000, 125000, 350000, 750000, 1500000, 3500000, 13000000, 60000000 }; double newScale = cachedScales[cachedScales.Length-1]; // Scale changed! // Scale to the closest scale level of cached map service for (int i = 1; i<cachedScales.Length; i++) { if (cachedScales >= m_mapControl.MapScale) { if (Math.Abs(cachedScales[i - 1] - m_mapControl.MapScale) <= Math.Abs(cachedScales - m_mapControl.MapScale)) { newScale = cachedScales[i - 1]; } else { newScale = cachedScales; } break; } } oldScale = newScale; m_mapControl.MapScale = newScale; m_mapControl.ActiveView.Refresh(); oldScale = m_mapControl.MapScale; } }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.