Class Renderer

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Renderer.SceneProperties
      This represents renderer properties applicable only to an ArcGISScene.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static Renderer fromJson​(java.lang.String json)
      Creates a Renderer instance from a JSON string.
      java.lang.String getRotationExpression()
      Gets a value that specifies the angle of rotation.
      RotationType getRotationType()
      Gets the type of rotation that this Symbol uses to spin along the x-axis or y-axis.
      Renderer.SceneProperties getSceneProperties()
      Gets the scene view properties for the renderer.
      abstract Symbol getSymbol​(Feature feature)
      Gets the Symbol used to display the given Feature.
      Symbol getSymbol​(Feature feature, boolean applyAttributeOverrides)
      Returns the symbol that should be used to visualize the given feature with override expressions from renderer.
      abstract Symbol getSymbol​(Graphic graphic)
      Gets the Symbol used to display the given Graphic.
      Symbol getSymbol​(Graphic graphic, boolean applyAttributeOverrides)
      Returns the symbol that should be used to visualize the given graphic with override expressions from renderer.
      Symbol getSymbol​(DynamicEntity dynamicEntity)
      Returns the symbol that should be used to visualize the given dynamic entity.
      Symbol getSymbol​(DynamicEntityObservation dynamicEntityObservation)
      Returns the symbol that should be used to visualize the given dynamic entity observation.
      Symbol getSymbol​(DynamicEntityObservation dynamicEntityObservation, boolean applyAttributeOverrides)
      Returns the symbol that should be used to visualize the given dynamic entity observation with override attributes from the renderer.
      Symbol getSymbol​(DynamicEntity dynamicEntity, boolean applyAttributeOverrides)
      Returns the symbol that should be used to visualize the given dynamic entity with override attributes from the renderer.
      java.util.Map<java.lang.String,​java.lang.Object> getUnknownJson()
      If this object was created from JSON, this method gets unknown data from the source JSON.
      java.util.Map<java.lang.String,​java.lang.Object> getUnsupportedJson()
      If this object was created from JSON, this method gets unsupported data from the source JSON.
      void setRotationExpression​(java.lang.String rotationExpression)
      Sets the rotation expression.
      void setRotationType​(RotationType rotationType)
      Sets the type of rotation that this Symbol uses to spin along the x-axis or y-axis.
      java.lang.String toJson()
      Serializes this object to a JSON string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromJson

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

        public java.lang.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 java.util.Map<java.lang.String,​java.lang.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 this API and therefore not exposed.
        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 java.util.Map<java.lang.String,​java.lang.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 web maps and known to the version of the web map specification the API supports (see system requirements), but are not explicitly exposed through this 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 Symbol getSymbol​(DynamicEntity dynamicEntity)
        Returns the symbol that should be used to visualize the given dynamic entity.
        Parameters:
        dynamicEntity - the dynamic entity
        Returns:
        a Symbol, or null if none
        Throws:
        java.lang.NullPointerException - if dynamicEntity is null
        Since:
        200.1.0
      • getSymbol

        public Symbol getSymbol​(DynamicEntity dynamicEntity,
                                boolean applyAttributeOverrides)
        Returns the symbol that should be used to visualize the given dynamic entity with override attributes from the renderer.

        If applyAttributeOverrides is set to true, this method will get the symbol from the renderer and override the symbol properties with the overrides available on the renderer. These include visual variable size, color, opacity and rotation. If the override expression or attributes contain any information not known to either the renderer or dynamic entity (such as "scale"), that override will not be applied. If the override attributes are applied successfully a multilayer symbol will be returned else the original symbol will be returned.

        Parameters:
        dynamicEntity - the dynamic entity
        applyAttributeOverrides - if set to true, this applies the override attributes from the renderer to the symbol
        Returns:
        a Symbol, or null if none
        Throws:
        java.lang.NullPointerException - if dynamicEntity is null
        Since:
        200.1.0
      • getSymbol

        public Symbol getSymbol​(DynamicEntityObservation dynamicEntityObservation)
        Returns the symbol that should be used to visualize the given dynamic entity observation.
        Parameters:
        dynamicEntityObservation - the dynamic entity observation
        Returns:
        a Symbol, or null if none
        Throws:
        java.lang.NullPointerException - if dynamicEntityObservation is null
        Since:
        200.1.0
      • getSymbol

        public Symbol getSymbol​(DynamicEntityObservation dynamicEntityObservation,
                                boolean applyAttributeOverrides)
        Returns the symbol that should be used to visualize the given dynamic entity observation with override attributes from the renderer.

        If applyAttributeOverrides is set to true, this method will get the symbol from the renderer and override the symbol properties with the overrides available on the renderer. These include visual variable size, color, opacity and rotation. If the override expression or attributes contain any information not known to either the renderer or observation (such as "scale"), that override will not be applied. If the override attributes are applied successfully a multilayer symbol will be returned else the original symbol will be returned.

        Parameters:
        dynamicEntityObservation - the dynamic entity observation
        applyAttributeOverrides - if set to true, this applies the override attributes from the renderer to the symbol
        Returns:
        a Symbol, or null if none
        Throws:
        java.lang.NullPointerException - if dynamicEntityObservation is null
        Since:
        200.1.0
      • 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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.IllegalArgumentException - if input is null
        Since:
        100.0.0
      • getRotationExpression

        public java.lang.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​(java.lang.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