Class MVStyleMarker
MVStyleMarker lets you create a MapViewer MARKER style instance at the
client side.
You can specify the essential information when creating a new Marker style,
such as the style name and marker type (image or vector based). You can set
other aspects through various setter methods, such as the vector shape and fill
and stroke colors as well as their opacity for a vector type Marker, or the
image URL for an image based Marker style.
Note that for vector type, only basic shapes such as circles, rectangles and simple
polygons/polylines are supported. These vector shapes must be able to be drawn in
one continuous pen stroke. In other words, you cannot have a polygon Marker with a
hole inside it (to draw the hole you must lift your pen and start on a different
stroke).
Typical useage of this class is illustrated below.
var style = new MVStyleMarker("my_vector_icon", "vector"); style.setSize(19, 19); style.setStrokeColor("ff0000"); style.setStrokeWidth("1.5"); style.setFillColor("00ff00"); //this sets the shape to be a circle with a dummy radius value (50). //the actual size of the circle when displayed is specified in the //style.setSize() call above. style.setVectorShape("c:50"); //this is how you set up a simple polygon instead of circle: //style.setVectorShape("50,199,0,100,50,1,100,100,50,199"); themebasedfoi.addStyle(style); themebasedfoi.setRenderingStyle("my_vector_icon");
Note that once a style object is added to the theme based FOI instance and set as its rendering style, the MapViewer server side will typically cache and reuse a renderered version of the marker style for all subsequent theme-based FOI requests that uses a style with the same name and size. As such, when you modify a style client-side, you should also modify its name (and/or size) in order to display the modified version on the map. If you do modify the style's name, don't forget to change it in the themebasedfoi.setRenderingStyle() call too.
Constructor Attributes | Constructor Name and Description |
---|---|
MVStyleMarker(name, type)
|
Method Attributes | Method Name and Description |
---|---|
setDescription(desc)
Sets the description of this COLOR style.
|
|
setFillColor(fill, op)
Sets the fill color and (optionally) its opacity.
|
|
setImageUrl(imgUrl)
Sets the URL of the image to be used for this marker style.
|
|
setName(name)
Sets the name of this Marker style.
|
|
setSize(width, height)
Sets the preferred width and height (in pixel) of this marker style as displayed on
screen.
|
|
setStrokeColor(stroke, op)
Sets the stroke color and (optionally) its opacity.
|
|
setStrokeWidth(sw)
Sets the pen width when drawing the shape (boundary).
|
|
setVectorShape(vector)
Sets the shape coordinates for the vector type marker.
|
- Parameters:
- {string} name
- name of the MARKER style
- {string} type
- specifies the type of the MARKER: must be "image" or "vector".
- Parameters:
- {string} desc
- a short description of the style
- Parameters:
- {String} fill
- the fill color specified in the format of "RRGGBB".
- {int} op
- the opacity value for the fill color ([0 - 255]).
- Parameters:
- {string} imgUrl
- the url to an image file.
- Parameters:
- name
- Parameters:
- width
- height
- Parameters:
- {String} stroke
- the stroke color (for drawing the boundaries of vector shape) specified in the format of "RRGGBB";
- {int} op
- the opacity value for the stroke color ([0 - 255]).
- Parameters:
- {float} sw
- stroke width in device point/pixel unit
- Parameters:
- {String} vector
- a string representing the vector shape