public class

Options

extends Object
java.lang.Object
   ↳ com.carto.components.Options

Class Overview

A class containing various options for rendering and map manipulation.

Summary

Public Methods
synchronized void delete()
boolean equals(Object obj)
Checks if this object is equal to the specified object.
Color getAmbientLightColor()
Returns the color of the ambient light.
Bitmap getBackgroundBitmap()
Returns the background bitmap.
Projection getBaseProjection()
Returns the base projection.
Color getClearColor()
Returns the clear color used by the renderer before drawing anything else.
float getDPI()
Returns the dots per inch value.
float getDrawDistance()
Returns the draw distance value.
int getEnvelopeThreadPoolSize()
Returns the number of threads used by the envelope task pool.
int getFieldOfViewY()
Returns the vertial field of view angle.
ScreenPos getFocusPointOffset()
Returns the focus point offset (from screen center) in pixels.
Color getMainLightColor()
Returns the color of the main light.
MapVec getMainLightDirection()
Returns the direction of the main light.
MapBounds getPanBounds()
Returns the map panning bounds constraints.
PanningMode getPanningMode()
Returns the panning mode.
PivotMode getPivotMode()
Returns the pivot mode.
RenderProjectionMode getRenderProjectionMode()
Returns the render projection mode.
Color getSkyColor()
Returns the sky color.
int getTileDrawSize()
Returns the tile size used for drawing map tiles.
int getTileThreadPoolSize()
Returns the number of threads used by the tile task pool.
MapRange getTiltRange()
Returns the tilt range constraint.
float getWatermarkAlignmentX()
Returns the horizontal alignment of the watermark.
float getWatermarkAlignmentY()
Returns the vertical alignment of the watermark.
Bitmap getWatermarkBitmap()
Returns the watermark bitmap.
ScreenPos getWatermarkPadding()
Returns the padding of the watermark.
float getWatermarkScale()
Returns the watermark relative scale.
MapRange getZoomRange()
Returns the zoom range constraint.
int hashCode()
Returns the hash value of this object.
boolean isClickTypeDetection()
Returns the click type detection state.
boolean isKineticPan()
Returns the state of the kinetic panning flag.
boolean isKineticRotation()
Returns the state of the kinetic rotation flag.
boolean isKineticZoom()
Returns the state of kinetic zoom flag.
boolean isRestrictedPanning()
Returns the state of the restricted panning flag.
boolean isRotatable()
Returns the state of the map rotatability flag.
boolean isSeamlessPanning()
Returns the state of seamless horizontal panning flag.
boolean isTiltGestureReversed()
Returns true if tilting gesture direction is reversed (and same as with Google Maps).
boolean isUserInput()
Returns the state of the user input flag.
boolean isZoomGestures()
Returns the state of zoom gestures.
void setAmbientLightColor(Color color)
Sets the ambient light color.
void setBackgroundBitmap(Bitmap backgroundBitmap)
Sets the background bitmap.
void setBaseProjection(Projection baseProjection)
Sets the base projection.
void setClearColor(Color color)
Sets the clear color of the renderer.
void setClickTypeDetection(boolean enabled)
Sets the state of the click type detection flag.
void setDPI(float dpi)
Sets the dots per inch value.
void setDrawDistance(float drawDistance)
Sets a new draw distance value.
void setEnvelopeThreadPoolSize(int poolSize)
Sets the number of threads used by the envelope task pool.
void setFieldOfViewY(int fovY)
Sets the vertial field of view angle.
void setFocusPointOffset(ScreenPos offset)
Sets the focus point offset (from screen center) in pixels.
void setKineticPan(boolean enabled)
Sets the state of the kinetic panning flag.
void setKineticRotation(boolean enabled)
Sets the state of the kinetic rotation flag.
void setKineticZoom(boolean enabled)
Sets the state of the kinetic zooming flag.
void setMainLightColor(Color color)
Sets the color of the main light.
void setMainLightDirection(MapVec direction)
Sets the direction of the main light.
void setPanBounds(MapBounds panBounds)
Sets the map panning bounds constraints.
void setPanningMode(PanningMode panningMode)
Sets the panning mode.
void setPivotMode(PivotMode pivotMode)
Sets the pivot mode.
void setRenderProjectionMode(RenderProjectionMode renderProjectionMode)
Sets the render projection mode.
void setRestrictedPanning(boolean enabled)
Sets the restricted panning flag.
void setRotatable(boolean enabled)
Sets the state of the map rotatability flag.
void setSeamlessPanning(boolean enabled)
Sets the state of seamless horizontal panning flag.
void setSkyColor(Color color)
Sets the sky color.
void setTileDrawSize(int tileDrawSize)
Sets the tile size for drawing map tiles.
void setTileThreadPoolSize(int poolSize)
Sets the number of threads used by the tile task pool.
void setTiltGestureReversed(boolean reversed)
Sets the tilting gesture direction.
void setTiltRange(MapRange tiltRange)
Sets the tilt range constraint.
void setUserInput(boolean enabled)
Sets the state of the user input flag.
void setWatermarkAlignmentX(float alignmentX)
Sets the position of the watermark relative to the screen.
void setWatermarkAlignmentY(float alignmentY)
Sets the position of the watermark relative to the screen.
void setWatermarkBitmap(Bitmap watermarkBitmap)
Sets the watermark bitmap.
void setWatermarkPadding(ScreenPos padding)
Sets the padding between the watermark and the edge of the screen.
void setWatermarkScale(float scale)
Set the watermark relative scale.
void setZoomGestures(boolean enabled)
Sets the zoom gestures flag.
void setZoomRange(MapRange zoomRange)
Sets the zoom range constraint.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public synchronized void delete ()

