三.Editing

功能需要Editor组件,FeatureLayer和GeometryService几个组件配合使用才能完成。

 Server主要有:GeometryServer,MapServer,FeatureServer,ImageServer。

 Editor它需要FeatureLayer的url是FeatureServer的服务才能进行编辑,  属性outFields的OBJECTID不可用,outFields展示的字段是表示可编辑的字段。

  Editor的编辑Template是FeatureServer的原本属性字段。

toolbarVisible="true"                工具栏  (实现,增,删,改)

toolbarCutVisible="true"           剪切按钮(剪开之后geometry分成几个部分,没有丢失)

toolbarMergeVisible="true"       合并按钮(几个geometry部分合并成一块)

toolbarReshapeVisible="true"    修正按钮(去掉部分边角)

三个按钮都添加之后,工具栏就全了

demo:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               xmlns:esri="http://www.esri.com/2008/ags"
               initialize="application1_initializeHandler(event)"
               pageTitle="Editor with all toolbar options">
    <!--
         This sample shows you how to use the editor component with a full toolbar.
    -->

    <fx:Style>
        @namespace esri "http://www.esri.com/2008/ags";

        esri|InfoWindow
        {
            background-color : #FFFFFF;
            border-thickness : 2;
        }
    </fx:Style>

    <fx:Script>
        <![CDATA[
            import com.esri.ags.components.supportClasses.CreateOptions;
            import com.esri.ags.tasks.GeometryService;
            import com.esri.ags.tools.DrawTool;

            import mx.events.FlexEvent;

            protected function application1_initializeHandler(event:FlexEvent):void
            {
                myEditor.featureLayers = [ fireAreas ];
                var myDrawTypePreferences:CreateOptions = new CreateOptions();
                // change the defauls drawing tool from "point-to-point" to "freehand"
                myDrawTypePreferences.polygonDrawTools = [ DrawTool.FREEHAND_POLYGON, DrawTool.POLYLINE, CreateOptions.AUTO_COMPLETE ];
                myEditor.createOptions = myDrawTypePreferences;
            }
        ]]>
    </fx:Script>

    <mx:VBox width="100%" height="100%">

        <esri:Map id="myMap" wrapAround180="true">
            <esri:extent>
                <esri:Extent id="sheepfire"
                             xmin="-13144000" ymin="4033000" xmax="-13066000" ymax="4099000">
                    <esri:SpatialReference wkid="102100"/>
                </esri:Extent>
            </esri:extent>
            <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
            <esri:FeatureLayer id="fireAreas"
                               mode="snapshot"
                               outFields="*"
                               url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/FeatureServer/2"/>
        </esri:Map>
        <esri:Editor id="myEditor"
                     width="100%"
                     geometryService="{new GeometryService('http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer')}"
                     map="{myMap}"
                     toolbarCutVisible="true"
                     toolbarMergeVisible="true"
                     toolbarReshapeVisible="true"
                     toolbarVisible="true"/>
        <s:Label width="100%" text="This feature layer has {fireAreas.numGraphics} ({fireAreas.selectedFeatures.length} selected) fire areas."/>

    </mx:VBox>
</s:Application>

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值