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

require(["esri/symbols/CartographicLineSymbol"], function(CartographicLineSymbol) { /* code goes here */ });

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/symbols/Symbol
|_esri/symbols/LineSymbol
  |_esri/symbols/SimpleLineSymbol
    |_esri/symbols/CartographicLineSymbol

Constructors

NameSummary
new CartographicLineSymbol()Creates a new empty CartographicLineSymbol object.
new CartographicLineSymbol(style?, color?, width?, cap?, join?, miterLimit?)Creates a new CartographicLineSymbol object with parameters.
new 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.
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.
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 CartographicLineSymbol()

Creates a new empty CartographicLineSymbol object.
Sample:
require([
  "esri/symbols/CartographicLineSymbol", ... 
], function(CartographicLineSymbol, ... ) {
  var cls = new CartographicLineSymbol();
  ...
});

new 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:
require([
  "esri/symbols/CartographicLineSymbol", "esri/Color", ... 
], function(CartographicLineSymbol, Color, ... ) {
  var cls = new CartographicLineSymbol(CartographicLineSymbol.STYLE_SOLID, new Color([255,0,0]), 10, CartographicLineSymbol.CAP_ROUND, CartographicLineSymbol.JOIN_MITER, 5);
  ...
});

new CartographicLineSymbol(json)

Creates a new CartographicLineSymbol object using a JSON object.
Parameters:
<Object> json Required

JSON object representing the CartographicLineSymbol. View the REST API Reference for Symbol Objects 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

<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:
require([
  "esri/Color", ... 
], function(Color, ... ) {
  symbol.setColor(new 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.

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:
require([
  "esri/symbols/SimpleLineSymbol", ... 
], function(SimpleLineSymbol, ... ) {
  var outline = new SimpleLineSymbol().setWidth(1);
  ...
});

toJson()

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