public boolean equals (Object obj)

Checks if this object is equal to the specified object.

Parameters
obj The reference object.
Returns
  • True when objects are equal, false otherwise.

public Color getAmbientLightColor ()

Returns the color of the ambient light.

Returns
  • The color of the ambient light.

public Bitmap getBackgroundBitmap ()

Returns the background bitmap. May be null.

Returns
  • The background bitmap.

public Projection getBaseProjection ()

Returns the base projection.

Returns
  • The base projection.

public Color getClearColor ()

Returns the clear color used by the renderer before drawing anything else.
By default, this is white. It should be set to (0, 0, 0, 0) if transparent MapView is needed.

Returns
  • The clear color.

public float getDPI ()

Returns the dots per inch value.

Returns
  • The dots per inch value.

public float getDrawDistance ()

Returns the draw distance value.

Returns
  • The draw distance value.

public int getEnvelopeThreadPoolSize ()

Returns the number of threads used by the envelope task pool.

Returns
  • The envelope task thread pool size.

public int getFieldOfViewY ()

Returns the vertial field of view angle.

Returns
  • The vertical field of view angle in degrees.

public ScreenPos getFocusPointOffset ()

Returns the focus point offset (from screen center) in pixels.

Returns
  • The focus point offset in pixels.

public Color getMainLightColor ()

Returns the color of the main light.

Returns
  • The color of the main light.

public MapVec getMainLightDirection ()

Returns the direction of the main light.

Returns
  • The direction of the main light.

public MapBounds getPanBounds ()

Returns the map panning bounds constraints. Map bounds minimum and maximum points are in the base
projection's coordinate system.

Returns
  • The map bounds constraints.

public PanningMode getPanningMode ()

Returns the panning mode.

Returns
  • The panning mode.

public PivotMode getPivotMode ()

Returns the pivot mode.

Returns
  • The pivot mode.

public RenderProjectionMode getRenderProjectionMode ()

Returns the render projection mode.

Returns
  • The render projection mode.

public Color getSkyColor ()

Returns the sky color.

Returns
  • The sky color.

public int getTileDrawSize ()

Returns the tile size used for drawing map tiles.

Returns
  • The tile size in density-independent pixels (dp).

public int getTileThreadPoolSize ()

