MapTheme
Description
This component represents the visual theme of the map.
Name | Type | Default | Description |
---|---|---|---|
landColor | string | #FFFFFF | Color of land as a hexadecimal code |
landOpacity | number | 1 | Opacity range of land (0.0 - 1.0) |
landVisibility | boolean | true | Visibility of land |
buildingColor | string | #FFFFFF | Color of buildings as a hexadecimal code |
buildingOpacity | number | 1 | Opacity range of buildings (0.0 - 1.0) |
buildingMinMeters | number | 6 | Min height of buildings in meters |
buildingMaxMeters | number | 6 | Max height of buildings in meters |
buildingVisibility | boolean | true | Visibility of buildings |
buildingBase | number | 0.014 | Height of the bottom of buildings, offset from land |
parkColor | string | #FFFFFF | Color of parks as a hexadecimal code |
parkOpacity | number | 1 | Opacity range of parks (0.0 - 1.0) |
parkVisibility | boolean | true | Visibility of park as a checkbox |
parkBase | number | 0.002 | Height of the park, offset from land |
parkingColor | string | #FFFFFF | Color of parking lots as a hexadecimal code |
parkingOpacity | number | 1 | Opacity range of parking lots (0.0 - 1.0) |
parkingVisibility | boolean | true | Visibility of parking lots |
parkingBase | number | 0.008 | Height of parking lots, offset from land |
transitColor | string | #FFFFFF | Color of transit lines as a hexadecimal code |
transitOpacity | number | 1 | Opacity range of transit lines (0.0 - 1.0) |
transitVisibility | boolean | true | Visibility of transit lines |
transitMeters | number | 6 | Width in meters of transit lines |
transitBase | number | 0.012 | Height of transit lines, offset from land |
transitMin | number | 0 | Minimum mapping system unit width of transit lines, when zooming out |
roadColor | string | #FFFFFF | Color of roads as a hexadecimal code |
roadOpacity | number | 1 | Opacity range of roads (0.0 - 1.0) |
roadVisibility | boolean | true | Visibility of roads |
roadSMeters | number | 2 | Width in meters of S Roads |
roadMMeters | number | 4 | Width in meters of M Roads |
roadLMeters | number | 8 | Width in meters of L Roads |
roadXLMeters | number | 32 | Width in meters of XL Roads |
roadSMin | number | 0 | Minimum mapping system unit width of S roads, when zooming out |
roadMMin | number | 0 | Minimum mapping system unit width of M roads, when zooming out |
roadLMin | number | 0 | Minimum mapping system unit width of L roads, when zooming out |
roadXLMin | number | 0 | Minimum mapping system unit width of XL roads, when zooming out |
roadBase | number | 0.01 | Height of roads, offset from land |
sandColor | string | #FFFFFF | Color of sand as a hexadecimal code |
sandOpacity | number | 1 | Opacity range of sand (0.0 - 1.0) |
sandVisibility | boolean | true | Visibility of sand |
sandBase | number | 0.004 | Height of sand, offset from land |
waterColor | string | #FFFFFF | Color of waterways as a hexadecimal code |
waterOpacity | number | 1 | Opacity range of waterways (0.0 - 1.0) |
waterVisibility | boolean | true | Visibility of waterways |
waterWidth | number | 6 | Width in meters of waterways |
waterBase | number | 0.006 | Height of waterways, offset from land |
waterMin | number | 0 | Minimum mapping system unit width of waterways, when zooming out |
lod | number | 1 | Level 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)