Class Renderer

    • Method Detail

      • fromJson

        public static Renderer fromJson​(String json)
        Creates a Renderer instance from a JSON string.
        Parameters:
        json - a JSON string that represents a Renderer
        Returns:
        a Renderer instance
        Throws:
        IllegalArgumentException - if json is null or empty
        Since:
        100.0.0
      • toJson

        public String toJson()
        Description copied from interface: JsonSerializable
        Serializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string.
        Specified by:
        toJson in interface JsonSerializable
        Returns:
        a JSON string
      • getUnknownJson

        public Map<String,​Object> getUnknownJson()
        Description copied from interface: JsonSerializable
        If this object was created from JSON, this method gets unknown data from the source JSON. Unknown JSON is a Map of values that were in the source JSON but are not known by the Runtime and therefore not exposed in the API.
        Specified by:
        getUnknownJson in interface JsonSerializable
        Returns:
        an unmodifiable Map containing unknown JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
        • a Map<String, Object> represents an object in the JSON
        • a List<Object> represents an array in the JSON
        • a String represents a string in the JSON
        • a Double represents a number in the JSON
        • a Boolean represents true or false in the JSON
        • null represents null in the JSON
      • getUnsupportedJson

        public Map<String,​Object> getUnsupportedJson()
        Description copied from interface: JsonSerializable
        If this object was created from JSON, this method gets unsupported data from the source JSON. Unsupported JSON is a Map of values that are supported by webmaps and known to the version of the webmap specification the API supports (see system requirements), but are not explicitly exposed through the Runtime API.
        Specified by:
        getUnsupportedJson in interface JsonSerializable
        Returns:
        an unmodifiable Map containing unsupported JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
        • a Map<String, Object> represents an object in the JSON
        • a List<Object> represents an array in the JSON
        • a String represents a string in the JSON
        • a Double represents a number in the JSON
        • a Boolean represents true or false in the JSON
        • null represents null in the JSON
      • getSymbol

        public abstract Symbol getSymbol​(Feature feature)
        Gets the Symbol used to display the given Feature.
        Parameters:
        feature - the Feature to get a Symbol from, not null
        Returns:
        the Symbol of the Feature that was passed
        Throws:
        IllegalArgumentException - if Feature is null
        Since:
        100.0.0
      • getSymbol

        public abstract Symbol getSymbol​(Graphic graphic)
        Gets the Symbol used to display the given Graphic.
        Parameters:
        graphic - the Graphic to get a Symbol from, not null
        Returns:
        the Symbol of the Graphic that was passed
        Throws:
        IllegalArgumentException - if Graphic is null
        Since:
        100.0.0
      • getSymbol

        public Symbol getSymbol​(Feature feature,
                                boolean applyAttributeOverrides)
        Returns the symbol that should be used to visualize the given feature with override expressions from renderer.

        If applyAttributeOverrides is set to true and the renderer contains an override expression, this method will return a symbol modified by the expression. If the expression cannot be properly evaluated due to missing fields or external data, then the original symbol is returned.

        Parameters:
        feature - the Feature to get a Symbol from, not null
        applyAttributeOverrides - true to apply override attributes from renderer
        Returns:
        the Symbol of the Feature that was passed
        Throws:
        IllegalArgumentException - if feature is null
        Since:
        100.5.0
      • getSymbol

        public Symbol getSymbol​(Graphic graphic,
                                boolean applyAttributeOverrides)
        Returns the symbol that should be used to visualize the given graphic with override expressions from renderer.

        If applyAttributeOverrides is set to true and the renderer contains an override expression, this method will return a symbol modified by the expression. If the expression cannot be properly evaluated due to missing fields or external data, then the original symbol is returned.

        Parameters:
        graphic - the Graphic to get a Symbol from, not null
        applyAttributeOverrides - true to apply override attributes from renderer
        Returns:
        the Symbol of the Graphic that was passed
        Throws:
        IllegalArgumentException - if graphic is null
        Since:
        100.5.0
      • setRotationType

        public void setRotationType​(RotationType rotationType)
        Sets the type of rotation that this Symbol uses to spin along the x-axis or y-axis.

        If ARITHMETIC, rotation is along the x-axis, with positive rotation being counter-clockwise.

        If GEOGRAPHIC, rotation is along the y-axis, with positive rotation being clockwise.

        Parameters:
        rotationType - the new rotation type for this Symbol, not null
        Throws:
        IllegalArgumentException - if input is null
        Since:
        100.0.0
      • getRotationExpression

        public String getRotationExpression()
        Gets a value that specifies the angle of rotation.

        Default value is null.

        Returns:
        the rotation expression
        Since:
        100.0.0
        See Also:
        setRotationExpression(java.lang.String)
      • setRotationExpression

        public void setRotationExpression​(String rotationExpression)
        Sets the rotation expression.

        This is a constant value or an expression that derives the angle of rotation based on the Feature attribute value. When an attribute name is specified in the rotation expression, it's enclosed in square brackets, for example: [Rotation].

        Example of setting a rotation expression with a SimpleRenderer:

         GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
         mapView.getGraphicsOverlays().add(graphicsOverlay);
         
         Point randomPoint = new Point(2000000, 2000000);
         Graphic graphic = new Graphic(randomPoint);
         graphic.getAttributes().put("Rotation", 45);
         graphicsOverlay.getGraphics().add(graphic);
        
         SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(Color.BLUE, 5, SimpleMarkerSymbol.Style.TRIANGLE);
         SimpleRenderer simpleRenderer = new SimpleRenderer(symbol);
         simpleRenderer.setRotationExpression("[Rotation]");
         graphicsOverlay.setRenderer(simpleRenderer);
         
        Parameters:
        rotationExpression - the new rotation expression
        Since:
        100.0.0
        See Also:
        getRotationExpression()
      • getSceneProperties

        public Renderer.SceneProperties getSceneProperties()
        Gets the scene view properties for the renderer. The scene properties object can be used to make changes to how GeoElement are displayed in a SceneView.
        Returns:
        the scene view properties for the renderer, which are applicable only to an ArcGISScene
        Since:
        100.0.0