1.flex 的简介

a) Flex是adobe开发的东西,主要特点就是开发一个swf格式的应用,flex可以做桌面的应用和web的应用,但本质差不多。

b) Flex采用mxml的格式来进行应用的布局,然后用ActionScript进行脚本处理。

例子:

在application中放进一个eris的map控件,map的一个load函数 为loadHandler

<s:Application>

<fx:Script>

<![CDATA[

private function loadHandler():void

{

}

]]>

</fx:Script>

<eris:map load="loadHandler()">

</s:Application>

c) Acrgis for flex其实就是引进一个jar包(但flex真实为swc包),然后就可以进行调用Acrgis 的函数

2.Argis简介

a) Arcigs 是专门处理地图的,它自己拥有acgis map ,arcgis server的软件来进行处理和发布地图。

b) 地图有很多种的格式,flex要进行调用的话必须清楚服务器url是什么格式。比如什么wms,wmts,什么的,我也不是很清楚。、

c) 但调用地图我们自己做的是acgis的专门地图的服务,只需要初始化一个ArcGISDynamicMapServiceLayer 对象然后设定他的url(我们服务器的url)就行。

private var

huiluCommunityWMS:ArcGISDynamicMapServiceLayer =

new ArcGISDynamicMapServiceLayer();

huiluCommunityWMS.url =  "http://localhost:6080/arcgis/rest/services/myserver/Map Server";

这样huiluCommunityWMS对象就创建了,然后map.addLayers(huiluCommunityWMS);后就可以在map中显示这个地图

下面这些都是acgis地图的类,ArcGISDynamicMapServiceLayer 只是其中一个,南方数码给我们提供的就是TiledMapServiceLayer这样的类的地图,但这种类的地图需要自定义一个类并且进行继承,然后再指定他的url啊,他的区域范围之类的一些属性啊后 方可使用。

(自定义一个类 这个类在源码中的layer包的WMTSLayer_province)

Class

Description

ArcGISDynamicMapServiceLayer

Allows you to work with a dynamic map service resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above).

ArcGISImageServiceLayer

Allows you to work with an Image Service resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above).

ArcGISTiledMapServiceLayer

Allows you to work with a cached map service resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above).

ArcIMSMapServiceLayer

Allows you to add ArcIMS image services to your map.

DynamicMapServiceLayer

Base class for all dynamic layers that can be added to a map.

FeatureLayer

The feature layer can be used to display features from one single layer of either a Feature Service or a Map Service.

GPResultImageLayer

Allows you to view a geoprocessing task result.

GraphicsLayer

A layer that contains one or more Graphic features.

KMLLayer

The KMLLayer is used to create a layer based on a publicly accessible KML file (.kml,.kmz).

Layer

Base class for all layers that can be added to a map.

MapImageLayer

The MapImageLayer class is used to add georeferenced images to the map.

OpenStreetMapLayer

Allows you to use basemaps from OpenStreetMap.

TiledMapServiceLayer

Base class for all tiled layers that can be added to a map.

WMSLayer

A layer for OGC Web Map Services.

WMTSLayer

d) 好了,我们现在能创建了一个map和显示地图,然后怎么在上面就行划线啊,标志啊啥的呢。其实map是一个对象,ArcGISDynamicMapServiceLayer 地图 是map下一级的对象,而标志,划线啥的同ArcGISDynamicMapServiceLayer 地图对象一样,也是map的下一级对象GraphicsLayer ,同样是addlayer这个方法给加进去。

private var fillGraphicLayer:GraphicsLayer = new  GraphicsLayer();

map.addLayer(fillGraphicLayer);

GrapicsLayer就是显示划线啊,标记啊之类的Layer,同地图具有等同的地位。

然后划线,标记这种对象是GrapicsLayer的下一级对象

Graphic

Property

Defined By

attributes : Object

Name-value pairs of fields and field values associated with the graphic.

Graphic

checkForMouseListeners : Boolean

Prevents the map from zooming and panning when the mouse is over the graphic and the graphic has registered mouse listeners.

Graphic

geometry : Geometry

The geometry that defines the graphic.

Graphic

graphicsLayer : GraphicsLayer

[read-only] Return the parent as an instance of GraphicsLayer.

Graphic

infoWindowRenderer : IFactory

The info renderer.

Graphic

symbol : Symbol

The symbol for the graphic.

如上图,Graphic有Attribute,geometry,symbol着三个最重要的属性。 Attribute是他可以加上去的一些参数。这些参数传给他的一些Label,button这种实际的控件,

<s:Label id="myLabel"  text ="{data}">

如上。Data 等同于Graphic的Attribute 属性。而geometry属性是说明这个Graphic的形状,

Constant

Defined By

EXTENT : String = esriGeometryEnvelope

[static] An extent is defined by xmin, ymin, xmax and ymax.

Geometry

MAPPOINT : String = esriGeometryPoint

[static] A MapPoint is a basic point with x (often longitude), y (often latitude) and an optional spatial reference.

Geometry

MULTIPOINT : String = esriGeometryMultipoint

[static] A multipoint consists of one or more MapPoint(s).

Geometry

POLYGON : String = esriGeometryPolygon

[static] A polygon is a set of areas with three or more points.

Geometry

POLYLINE : String = esriGeometryPolyline

[static] A polyline is set of lines with two or more points.

MAPPOINT 是一个点,polyline是线,等等,但注意的是polyline初始化时

var drawPointArray:Array = new Array();

var drawPointPath:Array = new Array();

drawPointPath.push(drawPointArray);

var drawLine:Polyline = new Polyline(drawPointPath);

