Go to: http://blog.csdn.net/wufeishimeng/article/details/5611313
Symbol of ESRI flex API
Symbol is a class library used to re-display the geographic element Rendering Method on a map. (Symbols are used to represent "geometries" on the map) is very important in practical applications. Using good-looking styles can undoubtedly add many highlights to your system, of course, the customer looks quite comfortable.
View the introduction in the official help document. We can see the Introduction to symbol. First, we will list them as follows:
Class |
Des |
Cartographiclinesymbol |
Used to draw linear features on the graphics layer. |
Compositesymbol |
Used to draw multiple symbols on a single graphic. |
Fillsymbol |
Base class for polygon symbols. |
Infosymbol |
Used to display info markers (or bubble markers), containing your own content, at points (mappoint) on the graphics layer. |
Linesymbol |
Base class for line symbols. |
Markersymbol |
Base class for marker symbols. |
Picturefillsymbol |
Used to draw polygon features on the graphics layer using an image that gets repeated over and over. |
Picturemarkersymbol |
Used to draw points and multipoints on the graphics layer using an image. |
Simplefillsymbol |
Used to draw polygon features on the graphics layer using simple patterns. |
Simplelinesymbol |
Used to draw linear features on the graphics layer using simple line patterns. |
Simplemarkersymbol |
Used to draw points and multipoints (or nodes of polylines and polygons) on the graphics layer using simple markers. |
Symbol |
Base class for all symbols. |
Textsymbol |
Used to display text at points on the graphics layer. |
Style Overview:
The symbol in API can be divided into the following types:
Compositesymbol (combination style): Includes compositesymbol
Markersymbol (DOT style): including simplemarkersymbol andPicturemarkersymbol
Fillsymbol (surface style): including simplefillsymbol and picturefillsymbol
Linesymbol (line style): including simplelinesymbol andCartographiclinesymbol
Infosymbol (Information style): including infosymbol
Textsymbol (annotation style): including textsymbol
The following describes several styles.
1,
Compositesymbol: Used to combine multiple styles. The usage is as follows:
<ESRI: compositesymbol> <ESRI: simplemarkersymbol style = "circle" color = "0x0000ff" size = "20"/>
<ESRI: textsymbol text = "I" color = "0 xffffff" backgroundcolor = "0x0000ff"> <flash: textformat bold = "true" size = "16"/> </ESRI: textsymbol>
</ESRI: compositesymbol>
The effect of the above Code is to write an I letter in the circle. For details, see the official ESRI online example.
This effect can be used to render the annotation to make the annotation diversified.
2. simplemarkersymbol: Specify predefined marker to render map elements.
ESRI provides the following styles:
Public static const style_circle: String = "circle" --- circle
Public static const style_cross: String = "Cross" ---- cross
Public static const style_diamond: String = "diamond"-Diamond
Public static const style_square: String = "square" --- Rectangular Box
Public static const style_triangle: String = "Triangle" --- triangle
Public static const style_x: String = "X" ---- X-shaped cross
3,
Picturemarkersymbol: Use an image to define the style. This is one of the most commonly used rendering methods.
We usually use this method in applications to make the map element clearer and more beautiful.
The AS method is as follows:
Picturemarkersymbol(Source: Object
= NULL, width: Number = 0, height: Number = 0, xoffset: Number = 0, yoffset: Number = 0, angle: Number = 0)
Source: Image path, which can be a network path or local address
Width: The image width. Height: The image height. Xoffset: the offset in the X direction.
Angle: the Rotation Angle of the image.
For example:
VaR graphicpointsym: picturemarkersymbol =
NewPicturemarkersymbol (widgeticon, 30, 30 );
The values have default values.
4. simplefillsymbol: used to fill the gra style of the polygon type. You need to use simplelinesymbol to set the border style.
5. picturefillsymbol: Fill the polygon with images
6. simplelinesymbol: simple line style. We will not introduce it here
7. infosymbol: The function is quite powerful. It can be embedded with Flex controls for rendering, such as pie charts. Using this style can make your system more powerful and get twice the result with half the effort.
The following is an example of creating a pie chart for each gra.
Define an infosymbol as follows
<ESRI: infosymbol id = "pointsym" infoplacement = "center">
<ESRI: inforenderer>
<Mx: component>
<Mx: vbox width = "100%" Height = "100%">
<Mx: piechart id = "piechart" dataprovider = "{data}" width = "90" Height = "90" showdatatips = "true">
<Mx: Series>
<Mx: pieseries field = "num" labelfield = "name">
<Mx: fills>
<Mx: array>
<Mx: radialgradient>
<Mx: entries>
<Mx: array>
<Mx: gradiententry color = "# ff0000" ratio = "0"/>
</MX: array>
</MX: entries>
</MX: radialgradient>
<Mx: radialgradient>
<Mx: entries>
<Mx: array>
<Mx: gradiententry color = "#00ff00" ratio = "0"/>
</MX: array>
</MX: entries>
</MX: radialgradient>
</MX: array>
</MX: fills>
</MX: pieseries>
</MX: Series>
</MX: piechart>
</MX: vbox>
</MX: component>
</ESRI: inforenderer>
</ESRI: infosymbol>
Assign this style to the gra for displaying the pie chart. Note that piechart's datatevide is {data}, which is a fixed method. You can assign the gra attribute information to Data. That is to say:
Datemedivide = Data = gra. Attribute;
The following structure is the definition of data:
VaRGrainfo: Object =
{
Num: currentpec, name: gra. Attributes. freq_lc +"MHz:/N"+ Currentpec +"%"
};
Assign the num value to the pie chart as the value of the pie chart, and the name value as a prompt for moving the cursor over.
So far, you can use infosymbol. The effect is good.
Note: complex styles make up a lot of resources. Consider this when drawing many points and faces. Generally, you can experience images with over 300 entries.