二,FeatureLayer

FeatureLayer组件能将动态图层,按照您想关联的字段,按照您设置的符号灵活的展现出来,比如gis表中的哪个字段,采用什么样的符号样式等,比较灵活。但其动态加载数据量大时,图层响应比较慢!

属性:

<esri:FeatureLayer id="fLayer"
graphicAdd="fLayer_graphicAddHandler(event)"
mode="snapshot"
outFields="[RJL,SZQX]"
url="http://dengjie/ArcGIS/rest/services/dzsp/TDCZRGZSPT_D/MapServer/0">

graphicAdd:符号被加载,添加到graphic中时触发。

Mode:snapshot,onDemand(默认),selection。

outFields:featurelayer中将用得到的属性字段。

definitionExpression:数据帅选过滤条件.

Symbol:

<esri:FeatureLayer id="fLayer"
fault="fLayer_faultHandler(event)"
load="{doSearch()}"
mode="snapshot"
url="http://dengjie/ArcGIS/rest/services/ed/BJSEDXZQFW_DJ/MapServer/0">
<esri:symbol>
<esri:SimpleFillSymbol id="fillsym" style="null">
<esri:SimpleLineSymbol width="3" color="0x0000FF"/>
</esri:SimpleFillSymbol>
</esri:symbol>
</esri:FeatureLayer>

FeatureLayer下如果没有render或symbol,则其展现和加载其默认的符号;

如果有symbol则按照symbol的设置来展现和加载;

如果有render,则默认的symbol不展现,它会根据render指定的字段的值的情况进行render

Render:

<esri:CompositeSymbol  id="symbol1">
<esri:SimpleMarkerSymbol
alpha="0.7"
color="0xFF0000"
size="6"
style="triangle"/>
</esri:CompositeSymbol>

<esri:CompositeSymbol id="symbol2">
<esri:SimpleMarkerSymbol
alpha="0.7"
color="0xFF0000"
size="10"
style="triangle"/>
</esri:CompositeSymbol>
<esri:CompositeSymbol id="symbol3">
<esri:SimpleMarkerSymbol
alpha="0.7"
color="0xFF0000"
size="16"
style="triangle"/>
</esri:CompositeSymbol>
<esri:CompositeSymbol id="symbol4">
<esri:SimpleMarkerSymbol
alpha="0.7"
color="0xFF0000"
size="22"
style="triangle"/>
</esri:CompositeSymbol>
<esri:CompositeSymbol id="symbol5">
<esri:SimpleMarkerSymbol
alpha="0.7"
color="0xFF0000"
size="26"
style="triangle"/>
</esri:CompositeSymbol>
</fx:Declarations>

<esri:Map>
<esri:extent>
<esri:Extent xmin="313983.806152495" ymin="243957.685897649" xmax="703990.033700897" ymax="441506.532227649">
<esri:SpatialReference wkid="2436"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://dengjie/ArcGIS/rest/services/ed/BJSEDXZQFW/MapServer"/>
<esri:FeatureLayer graphicAdd="featurelayer1_graphicAddHandler(event)"
outFields="[RJL,SZQX]"
mode="onDemand"
url="http://dengjie/ArcGIS/rest/services/dzsp/TDCZRGZSPT_D/MapServer/0">
<esri:renderer>
<esri:ClassBreaksRenderer attribute="RJL">
<esri:ClassBreakInfo maxValue="1" symbol="{symbol1}"/>
<esri:ClassBreakInfo maxValue="2"
minValue="1"
symbol="{symbol2}"/>
<esri:ClassBreakInfo maxValue="3"
minValue="2"
symbol="{symbol3}"/>
<esri:ClassBreakInfo maxValue="5"
minValue="3"
symbol="{symbol4}"/>
<esri:ClassBreakInfo minValue="5" symbol="{symbol5}"/>
</esri:ClassBreaksRenderer>
</esri:renderer>
</esri:FeatureLayer>
</esri:Map>

ClassBreaksRenderer这个渲染器主要是针对数值类型的字段进行渲染,有属性minValue和maxValue指定一个值的范围。

            可以由多个ClassBreakInfo来构成整个字段的范围。

<esri:Map openHandCursorVisible="false">
<esri:extent>
<esri:Extent xmin="313983.806152495" ymin="243957.685897649" xmax="703990.033700897" ymax="441506.532227649">
<esri:SpatialReference wkid="2436"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://dengjie/ArcGIS/rest/services/ed/BJSEDXZQFW/MapServer"/>
<esri:FeatureLayer definitionExpression=" LYLX is not null"
outFields="[LYLX,SZQX]"
url="http://dengjie/ArcGIS/rest/services/dzsp/TDCZRGZSPT_D/MapServer/0">
<esri:infoWindowRenderer>
<fx:Component>
<esri:LabelDataRenderer>
<esri:label>{data.SZQX}</esri:label>
<s:BorderContainer backgroundColor="white"
borderColor="black"
color="green"
cornerRadius="5"
minHeight="0"
minWidth="0">
<s:layout>
<s:VerticalLayout paddingBottom="5"
paddingLeft="5"
paddingRight="5"
paddingTop="5"/>
</s:layout>
<s:Label text="所属区县: {data.SZQX} "/>
<s:Label text="应用类型:{data.LYLX}" toolTip="ASDFASDFASDFASDFASDF"/>
</s:BorderContainer>
</esri:LabelDataRenderer>
</fx:Component>
</esri:infoWindowRenderer>
<esri:renderer>
<esri:UniqueValueRenderer attribute="LYLX">
<esri:UniqueValueInfo value="l">
<esri:symbol>
<esri:CompositeSymbol>
<esri:SimpleMarkerSymbol color="0xFF0000"
size="10"
style="triangle"/>
</esri:CompositeSymbol>
</esri:symbol>
</esri:UniqueValueInfo>
<esri:UniqueValueInfo value="c">
<esri:symbol>
<esri:CompositeSymbol>
<esri:SimpleMarkerSymbol color="0x0000FF"
size="10"
style="triangle"/>
</esri:CompositeSymbol>
</esri:symbol>
</esri:UniqueValueInfo>

</esri:UniqueValueRenderer>
</esri:renderer>
</esri:FeatureLayer>
</esri:Map>

UniqueValueRenderer针对属性字段是字符型,且固定值比较少的情况,的渲染。

infoWindowRenderer的作用是在点击featurelayer的符号时弹出其infowindow。

注意:

发现一个问题,只有CompositeSymbol的symbol才能很好的显示symbol。

属性字段不支持中文,不支持shape.area,shape.len


 

原文地址:https://www.cnblogs.com/tiandi/p/2320061.html