Class DashGeometricEffect

java.lang.Object
com.esri.arcgisruntime.symbology.GeometricEffect
com.esri.arcgisruntime.symbology.DashGeometricEffect

public final class DashGeometricEffect extends GeometricEffect
Represents a GeometricEffect for dashes on lines. It transforms the representation of a line using a pattern of dashes and gaps. Dashes are the symbolized portion of the stroke and gaps are the unsymbolized portion.

A list of dash and gap distances (DIP values greater than 0) provides a template to be repeated throughout the line. A basic template consists of two distance values: the first defines the length of each dash and the second defines the length of each gap. More complex effects can be created by defining a template of multiple dashes and gaps. Template values are read as dash distance followed by gap distance throughout the pattern. Templates that contain an odd number of values will maintain the dash-gap pattern by restarting at the beginning of the template. A template of '3 2 1', for example, will be rendered as '3(dash) 2(gap) 1(dash) 3(gap) 2(dash) 1(gap) ...'. The default template is an empty list, which renders a solid line.

Note: The gaps in a dash effect can be lost when 1) a small gap is defined and 2) a round or square cap style is applied. Because the cap style is applied to both ends of a dash, they can overlap over short distances and fill the gap. A "butt" style cap ends the stroke abruptly, so will not exhibit the issue. This is consistent with ArcGIS Pro behavior.

Since:
100.5.0
  • Constructor Details

    • DashGeometricEffect

      public DashGeometricEffect()
      Creates a DashGeometricEffect with an empty template. Values can be added to the template through getDashTemplate(). The default template is an empty list, which renders a solid line.
      Since:
      100.5.0
    • DashGeometricEffect

      public DashGeometricEffect(Iterable<Double> templateValues)
      Creates a DashGeometricEffect and populates its template with the given values. The template values indicate the distance for each dash and gap. Values in the template cannot be negative.
      Parameters:
      templateValues - iterable containing dashes and gaps in density-independent pixels (dp), used to populate the dash template; can be null or empty
      Throws:
      ArcGISRuntimeException - if templateValues contains values that are less than zero
      Since:
      100.5.0
  • Method Details

    • getDashTemplate

      public List<Double> getDashTemplate()
      Gets the dash template for this geometric effect. The list is modifiable and dashes and gaps can be added or removed. The first value in the list is a dash and the second value will be a gap, repeating indefinitely. Templates that contain an odd number of values will maintain the dash-gap pattern by restarting at the beginning of the template values. A template of '3 2 1', for example, will be rendered as '3(dash) 2(gap) 1(dash) 3(gap) 2(dash) 1(gap) ...'. The default template is an empty list, which renders a solid line.
      Returns:
      the list of dashes and gaps for this geometric effect
      Throws:
      ArcGISRuntimeException - if values are added that are less than zero
      Since:
      100.5.0