本示例中使用ArcGIS for Flex API进行演示,扇区数据查询有两种方法,一种是使用控件初始化,另一种为代码动态生成,分别如下:
一、
<esri:FeatureLayer id="sanqu" url="http://*.*.*.*:8000/arcgis/rest/services/lianTong/MapServer/0"
outFields="*"
symbol="{defaultsym}"
mode="onDemand"
>
<esri:infoWindowRenderer>
<fx:Component>
<mx:VBoxbackgroundColor="0xffffff"
color="0x444444"
label="Parcel {data.PARCELID}">
<mx:Labeltext="OBJECTID : {data.OBJECTID}"/>
<mx:Labeltext="方位角: {data.AZIMUTH}"/>
<mx:Labeltext="角度: {data.CENTERANGLE}"/>
<mx:Labeltext="半径: {data.RADIUS}"/>
</mx:VBox>
</fx:Component>
</esri:infoWindowRenderer>
</esri:FeatureLayer>
二、
<esri:FeatureLayer id="sanqu" url="http://*:8000/arcgis/rest/services/lianTong/MapServer/0"
outFields="*"
click="sanqu_clickHandler(event)"
symbol="{defaultsym}"
mode="onDemand"
>
</esri:FeatureLayer>
//扇区图层点击事件
protectedfunctionsanqu_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
if (event.target is Graphic ||event.target.parent is Graphic)
{
var gr:Graphic =Graphic(event.target);
gr.symbol=(gr.symbol==clickSymbol?defaultsym:clickSymbol);
myTextArea.htmlText= "<b>OBJECTID: </b>" + gr.attributes.OBJECTID.toString() + "\n"
+"<b>方位角: </b>" + gr.attributes.AZIMUTH.toString() + "\n"
+"<b>中心夹角: </b>" + gr.attributes.CENTERANGLE + "\n"
+"<b>半径:</b>" +gr.attributes.RADIUS ;
MyMap.infoWindow.label= gr.attributes.OBJECTID;
MyMap.infoWindow.show(MyMap.toMapFromStage(event.stageX,event.stageY));
}
}
效果如下图所示: