关于arcgi s_api_for_flex的总结
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:
- Points (MapPoint): SimpleMarkerSymbol, PictureMarkerSymbol, TextSymbol, InfoSymbol or CompositeSymbol.
- Multipoints: SimpleMarkerSymbol, PictureMarkerSymbol or CompositeSymbol.
- Polylines: SimpleLineSymbol, CartographicLineSymbol or CompositeSymbol (and the same symbols as Multipoint for the individual nodes of the line).
- Polygons: SimpleFillSymbol, PictureFillSymbol or CompositeSymbol (and the same symbols as Multipoint for the individual nodes of the polygon).
共有上面分别对应形状的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的总结的更多相关文章
- 如何在ArcGIS中恢复注记文字
文字标注是地图上一种特殊的视觉元素,可通过文字表达图形符号难以说明的地图内容,它与图形符号结合在一起存在于地图上,是关乎地图构图美的关键因素之一. MapGIS软件下子图对象和注释对象统统保存在点文件 ...
随机推荐
- webconfig的配置解析
<?xml version="1.0"?> <!--注意: 除了手动编辑此文件以外,您还可以使用 Web 管理工具来配置应用程序的设置.可以使用 Visual S ...
- django框架<三>
一.ORM操作 1.django orm创建数据库的方法 (1)指定连接pymysql(python3.x),先配置__init__.py import pymysql pymysql.instal ...
- C++ 模板特化以及Typelist的相关理解
近日,在学习的过程中第一次接触到了Typelist的相关内容,比如Loki库有一本Modern C++ design的一本书,大概JD搜了一波没有译本,英文版600多R,瞬间从价值上看到了这本书的价值 ...
- 64_r2
ruby-gnomecanvas2-0.90.4-7.fc26.3.x86_64.rpm 13-Feb-2017 08:00 75794 ruby-gnomecanvas2-devel-0.90.4- ...
- C# Selenium with PhantomJSDriver get image width and height (获取图片的长和高)
//get image width and height var image=driver.FindElement(By.ClassName("it-Header_authorImage&q ...
- HttpURLConnection传json
private static String sendToWangTing(DataRow dataRow) throws IOException{ String ip = Configuration. ...
- caffe Python API 之图片预处理
# 设定图片的shape格式为网络data层格式 transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape}) ...
- word2vec参数
架构:skip-gram(慢.对罕见字有利)vs CBOW(快) · 训练算法:分层softmax(对罕见字有利)vs 负采样(对常见词和低纬向量有利) 负例采样准确率提高,速度会慢, ...
- 教你如何更改android应用的包名
Android 源码自带了很多应用程序,想改个包名方便修改?很简单,两步搞定,以packages/apps/Settings为例: 1.打开AndroidManifest.xml,把 <mani ...
- WordPress SMTP发送邮件插件:WP SMTP
对于一个网站而言,发送邮件的功能是必不可少的,现在的主机一般都支持发送邮件,但是不同的主机由于函数限制或者某些其他原因,可能造成没办法正常发送邮件.这时候,我们可能就要借助第三方SMTP发送邮件. 对 ...