Class TranslucentMapLayerGroup
Class TranslucentMapLayerGroup
- java.lang.Object
-
- com.here.NativeBase
-
- com.here.sdk.mapview.TranslucentMapLayerGroup
-
public final class TranslucentMapLayerGroup extends NativeBase
A translucent layer group that can be the target for
MapLayerPriorityBuilder.inGroup(java.lang.String). Currently, only custom line layers can be added to a translucent layer group. Custom line layers in a translucent layer group are rendered in an offscreen translucent pass so that overlapping translucent line geometry is not alpha blended with itself. At creation, the layer group gets added to a map. The layer group gets removed from the map upon instance destruction and any layer (categories) still in the group are not rendered anymore, therefore it is recommended to keep a group alive as long as layers using the group are alive and in use.Conceptual example to place line layers into a translucent group:
// Create a translucent group with a unique name and a render priority MapLayerPriority groupPriority = new MapLayerPriorityBuilder().renderedLast().build(); TranslucentMapLayerGroup group = new TranslucentMapLayerGroup("TranslucentGroupName", map, groupPriority) // Create a line layer to be rendered as part of the translucent group MapLayerPriority lineLayerPriority = new MapLayerPriorityBuilder() .inGroup("TranslucentGroupName") // places the line layer into the group .renderedFirst() // to be rendered first when the group is rendered .withCategory("SomeCategory") // places the line layer category 'SomeCategory' .inGroup("TranslucentGroupName") // into the group .renderedLast() // to be rendered last when the group is rendered .build(); MapLayer lineLayer = new MapLayerBuilder() .withDataSource("DataSourceName", MapContentType.LINE) .forMap(map) .withName("LineLayerName") .withPriority(lineLayerPriority) .withStyle(translucentLineStyle) // E.g. "technique": "line" ... "color": "#FFFFFF80" .build(); // Create a second line layer to be rendered as part of the translucent group MapLayerPriority secondLineLayerPriority = new MapLayerPriorityBuilder() .inGroup("TranslucentGroupName") // places the second line layer into the group .renderedBeforeLayer("LineLayerName") // to be rendered before first layer // when the group is rendered .build(); MapLayer secondLineLayer = new MapLayerBuilder() .withDataSource("SecondDataSourceName", MapContentType.LINE) .forMap(map) .withName("SecondLineLayerName") .withPriority(secondLineLayerPriority) .withStyle(secondTranslucentLineStyle) // E.g. "technique": "line" ... "color": "#FFFFFF80" .build();Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTranslucentMapLayerGroup.ErrorCodeError codes for creating the group.static classTranslucentMapLayerGroup.ErrorDetailsDescribes the reason for failing to create the group.static classTranslucentMapLayerGroup.InstantiationExceptionThrown when failing to build the group.
-
Constructor Summary
Constructors Constructor Description TranslucentMapLayerGroup(java.lang.String name, HereMap aMap)Creates an instance of the group.TranslucentMapLayerGroup(java.lang.String name, HereMap aMap, MapLayerPriority priority)Creates an instance of the group.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Frees all internally used resources.voidsetPriority(MapLayerPriority priority)Sets the render priority for the layer group which replaces any previously defined priority.
-
-
-
Constructor Detail
-
TranslucentMapLayerGroup
public TranslucentMapLayerGroup(@NonNull java.lang.String name, @NonNull HereMap aMap) throws TranslucentMapLayerGroup.InstantiationExceptionCreates an instance of the group.
- Parameters:
name-Name of the group. Must be unique across
MapLayerandTranslucentMapLayerGroup.aMap-The map to attach the group to.
- Throws:
TranslucentMapLayerGroup.InstantiationException-In case of invalid input parameters.
-
TranslucentMapLayerGroup
public TranslucentMapLayerGroup(@NonNull java.lang.String name, @NonNull HereMap aMap, @NonNull MapLayerPriority priority) throws TranslucentMapLayerGroup.InstantiationExceptionCreates an instance of the group.
- Parameters:
name-Name of the group. Must be unique across
MapLayerandTranslucentMapLayerGroup.aMap-The map to attach the group to.
priority-The
MapLayerPrioritywhich should be applied to position the group. TheMapLayerPrioritymust contain only one priority and this priority must have no category and no group, i.e.MapLayerPriorityBuilder.inGroup(java.lang.String)andMapLayerPriorityBuilder.withCategory(java.lang.String)should not be used when building theMapLayerPriority. Example:new MapLayerPriorityBuilder().renderedAfterLayer("water").build()- Throws:
TranslucentMapLayerGroup.InstantiationException-In case of invalid input parameters.
-
-
Method Detail
-
setPriority
public void setPriority(@NonNull MapLayerPriority priority)Sets the render priority for the layer group which replaces any previously defined priority.
- Parameters:
priority-The priority to position the group. The
MapLayerPrioritymust contain only one priority and this priority must have no category and no group, i.e.MapLayerPriorityBuilder.inGroup(java.lang.String)andMapLayerPriorityBuilder.withCategory(java.lang.String)should not be used when building theMapLayerPriority. Example:new MapLayerPriorityBuilder().renderedAfterLayer("water").build()
-
destroy
public void destroy()
Frees all internally used resources. After calling this method, the object is not usable anymore.
-
-