Flex3+ArcGIS+API改变鼠标停留在导航条时显示的提示信息
以下代码来自网络,主要通过两个类文件实现改变鼠标停留在导航条时显示的提示信息。在工程中添加这两个类文件后,还需设置Map的navigationClass指向MyNavigation 第一个类:MyNavigation package controls { ??? import com.esri.ags.controls.Navigation; ??? import mx.core.UIComponent; ??? import mx.controls.Spacer; ??? ??? public class MyNavigation extends Navigation ??? { ??? ??? public function MyNavigation() ??? ??? { ??? ??? ??? super(); ??????????? // use MyNavigationSlider ??????????? navigationSliderClass = MyNavigationSlider; ??? ??? } ??? ??? ??? ??? ?override protected function addZoomInZoomOutComponents( ??????????? zoomInButton:UIComponent,??????????? zoomOutButton:UIComponent ??????? ):void ??????? { ??????? ??? zoomOutButton.toolTip = "缩小"; ??????? ??? zoomInButton.toolTip = "放大"; ??????????? addChild( new Spacer()); ??????????? addChild( zoomInButton ); ??????????? addChild( zoomOutButton ); ??????????? addChild( new Spacer()); ??????? } ??? } } 第二个类:MyNavigationSlider package controls { ??? import com.esri.ags.Map; ??? import com.esri.ags.controls.navigationClasses.NavigationSlider; ??? import com.esri.ags.layers.LOD; ??? ??? public class MyNavigationSlider extends NavigationSlider ??? { ??? ??? public function MyNavigationSlider() ??? ??? { ??? ??? } ??? ??? ??? ???? /** ??? ???? * Formats the data tip text based on the level of the map. ??? ???? * ??? ???? * @param value the map level. ??? ???? * @return the data tip text. ??? ???? */ ??? ??? override protected function formatDataTip(value:Number):String ??? ??? { ??? ??????? var result:String; ??? ??? ??????? var lod:LOD = map.lods[value]; // get the LOD for the given level ??? ??????? var scale:Number = lod.scale; ??? ??? ??????? if (scale < 10000) ??? ??????? { ??? ??????????? result = "Neighborhood"; ??? ??????? } ??? ??????? else if (scale < 100000) ??? ??????? { ??? ??????????? result = "City" ??? ??????? } ??? ??????? else if (scale < 1400000) ??? ??????? { ??? ??????????? result = "County" ??? ??????? } ??? ??????? else if (scale < 5000000) ??? ??????? { ??? ??????????? result = "State/Province" ??? ??????? } ??? ??????? else if (scale < 20000000) ??? ??????? { ??? ??????????? result = "Country" ??? ??????? } ??? ??????? else if (scale < 50000000) ??? ??????? { ??? ??????????? result = "Region" ??? ??????? } ??? ??????? else if (scale < 100000000) ??? ??????? { ??? ??????????? result = "Continent" ??? ??????? } ??? ??????? else ??? ??????? { ??? ??????????? result = "World" ??? ??????? } ??? ??? ??????? return result; ??? ??? ??? } ??? } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |