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

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

Description

(Added at v1.0)
Fill symbols are used to draw polygon features on the graphics layer. SimpleFillSymbol can be solid, transparent, or one of several cross hatch patterns. In addition, the symbol can have an optional outline, which is defined by a line symbol.

Explore the SimpleFillSymbol 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/FillSymbol
  |_esri/symbols/SimpleFillSymbol

Constructors

NameSummary
new SimpleFillSymbol()Creates a new empty SimpleFillSymbol object.
new SimpleFillSymbol(style, outline, color)Creates a new SimpleFillSymbol object with parameters.
new SimpleFillSymbol(json)Creates a new SimpleFillSymbol object using a JSON object.

Constants

NameDescription
STYLE_BACKWARD_DIAGONALThe fill is backward diagonal lines.
STYLE_CROSSThe fill is a cross.
STYLE_DIAGONAL_CROSSThe fill is a diagonal cross.
STYLE_FORWARD_DIAGONALThe fill is forward diagonal lines.
STYLE_HORIZONTALThe fill is horizontal lines.
STYLE_NULLThe polygon has no fill.
STYLE_SOLIDThe fill is solid.
STYLE_VERTICALThe fill is vertical lines.

Properties

NameTypeSummary
colorColorSymbol color - only applies when SimpleFillSymbol.style = 'STYLE_SOLID'.
outlineSimpleLineSymbolOutline of the polygon.
styleStringThe fill style.
typeStringThe type of symbol.

Methods

NameReturn typeSummary
setColor(color)SimpleFillSymbolSets the symbol color - only applies when style is STYLE_SOLID.
setOutline(outline)FillSymbolSets the outline of the fill symbol.
setStyle(style)SimpleFillSymbolSets the fill symbol style.
toJson()ObjectConverts object to its ArcGIS Server JSON representation.
Constructor Details

new SimpleFillSymbol()

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

new SimpleFillSymbol(style, outline, color)

Creates a new SimpleFillSymbol object with parameters.
Parameters:
<String> style Required See Constants table for values.
<SimpleLineSymbol> outline Required See SimpleLineSymbol.
<Color> color Required Symbol color.
Sample:
require([
  "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color", ... 
], function(SimpleFillSymbol, SimpleLineSymbol, Color, ... ) {
  var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
    new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASHDOT,
    new Color([255,0,0]), 2),new Color([255,255,0,0.25])
  );
  ...
});

new SimpleFillSymbol(json)

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

<Color> color

Symbol color - only applies when SimpleFillSymbol.style = 'STYLE_SOLID'.
Outline of the polygon.

<String> style

The fill style. See the Constants table for valid values. Color is valid only with STYLE_SOLID.
Default value: STYLE_SOLID

<String> type

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

setColor(color)

Sets the symbol color - only applies when style is STYLE_SOLID.
Return type: SimpleFillSymbol
Parameters:
<Color> color Required Symbol color.

setOutline(outline)

Sets the outline of the fill symbol.
Return type: FillSymbol
Parameters:
<SimpleLineSymbol> outline Required Symbol used for outline.
Sample:
require([
  "esri/symbols/SimpleLineSymbol", "esri/Color", ... 
], function(SimpleLineSymbol, Color, ... ) {
  selSymbol.setOutline(new SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]), 2));   
  ...
});

setStyle(style)

Sets the fill symbol style.
Return type: SimpleFillSymbol
Parameters:
<String> style Required Fill style. See the Constants table for valid values.

toJson()

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