Skip to content

Commit

Permalink
Add olcs_tileLoadFunction customization
Browse files Browse the repository at this point in the history
  • Loading branch information
gberaudo committed Apr 24, 2024
1 parent 02f39d2 commit b5db06d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
11 changes: 6 additions & 5 deletions PROPERTIES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# OLCEsium Properties
# OLCEsium Properties

## olcs_extruded_height
## olcs_extruded_height
Value: number
The distance in meters between the polygon's extruded face and the ellipsoid surface.
Check buildings example for usage in context.

## olcs_shadows
Value: boolean
Enables shadow casting in 3D. Can be either applied to the entire feature set or by feature individually.
Enables shadow casting in 3D. Can be either applied to the entire feature set or by feature individually.
In order for it to work, [shadowMap](https://cesium.com/learn/cesiumjs/ref-doc/Scene.html?classFilter=scene#shadowMap) needs to be enabled in the Cesium scene. To use the sun as light source, enable [enableLighting](https://cesium.com/learn/cesiumjs/ref-doc/Globe.html#enableLighting) on the Globe.
Check buildings example for usage in context.

Expand All @@ -33,5 +33,6 @@ Value: number
Allows you to set a minimum zoom level for rendering 3D tiles in the Cesium view. This property helps to control the level of detail displayed in the 3D view based on the current zoom level.
Check mvt example for usage in context.



## olcs_tileLoadFunction
Value: https://openlayers.org/en/latest/apidoc/module-ol_Tile.html#~LoadFunction
Allows to use a custom function, for example when converting a WMS image source to a tiled one.
13 changes: 7 additions & 6 deletions src/olcs/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,17 @@ export function sourceToImageryProvider(
'olcs.imagesource': source
};
const imageLoadFunction = source.getImageLoadFunction();
const tileLoadFunction = source.get('olcs_tileLoadFunction') || function tileLoadFunction(tile: ImageTile, src: string) {
// An imageLoadFunction takes an ImageWrapperm which has a getImage method.
// A tile also has a getImage method.
// We incorrectly passe a tile as an ImageWrapper and hopes for the best.
imageLoadFunction(tile as any, src);
};
source = new olSourceTileWMS({
url: source.getUrl(),
attributions: source.getAttributions(),
projection: source.getProjection(),
tileLoadFunction(tile: ImageTile, src: string) {
// An imageLoadFunction takes an ImageWrapperm which has a getImage method.
// A tile also has a getImage method.
// We incorrectly passe a tile as an ImageWrapper and hopes for the best.
imageLoadFunction(tile as any, src);
},
tileLoadFunction,
params: source.getParams()
});
source.setProperties(sourceProps);
Expand Down

0 comments on commit b5db06d

Please sign in to comment.