Package com.esri.arcgisruntime.symbology
Class SimpleLineSymbol
- java.lang.Object
-
- com.esri.arcgisruntime.symbology.Symbol
-
- com.esri.arcgisruntime.symbology.LineSymbol
-
- com.esri.arcgisruntime.symbology.SimpleLineSymbol
-
- All Implemented Interfaces:
JsonSerializable
public final class SimpleLineSymbol extends LineSymbol
Defines a SimpleLineSymbol which is a LineSymbol based on simple patterns.SimpleLineSymbols symbolize Graphics and Features that have Polyline geometries using predefined style patterns. A SimpleLineSymbol is used to draw generic linear Features but renders faster than more advance LineSymbols.
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));
ORGraphicsOverlay.setRender(new SimpleRenderer(SimpleLineSymbol));
- Since:
- 100.0.0
- See Also:
Graphic
,GraphicsOverlay
,SimpleRenderer
,LineSymbol
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimpleLineSymbol.MarkerPlacement
An enum that contains the possible marker placement locations on a SimpleLineSymbol.static class
SimpleLineSymbol.MarkerStyle
An enum that contains the possible marker styles to be placed at the ends of a SimpleLineSymbol.static class
SimpleLineSymbol.Style
The list of possible simple line symbol styles.
-
Constructor Summary
Constructors Constructor Description SimpleLineSymbol()
Creates a new SimpleLineSymbol with default properties set.SimpleLineSymbol(SimpleLineSymbol.Style style, int color, float width)
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)SimpleLineSymbol(SimpleLineSymbol.Style style, int color, float width, SimpleLineSymbol.MarkerStyle markerStyle, SimpleLineSymbol.MarkerPlacement 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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleLineSymbol.MarkerPlacement
getMarkerPlacement()
Gets the marker placement type for this symbol.SimpleLineSymbol.MarkerStyle
getMarkerStyle()
Gets the marker style for this symbol.SimpleLineSymbol.Style
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.MultilayerPolylineSymbol
toMultilayerSymbol()
Gets a multilayer polyline symbol generated from this simple line symbol.-
Methods inherited from class com.esri.arcgisruntime.symbology.LineSymbol
getColor, getWidth, isAntiAlias, setAntiAlias, setColor, setWidth
-
Methods inherited from class com.esri.arcgisruntime.symbology.Symbol
createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, fromJson, getUnknownJson, getUnsupportedJson, toJson
-
-
-
-
Constructor Detail
-
SimpleLineSymbol
public SimpleLineSymbol()
Creates a new SimpleLineSymbol with default properties set. Useful if the properties of the Symbol are only known after the application is running.Each property can be set on its own but setting the style property by itself will have no effect on making the Symbol visible.
Default properties:
- Style,
SimpleLineSymbol.Style.SOLID
- Color, gray, 0xFFD3D3D3
- Width, 1.0
- Since:
- 100.0.0
- Style,
-
SimpleLineSymbol
public SimpleLineSymbol(SimpleLineSymbol.Style style, int color, float width)
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
public SimpleLineSymbol(SimpleLineSymbol.Style style, int color, float width, SimpleLineSymbol.MarkerStyle markerStyle, SimpleLineSymbol.MarkerPlacement 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
-
-
Method Detail
-
toMultilayerSymbol
public MultilayerPolylineSymbol toMultilayerSymbol()
Gets a multilayer polyline symbol generated from this simple line symbol. The multilayer symbol will contain aSolidStrokeSymbolLayer
with a collection ofDashGeometricEffects
defining any dash patterns from the original simple line symbol.- Returns:
- a converted multilayer polyline symbol
- Since:
- 100.5.0
-
getStyle
public SimpleLineSymbol.Style 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:
SimpleLineSymbol.Style
-
setStyle
public void setStyle(SimpleLineSymbol.Style style)
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:
SimpleLineSymbol.Style
-
setMarkerPlacement
public void setMarkerPlacement(SimpleLineSymbol.MarkerPlacement markerPlacement)
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
public SimpleLineSymbol.MarkerPlacement 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
public void setMarkerStyle(SimpleLineSymbol.MarkerStyle markerStyle)
Sets the marker style for this symbol.- Parameters:
markerStyle
- the marker style value- Throws:
IllegalArgumentException
- if markerStyle is null- Since:
- 100.2.0
-
getMarkerStyle
public SimpleLineSymbol.MarkerStyle getMarkerStyle()
Gets the marker style for this symbol. The default value isSimpleLineSymbol.MarkerStyle.NONE
.- Returns:
- the marker style
- Since:
- 100.2.0
-
-