Class MapTheme
Usage
Obtain an instance either from one of the built-in presets
(light(), dark(), blue()) or by constructing a
custom theme with the nested MapTheme.Builder:
MapTheme custom = new MapTheme.Builder()
.backgroundColor(Color.WHITE)
.oceanColor(new Color(0xADD8E6))
.landColor(new Color(0x90EE90))
.build();
To tweak an existing theme without rebuilding it from scratch use
toBuilder(), which copies every field into a new MapTheme.Builder
ready for modification.
Thread safety
MapTheme instances are effectively immutable once constructed and
may be shared freely across threads and rendering layers.
Projection integration
Each IMapProjection holds a reference to its active
MapTheme. The projection consults the theme when drawing the map
outline, graticule lines, and the ocean fill. Renderers such as
CountryRenderer and CityPointRenderer obtain the theme via
the projection so that all layers remain visually consistent.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic MapThemeblue()Returns a blue-toned theme with a nautical aesthetic.static MapThemedark()Returns a dark-background theme suitable for low-light environments or stylistic preference.Returns the background color drawn behind the entire map panel.Returns the color used to stroke country political borders.Returns theStrokeused to draw country political borders.Returns the color used to draw city marker dots.Returns the color used to draw graticule lines (latitude parallels and longitude meridians).floatReturns the stroke width in points used for graticule lines.Returns the color used to render text labels such as city names.Returns the color used to fill land (country) polygons.Returns the color used to fill the ocean region inside the projection boundary.Returns the color used to stroke the outer boundary of the projection domain (e.g., the bounding rectangle for Mercator or the ellipse for Mollweide).floatReturns the stroke width in points used for the projection boundary outline.static MapThemelight()Returns a light-background theme suitable for daytime use or printing.Creates a newMapTheme.Builderpre-populated with every field from this theme.
-
Method Details
-
getBackgroundColor
Returns the background color drawn behind the entire map panel.- Returns:
- background
Color; nevernull
-
getOceanColor
Returns the color used to fill the ocean region inside the projection boundary.- Returns:
- ocean fill
Color; nevernull
-
getLandColor
Returns the color used to fill land (country) polygons.- Returns:
- land fill
Color; nevernull
-
getOutlineColor
Returns the color used to stroke the outer boundary of the projection domain (e.g., the bounding rectangle for Mercator or the ellipse for Mollweide).- Returns:
- outline stroke
Color; nevernull
-
getGraticuleColor
Returns the color used to draw graticule lines (latitude parallels and longitude meridians).All projection implementations must use this value rather than hardcoding a color so that theme switching takes full effect.
- Returns:
- graticule
Color; nevernull
-
getLabelColor
Returns the color used to render text labels such as city names.- Returns:
- label text
Color; nevernull
-
getCityColor
Returns the color used to draw city marker dots.CityPointRendereruses this color for point markers and falls back togetLabelColor()if this value isnull.- Returns:
- city marker
Color, ornullto use the label color
-
getBorderColor
Returns the color used to stroke country political borders.- Returns:
- border stroke
Color; nevernull
-
getOutlineStrokeWidth
public float getOutlineStrokeWidth()Returns the stroke width in points used for the projection boundary outline.- Returns:
- outline stroke width (≥ 0)
-
getGraticuleStrokeWidth
public float getGraticuleStrokeWidth()Returns the stroke width in points used for graticule lines.- Returns:
- graticule stroke width (≥ 0)
-
getBorderStroke
Returns theStrokeused to draw country political borders.Renderers that respect the theme (e.g.,
CountryRenderer) should use this stroke rather than constructing their own.- Returns:
- border
Stroke; nevernull
-
toBuilder
Creates a newMapTheme.Builderpre-populated with every field from this theme. Useful for creating a variation without specifying every value:MapTheme brighter = existingTheme.toBuilder() .landColor(Color.GREEN) .build();- Returns:
- a mutable
MapTheme.Builderthat reproduces this theme
-
light
Returns a light-background theme suitable for daytime use or printing.- Background: near-white (
#F0F0F0) - Ocean: light blue (
#CDE8FF) - Land: pale green (
#E3F2D9) - Cities: red
- Returns:
- a new light
MapThemeinstance
- Background: near-white (
-
dark
Returns a dark-background theme suitable for low-light environments or stylistic preference.- Background: near-black (
#20232A) - Ocean: dark navy (
#273746) - Land: dark blue-grey (
#34495E) - Cities: cyan
- Returns:
- a new dark
MapThemeinstance
- Background: near-black (
-
blue
Returns a blue-toned theme with a nautical aesthetic.- Background: pale blue (
#E9F2FF) - Ocean: medium blue (
#90CAF9) - Land: desaturated teal (
#D8E5E9) - Cities: deep navy (
#0D47A1)
- Returns:
- a new blue
MapThemeinstance
- Background: pale blue (
-