- All Implemented Interfaces:
JsonSerializable
Simple line symbols display graphics using predefined line style patterns such as
SimpleLineSymbol.Style.SOLID
, SimpleLineSymbol.Style.DASH
, or SimpleLineSymbol.Style.DOT
.
Example of creating a SimpleLineSymbol:
// create points for the line PointCollection points = new PointCollection(SpatialReferences.getWebMercator()); points.add(-226913, 6550477); points.add(-226643, 6550477); Polyline line = new Polyline(points); // creates a solid red simple line symbol SimpleLineSymbol lineSymbol = new SimpleLineSymbol(Style.SOLID, 0xFFFF0000, 3); // add line with symbol to graphics overlay and add overlay to map view GraphicsOverlay graphicsOverlay = new GraphicsOverlay(); mapView.getGraphicsOverlays().add(graphicsOverlay); graphicsOverlay.getGraphics().add(new Graphic(line, lineSymbol));A SimpleLineSymbol can be displayed using a Graphic and setting it to a GraphicsOverlay or setting symbol as a Renderer.
GraphicsOverlay.getGraphics().add(new Graphic(Geometry, SimpleLineSymbol));OR
GraphicsOverlay.setRender(new SimpleRenderer(SimpleLineSymbol));
- Since:
- 100.0.0
- See Also:
-
Property Summary
Properties inherited from class com.esri.arcgisruntime.symbology.LineSymbol
color
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enum that contains the possible marker placement locations on a SimpleLineSymbol.static enum
An enum that contains the possible marker styles to be placed at the ends of a SimpleLineSymbol.static enum
The list of possible simple line symbol styles. -
Constructor Summary
ConstructorDescriptionCreates a simple line symbol object with default values.SimpleLineSymbol
(SimpleLineSymbol.Style style, int color, float width) Deprecated, for removal: This API element is subject to removal in a future version.SimpleLineSymbol
(SimpleLineSymbol.Style style, int color, float width, SimpleLineSymbol.MarkerStyle markerStyle, SimpleLineSymbol.MarkerPlacement markerPlacement) Deprecated, for removal: This API element is subject to removal in a future version.since 200.0.0, replaced bySimpleLineSymbol(Style, Color, float, MarkerStyle, MarkerPlacement)
SimpleLineSymbol
(SimpleLineSymbol.Style style, Color color, float width) Creates a simple line symbol object with a style, color and width.SimpleLineSymbol
(SimpleLineSymbol.Style style, Color color, float width, SimpleLineSymbol.MarkerStyle markerStyle, SimpleLineSymbol.MarkerPlacement markerPlacement) Creates a simple line symbol object with a style, color, width, and line end marker. -
Method Summary
Modifier and TypeMethodDescriptionGets the marker placement type for this symbol.Gets the marker style for this symbol.getStyle()
Gets the line style that describes how the symbol's pattern is being displayed.void
setMarkerPlacement
(SimpleLineSymbol.MarkerPlacement markerPlacement) Sets the marker placement type for this symbol.void
setMarkerStyle
(SimpleLineSymbol.MarkerStyle markerStyle) Sets the marker style for this symbol.void
setStyle
(SimpleLineSymbol.Style style) Sets the line style that describes how this Symbol's pattern will be displayed.Gets aMultilayerPolylineSymbol
from a SimpleLineSymbol.Methods inherited from class com.esri.arcgisruntime.symbology.LineSymbol
colorProperty, getColor, getWidth, isAntiAlias, setAntiAlias, setColor, setColor, setWidth
Methods inherited from class com.esri.arcgisruntime.symbology.Symbol
createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, fromJson, getUnknownJson, getUnsupportedJson, toJson
-
Constructor Details
-
SimpleLineSymbol
public SimpleLineSymbol()Creates a simple line symbol object with default values.The default values are:
This is useful if the properties of the symbol are only known after the application is running.- Since:
- 100.0.0
-
SimpleLineSymbol
@Deprecated(since="200.0.0", forRemoval=true) public SimpleLineSymbol(SimpleLineSymbol.Style style, int color, float width) Deprecated, for removal: This API element is subject to removal in a future version.as of 200.0.0, replaced bySimpleLineSymbol(Style, Color, float)
Creates a new SimpleLineSymbol with the given properties:- Style, pattern that makes up the area of the symbol
- Color, interior color of the symbol
- Width, thickness of the symbol in density-independent pixels (dp)
If the width of the symbol is 0 or less then the symbol will not be displayed.
- Parameters:
style
- the style of the Symbol, not nullcolor
- an integer representing the line color as 0xAARRGGBBwidth
- the width of the Symbol in dp- Throws:
IllegalArgumentException
- if style is null- Since:
- 100.0.0
-
SimpleLineSymbol
Creates a simple line symbol object with a style, color and width.If the width of the symbol is 0 or less, then the symbol will not be displayed.
- Parameters:
style
- the type of simple line symbol to createcolor
- the line colorwidth
- the width of the Symbol in dp- Throws:
IllegalArgumentException
- if color is nullIllegalArgumentException
- if style is null- Since:
- 200.0.0
-
SimpleLineSymbol
@Deprecated(since="200.0.0", forRemoval=true) public SimpleLineSymbol(SimpleLineSymbol.Style style, int color, float width, SimpleLineSymbol.MarkerStyle markerStyle, SimpleLineSymbol.MarkerPlacement markerPlacement) Deprecated, for removal: This API element is subject to removal in a future version.since 200.0.0, replaced bySimpleLineSymbol(Style, Color, float, MarkerStyle, MarkerPlacement)
Creates a new SimpleLineSymbol with the given properties:- Style, pattern that makes up the area of the symbol
- Color, interior color of the symbol
- Width, thickness of the symbol in density-independent pixels (dp)
- MarkerStyle, style of markers at the ends of the symbol
- MarkerPlacement, placement of markers at the ends of the symbol
If the width of the symbol is 0 or less then the symbol will not be displayed.
- Parameters:
style
- the style of the Symbol, not nullcolor
- an integer representing the line color as 0xAARRGGBBwidth
- the width of the Symbol in dpmarkerStyle
- the marker stylemarkerPlacement
- the marker placement- Throws:
IllegalArgumentException
- if style, markerStyle, or markerPlacement are null- Since:
- 100.2.0
-
SimpleLineSymbol
public SimpleLineSymbol(SimpleLineSymbol.Style style, Color color, float width, SimpleLineSymbol.MarkerStyle markerStyle, SimpleLineSymbol.MarkerPlacement markerPlacement) Creates a simple line symbol object with a style, color, width, and line end marker.If the width of the symbol is 0 or less then the symbol will not be displayed.
- Parameters:
style
- the type of simple line symbol to createcolor
- the line colorwidth
- the width of the Symbol in dpmarkerStyle
- the marker stylemarkerPlacement
- the marker placement- Throws:
IllegalArgumentException
- if color is nullIllegalArgumentException
- if style, markerStyle, or markerPlacement are null- Since:
- 200.0.0
-
-
Method Details
-
toMultilayerSymbol
Gets aMultilayerPolylineSymbol
from a SimpleLineSymbol.This method allows you to create complex and custom symbols with multiple layers of different types of symbology. Simple line symbol provides a factory of predefined line styles such as dash and dash_dot_dot. This method generates a
MultilayerPolylineSymbol
with aSolidStrokeSymbolLayer
and a predefined collection ofDashGeometricEffect
.- Returns:
- a converted multilayer polyline symbol
- Since:
- 100.5.0
-
getStyle
Gets the line style that describes how the symbol's pattern is being displayed.Default value is SOLID.
- Returns:
- the current line style of this Symbol
- Since:
- 100.0.0
- See Also:
-
setStyle
Sets the line style that describes how this Symbol's pattern will be displayed.- Parameters:
style
- the new line style for this symbol, not null- Throws:
IllegalArgumentException
- if style is null- Since:
- 100.0.0
- See Also:
-
setMarkerPlacement
Sets the marker placement type for this symbol.- Parameters:
markerPlacement
- the marker placement type- Throws:
IllegalArgumentException
- if markerPlacement is null- Since:
- 100.2.0
-
getMarkerPlacement
Gets the marker placement type for this symbol. The default value isSimpleLineSymbol.MarkerPlacement.END
.- Returns:
- the marker placement type
- Since:
- 100.2.0
-
setMarkerStyle
Sets the marker style for this symbol.- Parameters:
markerStyle
- the marker style value- Throws:
IllegalArgumentException
- if markerStyle is null- Since:
- 100.2.0
-
getMarkerStyle
Gets the marker style for this symbol. The default value isSimpleLineSymbol.MarkerStyle.NONE
.- Returns:
- the marker style
- Since:
- 100.2.0
-
SimpleLineSymbol(Style, Color, float)