Returns the number of threads used by the tile task pool.

Returns
  • The tile task thread pool size.

public MapRange getTiltRange ()

Returns the tilt range constraint.

Returns
  • The tilt range constraint in degrees.

public float getWatermarkAlignmentX ()

Returns the horizontal alignment of the watermark.

Returns
  • The horizontal alignment of the watermark.

public float getWatermarkAlignmentY ()

Returns the vertical alignment of the watermark.

Returns
  • The vertical alignment of the watermark.

public Bitmap getWatermarkBitmap ()

Returns the watermark bitmap. May be null.

Returns
  • The watermark bitmap.

public ScreenPos getWatermarkPadding ()

Returns the padding of the watermark.

Returns
  • The padding of the watermark in dp.

public float getWatermarkScale ()

Returns the watermark relative scale.

Returns
  • The watermark relative scale. The default is 1.

public MapRange getZoomRange ()

Returns the zoom range constraint.

Returns
  • The zoom range constraint.

public int hashCode ()

Returns the hash value of this object.

Returns
  • The hash value of this object.

public boolean isClickTypeDetection ()

Returns the click type detection state.

Returns
  • True if click type detecton is enabled.

public boolean isKineticPan ()

Returns the state of the kinetic panning flag.

Returns
  • True if kinetic panning is enabled.

public boolean isKineticRotation ()

Returns the state of the kinetic rotation flag.

Returns
  • True if kinetic rotation is enabled.

public boolean isKineticZoom ()

Returns the state of kinetic zoom flag.

Returns
  • True if kinetic zooming is enabled.

public boolean isRestrictedPanning ()

Returns the state of the restricted panning flag.

Returns
  • True if restricted panning is enabled.

public boolean isRotatable ()

Returns the state of the map rotatability flag.

Returns
  • True if map rotating is enabled.

public boolean isSeamlessPanning ()

Returns the state of seamless horizontal panning flag.

Returns
  • True if seamless horizontal panning is enabled.

public boolean isTiltGestureReversed ()

Returns true if tilting gesture direction is reversed (and same as with Google Maps).

Returns
  • True if tilting gesture direction is reversed (and same as with Google Maps). Otherwise returns false.

public boolean isUserInput ()

Returns the state of the user input flag.

Returns
  • True if user input is allowed.

public boolean isZoomGestures ()

Returns the state of zoom gestures. Zoom gestures allow to use double click and dual click to zoom in/out of the map.

Returns
  • True if zoom gestures are enabled. False otherwise.

public void setAmbientLightColor (Color color)

Sets the ambient light color.
Ambient light affects all lighting enabled models in the scene equally, it has no direction or location.

Parameters
color The new color for the ambient light.

public void setBackgroundBitmap (Bitmap backgroundBitmap)

Sets the background bitmap. The purpose of the background bitmap is to fill out the empty space when there's
no map data visible. The bitmap will get scaled and repeated to cover the hole visible area. If a null pointer is passed,
the background won't be drawn.
The width and height of the bitmap must be power of two (for example: 256 * 256 or 128 * 512).
It's also preferred if the bitmap was square (width == height), but this is not a requirement.
The default is "default_background.png".

Parameters
backgroundBitmap The new background bitmap.

public void setBaseProjection (Projection baseProjection)

Sets the base projection. All MapView, MapEventListener and Options methods use the coordinate system of this projection.
For example, if base projection is set to EPSG3857 then MapView::getFocusPos returns the coordinates in the EPSG3857 coordinate system,
The same applies to setter methods like MapView::setFocusPos which expect the input coordinates to be in the base projection's coordinate system.
The default is EPSG3857.

Parameters
baseProjection The new base projection.

public void setClearColor (Color color)

Sets the clear color of the renderer.

Parameters
color The new clear color.

public void setClickTypeDetection (boolean enabled)

Sets the state of the click type detection flag. If set to true clicks are categorized as normal clicks, double clicks,
long clicks and dual clicks. The click type resolving take about 400ms, so for applications that do not
require this functionality, it can be turned off. The default is true.

