Introduction to 1.flex
A) flex is something that Adobe has developed, with the main feature being the development of a SWF-formatted application that flex can do for desktop applications and Web applications, but essentially the same.
b) Flex uses mxml format for the layout of the app and then script it with ActionScript.
Example:
put a eris map controlinto the application , amap The load function is loadhandler
<s:Application>
<fx:Script>
<! [cdata[
Private Function Loadhandler (): void
{
}
]]>
</fx:Script>
<eris:map load= "Loadhandler ()" >
</s:Application>
c) Acrgis for Flex is actually the introduction of a jar package (but Flex is really a SWC package), and then you can call the Acrgis function
2.Argis Introduction
A) Arcigs is dedicated to the map, and it has its own Acgis map, ArcGIS Server software to process and publish the map.
b) There are many types of maps, and flex must be aware of the format of the server URL in order to make calls. Like what Wms,wmts, what, I'm not very clear. 、
c) But call the map ourselves to do is Acgis dedicated map of the service, only need to initialize a Arcgisdynamicmapservicelayer object and then set his URL (our server URL) on the line.
Private Var
Huilucommunitywms:arcgisdynamicmapservicelayer =
New Arcgisdynamicmapservicelayer ();
Huilucommunitywms.url = "Http://localhost:6080/arcgis/rest/services/myserver/Map Server";
So the Huilucommunitywms object is created, and then Map.addlayers (HUILUCOMMUNITYWMS); after that, you can Map Show this map in
Here are the Acgis map classes, Arcgisdynamicmapservicelayer is just one of them, southern Digital provides us with tiledmapservicelayer such a map of the class, But this kind of map needs to customize a class and inherit, and then specify his URL ah, his area range of some of the properties AH rear can be used.
(Customize a class This class in the source of the wmtslayer_province of the layer package)
|
Class |
Description |
|
Arcgisdynamicmapservicelayer |
Allows 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 a Image Service resource exposed by the ArcGIS server REST API (available in ArcGIS Server 9.3 an D above). |
|
Arcgistiledmapservicelayer |
Allows a cached map service resource exposed by the ArcGIS server REST API (available in ArcGIS Server 9. 3 and above). |
|
Arcimsmapservicelayer |
Allows the Add ArcIMS image services to your map. |
|
Dynamicmapservicelayer |
Base class for all dynamic layers that can is 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 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 this can is added to a map. |
|
Mapimagelayer |
The Mapimagelayer class is used to add georeferenced images to the map. |
|
Openstreetmaplayer |
Allows basemaps from OpenStreetMap. |
|
Tiledmapservicelayer |
Base class for all tiled layers that can is added to a map. |
|
Wmslayer |
A layer for OGC Web Map Services. |
|
Wmtslayer |
|
D) Well, we can now create a map and show the maps, and then how to line up on it, the logo ah what. In fact, map is an object, Arcgisdynamicmapservicelayer maps is the next level of the object, and the logo, underlined what the same as the Arcgisdynamicmapservicelayer map object, is also the map of the next level of object Graphicslayer, is also addlayer this method to add in.
private var fillgraphiclayer:graphicslayer = new Graphicslayer ();
Map.addlayer (Fillgraphiclayer);
Grapicslayer is a layer that displays dashes, marks, and the like, and has the same status as the map.
Then underline that this object is the next-level object of 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 are over the graphic and the graphic have registered mouse listener S. |
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. |
|
For example, graphic has the Attribute,geometry,symbol three most important attributes. attribute is a number of parameters that he can add up. These parameters are passed on to some of his label,button this actual control,
<s:label id= "MyLabel" text = "{data}" >
Above Data is equivalent to the attribute property of graphic. And the Geometry property is a description of the graphic shape,
|
Constant |
Defined by |
|
|
extent:string = Esrigeometryenvelope [Static] An extent are 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 a 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 the set of lines with and or more points. |
|
MAPPOINT is a point where polyline is the line, and so on, but note that the polyline when initialized
var drawpointarray:array = new Array ();
var drawpointpath:array = new Array ();
Drawpointpath.push (Drawpointarray);
var drawline:polyline = new Polyline (Drawpointpath);
Fillgraphic.geometry = DrawLine;
Drawpointpath is an array that contains the array containing the MapPoint.
Then the more important is the symbol, which is the shape of the logo.
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 Individ UAL nodes of the line).
- Polygons:simplefillsymbol, Picturefillsymbol or Compositesymbol (and the same symbols as Multipoint for the individual No Des of the polygon).
There are a number of symbols corresponding to the shape, for example, the camera tag is used Picturemarkersymbol, the line is the Simplelinesymbol, these are defined in
<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>
The picture mark of the camera is picturemarkersymbol.
3.flex interacting with Java
A) Flex is not able to interact directly with the database, so we use blazeds as a way to transfer data with Java, and to deal with the database by Java.
b) Reference http://bbs.9ria.com/thread-84889-1-1.html
c) First we define a RemoteObject object in Flex
<!--a RemoteObject object that interacts with Java through this object, buildingoperationdestination the destination is the class in Java, This is defined by Remoting-object.xml, see Reference to Java interaction with flex in detail
<mx:remoteobject id= "RemoteObject" destination= "Buildingoperationdestination"
result= "Remoteobject_resulthandler (event)"
fault= "Remoteobject_faulthandler (event)" endpoint = "Http://localhost:8080/WebIC/messagebroker/amf"/>
This object is mapped to Buildingoperationdestination, and this configuration is defined under Webic under WebContent under Web-inf under Flex remoting-config.xml
<destination id= "buildingoperationdestination" channels= "MY-AMF" >
<properties>
<source>flexutils. Buidlingoperation</source>
</properties>
</destination>
Flexutils. Buidlingoperation is the class under the SRC project under the Webic project
d) configuration is done, if something goes wrong, I wrote a Test class,
Above the testconnectionjava.html
If it is shown above, it proves that the connectivity between Java and Flex is good, if the error (as long as not change the configuration file, generally do not error), according to the information adjustment, (this error is very painful ah.) , this problem is too many, I also have not been able to solve problems, the last time, backed up a bit, did not dare to move.
A summary of arcgi S_api_for_flex