メインコンテンツへスキップ

MapTheme

Description

This component represents the visual theme of the map.

NameTypeDefaultDescription
landColorstring#FFFFFFColor of land as a hexadecimal code
landOpacitynumber1Opacity range of land (0.0 - 1.0)
landVisibilitybooleantrueVisibility of land
buildingColorstring#FFFFFFColor of buildings as a hexadecimal code
buildingOpacitynumber1Opacity range of buildings (0.0 - 1.0)
buildingMinMetersnumber6Min height of buildings in meters
buildingMaxMetersnumber6Max height of buildings in meters
buildingVisibilitybooleantrueVisibility of buildings
buildingBasenumber0.014Height of the bottom of buildings, offset from land
parkColorstring#FFFFFFColor of parks as a hexadecimal code
parkOpacitynumber1Opacity range of parks (0.0 - 1.0)
parkVisibilitybooleantrueVisibility of park as a checkbox
parkBasenumber0.002Height of the park, offset from land
parkingColorstring#FFFFFFColor of parking lots as a hexadecimal code
parkingOpacitynumber1Opacity range of parking lots (0.0 - 1.0)
parkingVisibilitybooleantrueVisibility of parking lots
parkingBasenumber0.008Height of parking lots, offset from land
transitColorstring#FFFFFFColor of transit lines as a hexadecimal code
transitOpacitynumber1Opacity range of transit lines (0.0 - 1.0)
transitVisibilitybooleantrueVisibility of transit lines
transitMetersnumber6Width in meters of transit lines
transitBasenumber0.012Height of transit lines, offset from land
transitMinnumber0Minimum mapping system unit width of transit lines, when zooming out
roadColorstring#FFFFFFColor of roads as a hexadecimal code
roadOpacitynumber1Opacity range of roads (0.0 - 1.0)
roadVisibilitybooleantrueVisibility of roads
roadSMetersnumber2Width in meters of S Roads
roadMMetersnumber4Width in meters of M Roads
roadLMetersnumber8Width in meters of L Roads
roadXLMetersnumber32Width in meters of XL Roads
roadSMinnumber0Minimum mapping system unit width of S roads, when zooming out
roadMMinnumber0Minimum mapping system unit width of M roads, when zooming out
roadLMinnumber0Minimum mapping system unit width of L roads, when zooming out
roadXLMinnumber0Minimum mapping system unit width of XL roads, when zooming out
roadBasenumber0.01Height of roads, offset from land
sandColorstring#FFFFFFColor of sand as a hexadecimal code
sandOpacitynumber1Opacity range of sand (0.0 - 1.0)
sandVisibilitybooleantrueVisibility of sand
sandBasenumber0.004Height of sand, offset from land
waterColorstring#FFFFFFColor of waterways as a hexadecimal code
waterOpacitynumber1Opacity range of waterways (0.0 - 1.0)
waterVisibilitybooleantrueVisibility of waterways
waterWidthnumber6Width in meters of waterways
waterBasenumber0.006Height of waterways, offset from land
waterMinnumber0Minimum mapping system unit width of waterways, when zooming out
lodnumber1Level of detail. LOD higher than 1 will render less tile data (lower detail), while LOD lower than 1 will render more tile data (higher detail). LOD should be greater than 0.

Functions

Get

Returns a read-only reference.

Example

ecs.MapTheme.get(world, component.eid)

Set

Ensures the component exists on the entity, then assigns the (optional) data to the component.

Example

ecs.MapTheme.set(world, component.eid, {
landColor: '#AEC988',
buildingColor: '#EFEFEA',
parkColor: '#80B063',
buildingOpacity: 0.4,
buildingMinMeters: 6,
buildingMaxMeters: 50
})

Mutate

Perform an update to the component within a callback function. Return true to indicate no changes made.

Example

ecs.MapTheme.mutate(world, component.eid, (cursor) => {
cursor.buildingColor = '#FFFFFF';
cursor.transitColor = '#000000';
return false;
})

Remove

Removes the component from the entity.

Example

ecs.MapTheme.remove(world, component.eid)

Has

Returns true if the component is present on the entity.

Example

ecs.MapTheme.has(world, component.eid)

Reset

Adds, or resets the component to its default state.

Example

ecs.MapTheme.reset(world, component.eid)

Advanced Functions

Cursor

Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.

Example
ecs.MapTheme.cursor(world, component.eid)

Acquire

Same behavior as cursor, but commit must be called after the cursor is done being used.

Example
ecs.MapTheme.acquire(world, component.eid)

Commit

Called after acquire. An optional third argument determines whether the cursor was mutated or not.

Example
ecs.MapTheme.commit(world, component.eid)
ecs.MapTheme.commit(world, component.eid, false)

Dirty

Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.

Example
ecs.MapTheme.dirty(world, component.eid)