Parameters
enabled The new state of the click type detection flag.

public void setDPI (float dpi)

Sets the dots per inch value. This is calculated automatically by the SDK when the MapView is created using
the device screen parameters. The purpose of this value is to compensate for very high or low resolution devices,
so that the map remains readable.

Parameters
dpi The new dots per inch value.

public void setDrawDistance (float drawDistance)

Sets a new draw distance value. The higher the draw distance the more tiles can be seen, if the map is tilted.
Changing the draw distance will cause the horizon to move, which means that the if the sky bitmap is used,
the horizon may not match up anymore. Increasing this value will decrease performance and increase network traffic,
if online map is used. The default is 16.

Parameters
drawDistance The new draw distance value.

public void setEnvelopeThreadPoolSize (int poolSize)

Sets the number of threads used by the envelope task pool. More threads means more envelope tasks
are executed in parallel. This might speed up the data query, but may cause performance drops. Default is 1.

Parameters
poolSize The new envelope task thread pool size.

public void setFieldOfViewY (int fovY)

Sets the vertial field of view angle. Larger values increase the viewable area, at the cost of performance and
additional perspective distortion. The default is 70.

Parameters
fovY The new vertical field of view angle in degrees.

public void setFocusPointOffset (ScreenPos offset)

Sets the focus point offset (from screen center) in pixels.

Parameters
offset The new focus point offset in pixels.

public void setKineticPan (boolean enabled)

Sets the state of the kinetic panning flag. Kinetic panning allows the map to pan automatically using
the inertia of the last swipe, after the user has finished interacting with the touch screen.
Default is true.

Parameters
enabled The new state of the kinetic panning flag.

public void setKineticRotation (boolean enabled)

Sets the state of the kinetic rotation flag. Kinetic rotation allows the map to rotate automatically using
the inertia of the last swipe, after the user has finished interacting with the touch screen.
Default is true.

Parameters
enabled The new state of the kinetic rotation flag.

public void setKineticZoom (boolean enabled)

Sets the state of the kinetic zooming flag. Kinetic zooming allows the map to zoom automatically using
the inertia of the last swipe, after the user has finished interacting with the touch screen.
Default is true.

Parameters
enabled The new state of the kinetic zooming flag.

public void setMainLightColor (Color color)

Sets the color of the main light. The main light affects all lighting enabled models
in the scene equally from a certain direction. This light can be used to simulate sun or moon light.

Parameters
color The new color for the main light.

public void setMainLightDirection (MapVec direction)

Sets the direction of the main light. The main light affects all lighting enabled models
in the scene equally from a certain direction. This light can be used to simulate sun or moon light.
The direction is always measured based on the local tangent frame of the focus point.

Parameters
direction The new direction vector for the main light. (0,0,-1) means straight down, (-0.707,0,-0.707) means
from east with a 45 degree angle. The direction vector will be normalized.

public void setPanBounds (MapBounds panBounds)

Sets the map panning bounds constraints. This will limit camera movement to the specified bounds.
The current camera position will remain unaffected, until the next time camera position changes.
Map bounds minimum and maximum points are expected to be in the base projection's coordinate system.
If the bounds are larger than the world size, they will be clamped to world bounds. The default value covers the
whole world.

Parameters
panBounds The new map bounds constraints.

public void setPanningMode (PanningMode panningMode)

Sets the panning mode. The default is PanningMode::FREE.

Parameters
panningMode The new panning mode.

public void setPivotMode (PivotMode pivotMode)

Sets the pivot mode. The default is PIVOT_MODE_TOUCHPOINT

Parameters
pivotMode The new pivot mode.

public void setRenderProjectionMode (RenderProjectionMode renderProjectionMode)

Sets the render projection mode. The default is RenderProjectionMode::PLANAR.

Parameters
renderProjectionMode The new render projection mode.

public void setRestrictedPanning (boolean enabled)