fillgraphic.geometry = drawLine;

drawPointPath是一个Array,这个Array包含的是包含Mappoint的Array。

然后比较重要的是symbol,这是标志的形状。

Base class for all symbols. To display points, polylines and polygons on the graphics layer, instead use the following:

共有上面分别对应形状的symbol,比如做的那个摄像头标记就是用的PictureMarkerSymbol,话线的是SimpleLineSymbol, 这些都定义在

<fx:Declarations>

<esri:SimpleMarkerSymbol id="sms"

alpha="0.9"

color="0xFFFF00"

size="11"

style="square">

<esri:SimpleLineSymbol color="0x000000"/>

</esri:SimpleMarkerSymbol>

<esri:PictureMarkerSymbol id="spms"

source="@Embed(source='assets/camera.png')"

height = "25"

width = "40"

/>

<!-- Symbol for Find Result as Polyline -->

<esri:SimpleLineSymbol id="sls"

width="4"

alpha="1"

color="0xFF0000"

style= "dashdot"

/>

<!-- Symbol for Find Result as Polygon -->

<esri:SimpleFillSymbol id="sfs"

alpha="0.7"

color="0xFFFF00"/>

</fx:Declarations>

如做的那个摄像头的图片标志用的便是PictureMarkerSymbol 。

3.flex与java进行交互

a) flex是无法与数据库直接打交道的,所以我们使用blazeds这种方法进行与java交互传输数据,并且由java与数据库打交道。

b) 参考资料 http://bbs.9ria.com/thread-84889-1-1.html

c) 首先我们定义一个在flex中的RemoteObject对象

<!--一个RemoteObject对象,通过这个对象来与java进行交互通信,buildingOperationDestination这个destination是对应着java中的类,这个由remoting-object.xml定义,详细请查看java与flex交互的参考资料-->

<mx:RemoteObject id="remoteObject" destination="buildingOperationDestination"

result="remoteObject_resultHandler(event)"

fault="remoteObject_faultHandler(event)" endpoint = "http://localhost:8080/WebIC/messagebroker/amf"/>

这个对象是对应到buildingOperationDestination,而这个配置是在WebIC下Webcontent下Web-Inf下 flex下remoting-config.xml中定义的

<destination id="buildingOperationDestination" channels="my-amf">

<properties>

<source>flexutils.BuidlingOperation</source>

</properties>

</destination>

flexutils.BuidlingOperation是WebIC项目下src项目下的类

d) 配置已经做好,如果出问题了,我写了一个测试的类,

上面的testConnectionJava.html

如果是上面的显示,就证明java与flex的连通性是好的,如果报错(只要不改配置文件,一般不会报错),根据信息调整,(这个出错很蛋疼啊。。),这个问题太多,出问题的时候我也一直没能解决,上次搞好,就备份了一下,没敢动了。

关于arcgi s_api_for_flex的总结的更多相关文章

  1. 如何在ArcGIS中恢复注记文字

    文字标注是地图上一种特殊的视觉元素,可通过文字表达图形符号难以说明的地图内容,它与图形符号结合在一起存在于地图上,是关乎地图构图美的关键因素之一. MapGIS软件下子图对象和注释对象统统保存在点文件 ...

随机推荐

  1. golang基础之二-基本数据类型和操作符

    文件名&关键字&标识符 所有go源码都是以.go结尾 标识符以字母或下划线开头,大小写敏感 下划线_是特殊标识符,用户忽略结果 保留关键字 导入包时可以设置别名 下面是保留关键字: b ...

  2. IEnumerable的几个简单用法

    咋一看到IEnumerable这个接口,我们可能会觉得很神奇,在一般的编程时,基本上我们是想不到去用它的,可是,俗话说得好,存在便是道理,那么,它对我们来说,能够带来哪些奇妙的事情呢? 要想弄懂它,我 ...

  3. hdu 3573(数学+贪心)

    Buy Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  4. cfg 4 ocl

    http://blog.sina.com.cn/s/blog_6c868c470102v15y.html rnnlib真难装 http://sourceforge.net/p/rnnl/wiki/Ho ...

  5. 常用的scrapy setting

    原文请参考    Scrapy 爬虫入门教程十三 Settings(设置), 讲的很详细 官网参考  Settings 设置 Scrapy 设置允许您自定义所有 Scrapy 组件的行为,包括核心,扩 ...

  6. 利用nodeJs anywhere搭建本地服务器环境【转载】

    首先去nodeJs官网下载最新版nodeJs     https://nodejs.org/en/ 安装成功后win+r打开cmd 输入node -help 或者node -v查看是否安装成功 装好后 ...

  7. js屏蔽手机的物理返回键

    $(document).ready(function() { if (window.history && window.history.pushState) { $(window).o ...

  8. loadrunner 分用户日志

    loadrunner 分用户日志 loadrunner在run脚本时,模拟多用户并发场景下,通常需要分别关注每个用户的脚本执行日志,可以按照以下操作进行: 在“Run Load Tests”中选择需要 ...

  9. Java经典设计模式之十一种行为型模式

    转载: Java经典设计模式之十一种行为型模式 Java经典设计模式共有21中,分为三大类:创建型模式(5种).结构型模式(7种)和行为型模式(11种). 本文主要讲行为型模式,创建型模式和结构型模式 ...

  10. 转:一步一步学ROP之linux_x86篇 - 蒸米

    原文地址:http://drops.wooyun.org/tips/6597 0×00 序 ROP的全称为Return-oriented programming(返回导向编程),这是一种高级的内存攻击 ...