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;
   
        }
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值