dojo.require("esri.symbols.SimpleLineSymbol")
Description
(Added at v1.0)
Line symbols are used to draw linear features on the graphics layer. SimpleLineSymbol is either a solid line or a predefined pattern of dashes and dots.
Explore the SimpleLineSymbol in the
ArcGIS Symbol Playground. This is a place to explore and learn how to work with various properties and methods before implementing it into custom code. Try out new features, customize them, and copy the generated code into your own application. This sample provides a starting point so as to allow use of these features as quickly as possible.
Samples
Search for
samples that use this class.
Class hierarchy
esri.symbol.Symbol
|_esri.symbol.LineSymbol
|_esri.symbol.SimpleLineSymbol
Subclasses
Constructors
Constants
STYLE_DASH | The line is made of dashes. |
STYLE_DASHDOT | The line is made of a dash-dot pattern. |
STYLE_DASHDOTDOT | The line is made of a dash-dot-dot pattern. |
STYLE_DOT | The line is made of dots. |
STYLE_LONGDASH | Line is constructed of a series of dashes. |
STYLE_LONGDASHDOT | Line is constructed of a series of short dashes. |
STYLE_NULL | The line has no symbol. |
STYLE_SHORTDASH | Line is constructed of a series of short dashes. |
STYLE_SHORTDASHDOT | Line is constructed of a dash followed by a dot. |
STYLE_SHORTDASHDOTDOT | Line is constructed of a series of a dash and two dots. |
STYLE_SHORTDOT | Line is constructed of a series of short dots. |
STYLE_SOLID | The line is solid. |
Properties
Methods
Constructor Details
Creates a new empty SimpleLineSymbol object.
Sample:
var sls = new esri.symbol.SimpleLineSymbol();
Creates a new SimpleLineSymbol object with parameters.
Parameters:
<String > style |
Required |
See Constants table for values. |
<Color > color |
Required |
Symbol color. |
<Number > width |
Required |
Width of the line in pixels. |
Sample:
var sls = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH,
new esri.Color([255,0,0]), 3);
Creates a new SimpleLineSymbol object using a JSON object.
Parameters:
<Object > json |
Required |
JSON object representing the SimpleLineSymbol. View the Symbol Objects (Common data types in ArcGIS) for details
on creating a JSON symbol. Note that when specifying symbol width and height using JSON the values should be entered in points, the JavaScript API then converts the point values to pixels. |
Property Details
Indicates marker symbols present at the beginning and/or end of a SimpleLineSymbol. See the object specification table in the
setMarker() method for details of the properties of this object.
(Added at v3.23)
The line style. See the Constants table for valid values.
Default value: STYLE_SOLID
The type of symbol.
Known values: simplemarkersymbol | picturemarkersymbol | simplelinesymbol | cartographiclinesymbol | simplefillsymbol | picturefillsymbol | textsymbol
Width of line symbol in pixels.
Default value: 1
Method Details
Sets the symbol color.
Parameters:
<Color > color |
Required |
Symbol color. |
Sample:
symbol.setColor(new esri.Color([255,255,0,0.5]));
Sets marker symbols at the beginning and/or end of a SimpleLineSymbol. (Added at v3.23)
Parameters:
<Object > options |
Required |
The options defining the marker style and placement. See the object specification table below. |
Object Specifications: <options
>
<String > placement |
Required |
Indicates where the marker is placed on the line symbol. Valid values are begin , end , and begin-end . |
<String > style |
Required |
Indicates the style of the marker to place on the line symbol. As of version 3.23, the only supported style is arrow . |
Sets the line symbol style.
Parameters:
<String > style |
Required |
Line style. See the Constants table for valid values. |
Sets the LineSymbol width.
Parameters:
<Number > width |
Required |
Width of line symbol in pixels. |
Sample:
var outline = new esri.symbol.SimpleLineSymbol().setWidth(1);
Converts object to its ArcGIS Server JSON representation.