Sets the restricted panning flag. If set to true, then focus point coordinates and zoom level of the map view
will be adjusted to display as little empty background as possible. The default is false.

public void setRotatable (boolean enabled)

Sets the state of the map rotatability flag. If set to false the map can't be rotated by any means. The default is true.

Parameters
enabled The new state of the map rotatability flag.

public void setSeamlessPanning (boolean enabled)

Sets the state of seamless horizontal panning flag. If set to true, the user can scroll seamlessly from
the left side of the map to the right, and the other way around. The default is true.

Parameters
enabled The new state of seamless horizontal panning flag.

public void setSkyColor (Color color)

Sets the sky color. The purpose of the sky bitmap is to fill out the empty space visible at low tilt angles.

Parameters
color The new sky color. If the color is transparent, sky is not rendered.

public void setTileDrawSize (int tileDrawSize)

Sets the tile size for drawing map tiles. Different datasources may have different tile sizes, this option
can be used to compensate for bigger or smaller tiles than default. The default is 256.

Parameters
tileDrawSize The new tile size in density-independent pixels (dp).

public void setTileThreadPoolSize (int poolSize)

Sets the number of threads used by the tile task pool. More threads means more tile tasks
are executed in parallel. This might speed up the data query, but may cause performance drops. Default is 1.

Parameters
poolSize The new tile task thread pool size.

public void setTiltGestureReversed (boolean reversed)

Sets the tilting gesture direction. By default, the gesture is not reversed.

Parameters
reversed True if Google Maps compatible mode should be used. False otherwise (default).

public void setTiltRange (MapRange tiltRange)

Sets the tilt range constraint. This will limit the tilt angle of the camera to the specified range.
The current tilt angle will remain unaffected, until the next time the tilt angle changes.
The minimum tilt angle is 30 degrees and the maximum is 90 degrees. Values that are out of range will be clamped.
The default value is MapRange(30, 90).

Parameters
tiltRange The new tilt range constraint in degrees.

public void setUserInput (boolean enabled)

Sets the state of the user input flag. If set to false the user won't be able to pan the map using touch controls,
programmatic map panning using MapView methods is still possible. The default is false.

Parameters
enabled The new state of the user input flag.

public void setWatermarkAlignmentX (float alignmentX)

Sets the position of the watermark relative to the screen. Values will be clamped to [-1, 1] range.

Parameters
alignmentX The new horizontal alignment for the watermark. -1 means the left side,
0 the center and 1 the right side. The default is 1.

public void setWatermarkAlignmentY (float alignmentY)

Sets the position of the watermark relative to the screen. Values will be clamped to [-1, 1] range.

Parameters
alignmentY The new vertical alignment for the watermark. -1 means the bottom,
0 the center and 1 the top. The default is -1.

public void setWatermarkBitmap (Bitmap watermarkBitmap)

Sets the watermark bitmap. This is only available with enterprise licenses. The watermark will be displayed
on top of the map view in a user chosen corner. If null is passed no watermark will be displayed.

Parameters
watermarkBitmap The new watermark bitmap.

public void setWatermarkPadding (ScreenPos padding)

Sets the padding between the watermark and the edge of the screen.

Parameters
padding The new padding for the watermark in dp. The default is 4,4.

public void setWatermarkScale (float scale)

Set the watermark relative scale. By default, watermark size is independant of the actual watermark bitmap size.
This method can be used to change this.

Parameters
scale The new relative scale value.

public void setZoomGestures (boolean enabled)

Sets the zoom gestures flag. By default, zoom gestures are not enabled.

Parameters
enabled True if zoom gestured should be enabled, false otherwise.

public void setZoomRange (MapRange zoomRange)

Sets the zoom range constraint. This will limit the zoom level of the camera to the specified range.
The current zoom level will remain unaffected, until the next time the zoom level changes.
The minimum zoom value is 0 and the maximum is 24. Values that are out of range will be clamped.
The default value is MapRange(0, 24).

Parameters
zoomRange The new zoom range constraint.