API reference
@klorad/engine-openlayers
The scene as a 2D plan with OpenLayers. A reader like the three.js one, drawing the same World from above.
import { createMapRenderer } from "@klorad/engine-openlayers";
import { MapView } from "@klorad/engine-openlayers/react";Peer dependencies: ol 10; react and @klorad/react for MapView.
| Export | Kind | Description |
|---|---|---|
createMapRenderer(options) | function | Draws the scene as a plan into container. Returns a MapRenderer. |
MapView (/react) | component | The plan as a React component; reads the scene from KloradProvider unless given one, and needs no provider when given one. A ref gives frame, view and footprint. |
defaultMapPalette, defaultMapStyle | value | The default colours and style: correspondence by colour, a shadow or twin without a fresh reading in grey, the selected one outlined. |
MapPalette, MapLook, MapStyleContext, MapStyleFn | type | For objectStyle. |
planShape(object, cs) | function | An object as a shape on a plan in longitude and latitude: an area, a line with a width, or a point. |
openLayersCapabilities | value | What this reader draws: every kind from above, a model as a symbol, two dimensions. |
What it draws
| Geometry | On the plan |
|---|---|
extrusion, polygon | The footprint, turned by the object's heading and sized by its scale. |
box | Its footprint, width by depth. |
cylinder, sphere | A circle of its radius. |
polyline | The path, as wide as its width in metres at every zoom. |
marker | A dot at its position. |
model, splat | A symbol at its position: the shape lives in its file. |
feature | Its footprint, turned by the heading, as an area on the plan, when it has one. |
group | Nothing of its own: its parts are drawn. |
Options
Prop
Type
MapRenderer
| Member | Description |
|---|---|
select(objectId | null) | Outlines an object; selection is your state, not the world's. |
frame(objectIds?) | Fits the plan to the given objects, or to all of them. |
view() | The centre, zoom and metres per pixel. |
footprint() | The area in view, as a box on Earth. |
dispose() | Stops drawing and removes the map. |
Something wrong or unclear? Tell us.
@klorad/engine-three
Draws a scene with three.js, follows its events, reports what the pointer does, and never changes world state.
@klorad/engine-cesium
The scene on the globe with CesiumJS. A reader like the three.js and OpenLayers ones, drawing the same World, with buildings streamed as 3D Tiles and their elements as features.