标签:des style blog http color io os 使用 ar
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 |
|
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). |
|
|
Allows you to work with an Image Service resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above). |
|
|
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). |
|
|
Allows you to add ArcIMS image services to your map. |
|
|
Base class for all dynamic layers that can be added to a map. |
|
|
The feature layer can be used to display features from one single layer of either a Feature Service or a Map Service. |
|
|
Allows you to view a geoprocessing task result. |
|
|
A layer that contains one or more Graphic features. |
|
|
The KMLLayer is used to create a layer based on a publicly accessible KML file (.kml,.kmz). |
|
|
Base class for all layers that can be added to a map. |
|
|
The MapImageLayer class is used to add georeferenced images to the map. |
|
|
Allows you to use basemaps from OpenStreetMap. |
|
|
Base class for all tiled layers that can be added to a map. |
|
|
A layer for OGC Web Map Services. |
|
|
|
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 |
|
|
The geometry that defines the graphic. |
Graphic |
|
|
[read-only] Return the parent as an instance of GraphicsLayer. |
Graphic |
|
|
infoWindowRenderer : IFactory The info renderer. |
Graphic |
|
|
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的连通性是好的,如果报错(只要不改配置文件,一般不会报错),根据信息调整,(这个出错很蛋疼啊。。),这个问题太多,出问题的时候我也一直没能解决,上次搞好,就备份了一下,没敢动了。
标签:des style blog http color io os 使用 ar
原文地址:http://www.cnblogs.com/alanjl/p/4014801.html