博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
FeatureLayer的用法
阅读量:2393 次
发布时间:2019-05-10

本文共 5296 字,大约阅读时间需要 17 分钟。

当加载FeatureLayer时为每个Feature增加监听

protected function fLayer_graphicAddHandler(event:GraphicEvent):void            {                // just so we can add tool tips                event.graphic.toolTip = event.graphic.attributes.Name + "\n";                event.graphic.toolTip += "Magnitude " + myOneDecimalFormatter.format(event.graphic.attributes.Magnitude) + " earthquake";                if (event.graphic.attributes.Num_Deaths)                {                    event.graphic.toolTip += "\n(" + event.graphic.attributes.Num_Deaths + " people died)";                }            }

protected function fLayer_graphicAddHandler(event:GraphicEvent):void            {                // just so we can add tool tips                event.graphic.toolTip = event.graphic.attributes.Name + "\n";                event.graphic.toolTip += "Magnitude " + myOneDecimalFormatter.format(event.graphic.attributes.Magnitude) + " earthquake";                if (event.graphic.attributes.Num_Deaths)                {                    event.graphic.toolTip += "\n(" + event.graphic.attributes.Num_Deaths + " people died)";                }            }

查询时,增加筛选的事件

private function doSearch():void            {                // fLayer.layerDetails.displayField                fLayer.definitionExpression = "STATE_NAME like '" + qText.text + "'";            }            // the following four functions are 'just' error handling and showing/hiding the busy cursor            protected function fLayer_updateStartHandler(event:LayerEvent):void            {                this.cursorManager.setBusyCursor();            }            protected function fLayer_updateEndHandler(event:LayerEvent):void            {                if (event.fault)                {                    trace("updateEnd: " + event.fault); // maybe a badly formatted query?                }                else if (event.updateSuccess == false)                {                    trace(event.type + ": " + event.updateSuccess + " ... unexpected failure");                }                else // things seem OK                {                    if (FeatureLayer(event.layer).numGraphics < 1)                    {                        Alert.show("Sorry, found no such features, please try something else");                    }                }                this.cursorManager.removeBusyCursor();            }            protected function fLayer_faultHandler(event:FaultEvent):void            {                Alert.show(event.fault.faultString + "\n\n" + event.fault.faultDetail, "FeatureLayer Fault " + event.fault.faultCode);            }            protected function fLayer_loadErrorHandler(event:LayerEvent):void            {                Alert.show(event.fault.faultString + "\n\n" + event.fault.faultDetail, "FeatureLayer Load Error " + event.fault.faultCode);            }

为Feature增加监听

protected function fLayer_graphicAddHandler(event:GraphicEvent):void            {                event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);                event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);            }            private function onMouseOverHandler(event:MouseEvent):void            {                var gr:Graphic = Graphic(event.target);                gr.symbol = mouseOverSymbol;                myTextArea.textFlow = TextFlowUtil.importFromString("2000 Population: " + gr.attributes.POP2000.toString() + "
" + "2000 Population per Sq. Mi.: " + gr.attributes.POP00_SQMI.toString() + "
" + "2007 Population: " + gr.attributes.POP2007 + "
" + "2007 Population per Sq. Mi.: " + gr.attributes.POP07_SQMI); myMap.infoWindow.label = gr.attributes.NAME; myMap.infoWindow.closeButtonVisible = false; myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY)); } private function onMouseOutHandler(event:MouseEvent):void { var gr:Graphic = Graphic(event.target); gr.symbol = defaultsym; myMap.infoWindow.hide(); }

FeatureLayer选择要素使之高亮显示

protected function button2_clickHandler(event:MouseEvent):void			{				var query:Query=new Query();				query.where="RainYN like '0'";				fLayer.selectFeatures(query,"new");			}

获取所有feature

protected function button2_clickHandler(event:MouseEvent):void			{				var arr:ArrayCollection=fLayer.graphicProvider as ArrayCollection;				Alert.show(arr.length.toString());							}

feature 具有event.graphic.visible=false;属性。

在权限控制的时候,帅选显示要素

            protected function button3_clickHandler(event:MouseEvent):void

            {
                fLayer.definitionExpression = "NOT (Name IN('徐图港西闸站','田大港闸站'))" ;               
            }

FeatureLayer的update_end事件,当更新时,包括地图放大、缩小、漫游、重新过滤筛选feature。

featureLayer.addEventListener(LayerEvent.UPDATE_END,updateEndHandler);				function updateEndHandler(event:LayerEvent):void{					var arr:ArrayCollection=featureLayer.graphicProvider as ArrayCollection;					Alert.show(arr.length.toString());				}

-------------------------------------------------------------------------------------------------------------------

转载地址:http://wcgab.baihongyu.com/

你可能感兴趣的文章
Tensorflow Python API 翻译(math_ops)(第一部分)
查看>>
Tensorflow Python API 翻译(math_ops)(第二部分)
查看>>
Tensorflow Python API 翻译(array_ops)
查看>>
Tensorflow Python API 翻译(constant_op)
查看>>
金融套利策略:理解统计套利的工作原理
查看>>
利用 TensorFlow 入门 Word2Vec
查看>>
课程 | 浅析数据标准化和归一化,优化机器学习算法输出结果
查看>>
多任务学习与深度学习
查看>>
利用 TensorFlow 一步一步构建一个多任务学习模型
查看>>
使用数据驱动进行配对交易:简单交易策略
查看>>
量化交易:相关系数
查看>>
课程---程序员炒股,如何计算股票投资组合的风险和收益
查看>>
人工智能资料库:第1辑(20170105)
查看>>
人工智能资料库:第2辑(20170106)
查看>>
人工智能资料库:第3辑(20170107)
查看>>
人工智能资料库:第4辑(20170108)
查看>>
人工智能资料库:第5辑(20170109)
查看>>
人工智能资料库:第6辑(20170110)
查看>>
人工智能资料库:第20辑(20170129)
查看>>
人工智能资料库:第21辑(20170130)
查看>>