Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: CartographicLineSymbol

dojo.require("esri.symbols.CartographicLineSymbol")

Description

(Added at v1.0)
Line symbols are used to draw linear features on the graphics layer. CartographicLineSymbol, like SimpleLineSymbol, is either a solid line or a predefined pattern of dashes and dots. Line joins and line caps can be added to further define the line symbol.

Explore the CartographicLineSymbol 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
    |_esri.symbol.CartographicLineSymbol

Constructors

NameSummary
new esri.symbol.CartographicLineSymbol()Creates a new empty CartographicLineSymbol object.
new esri.symbol.CartographicLineSymbol(style?, color?, width?, cap?, join?, miterLimit?)Creates a new CartographicLineSymbol object with parameters.
new esri.symbol.CartographicLineSymbol(json)Creates a new CartographicLineSymbol object using a JSON object.

Constants

NameDescription
CAP_BUTTLine ends square at the end point.

line cap types
CAP_ROUNDLine is rounded just beyond the end point.
CAP_SQUARELine is squared just beyond the end point.
JOIN_BEVELThe joined lines are beveled.

line join types
JOIN_MITERThe joined lines are not rounded or beveled.
JOIN_ROUNDThe joined lines are rounded.
STYLE_DASHThe line is made of dashes.
STYLE_DASHDOTThe line is made of a dash-dot pattern.
STYLE_DASHDOTDOTThe line is made of a dash-dot-dot pattern.
STYLE_DOTThe line is made of dots.
STYLE_LONGDASHThe line is made of a long dash pattern.
STYLE_LONGDASHDOTThe line is made of a long dash-dot pattern.
STYLE_NULLThe line has no symbol.
STYLE_SHORTDASHThe line is made of a short dash pattern.
STYLE_SHORTDASHDOTThe line is made of a short dash-dot pattern.
STYLE_SHORTDASHDOTDOTThe line is made of a short dash-dot-dot pattern.
STYLE_SHORTDOTThe line is made of a short dot pattern.
STYLE_SOLIDThe line is solid.

Properties

NameTypeSummary
capStringThe cap style.
colorColorSymbol color.
joinStringThe join style.
markerObjectIndicates marker symbols present at the beginning and/or end of a SimpleLineSymbol.
miterLimitStringSize threshold for showing mitered line joins.
styleStringThe line style.
typeStringThe type of symbol.
widthNumberWidth of line symbol in pixels.

Methods

NameReturn typeSummary
setCap(cap)CartographicLineSymbolSets the cap style.
setColor(color)SymbolSets the symbol color.
setJoin(join)CartographicLineSymbolSets the join style.
setMarker(options)NoneSets marker symbols at the beginning and/or end of a SimpleLineSymbol.
setMiterLimit(miterLimit)CartographicLineSymbolSets the size threshold for showing mitered line joins.
setStyle(style)SimpleLineSymbolSets the line symbol style.
setWidth(width)LineSymbolSets the LineSymbol width.
toJson()ObjectConverts object to its ArcGIS Server JSON representation.
Constructor Details

new esri.symbol.CartographicLineSymbol()

Creates a new empty CartographicLineSymbol object.
Sample:

var cls = new esri.symbol.CartographicLineSymbol();

new esri.symbol.CartographicLineSymbol(style?, color?, width?, cap?, join?, miterLimit?)

Creates a new CartographicLineSymbol object with parameters.
Parameters:
<String> style Optional See Constants table for values.
<Color> color Optional Symbol color.
<Number> width Optional Width of the line in pixels.
<String> cap Optional See Constants table for values.
<String> join Optional See Constants table for values.
<String> miterLimit Optional Size threshold for showing mitered line joins.
Sample:

var cls = new esri.symbol.CartographicLineSymbol(esri.symbol.CartographicLineSymbol.STYLE_SOLID,

  new esri.Color([255,0,0]), 10, esri.symbol.CartographicLineSymbol.CAP_ROUND,

  esri.symbol.CartographicLineSymbol.JOIN_MITER, 5);

new esri.symbol.CartographicLineSymbol(json)

Creates a new CartographicLineSymbol object using a JSON object.
Parameters:
<Object> json Required JSON object representing the CartographicLineSymbol. 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

<String> cap

The cap style. See the Constants table for valid values and explanations.
Known values: CAP_BUTT|CAP_ROUND|CAP_SQUARE
Default value: CAP_BUTT

<Color> color

Symbol color.

<String> join

The join style. See the Constants table for valid values and explanations.
Known values: JOIN_BEVEL|JOIN_MITER|JOIN_ROUND
Default value: JOIN_MITER

<Object> marker

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)

<String> miterLimit

Size threshold for showing mitered line joins.
Default value: 10

<String> style

The line style. See the Constants table for valid values.
Default value: STYLE_SOLID

<String> type

The type of symbol.
Known values: simplemarkersymbol | picturemarkersymbol | simplelinesymbol | cartographiclinesymbol | simplefillsymbol | picturefillsymbol | textsymbol

<Number> width

Width of line symbol in pixels.
Default value: 1
Method Details

setCap(cap)

Sets the cap style.
Parameters:
<String> cap Required Cap style. See the Constants table for valid values.

setColor(color)

Sets the symbol color.
Return type: Symbol
Parameters:
<Color> color Required Symbol color.
Sample:

symbol.setColor(new esri.Color([255,255,0,0.5]));

setJoin(join)

Sets the join style.
Parameters:
<String> join Required Join style. See the Constants table for valid values.

setMarker(options)

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.

setMiterLimit(miterLimit)

Sets the size threshold for showing mitered line joins.
Parameters:
<String> miterLimit Required Miter limit.

setStyle(style)

Sets the line symbol style.
Return type: SimpleLineSymbol
Parameters:
<String> style Required Line style. See the Constants table for valid values.

setWidth(width)

Sets the LineSymbol width.
Return type: LineSymbol
Parameters:
<Number> width Required Width of line symbol in pixels.
Sample:

var outline = new esri.symbol.SimpleLineSymbol().setWidth(1);

toJson()

Converts object to its ArcGIS Server JSON representation.
Return type: Object
Show Modal