Skip to content

Commit daed8ed

Browse files
committed
Document all olcs_xx properties
1 parent b5db06d commit daed8ed

8 files changed

+38
-13
lines changed

CHANGES.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# Changelog
22

3-
## v 2.19.4
3+
4+
## v 2.20.0
45

56
* Changes
67
* Convert all image WMS sources regardless of their load functions
8+
* Allow to force a specific tileLoadFunction using the olcs\_tileLoadFunction property
9+
10+
* Breaking changes
11+
* Rename all 'olcs.xx' properties to 'olcs\_xx' and document them in PROPERTIES.md
712

813
## v 2.19.3
914

PROPERTIES.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@ Value: number
3333
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.
3434
Check mvt example for usage in context.
3535

36-
## olcs_tileLoadFunction
36+
## olcs_tileLoadFunction (ImageWMS sources)
3737
Value: https://openlayers.org/en/latest/apidoc/module-ol_Tile.html#~LoadFunction
3838
Allows to use a custom function, for example when converting a WMS image source to a tiled one.
39+
40+
## olcs_projection
41+
Value: https://openlayers.org/en/latest/apidoc/module-ol_proj_Projection-Projection.html
42+
Allows to use an alternative projection in CesiumJS. See the customProj example.
43+
44+
## olcs_polygon_kind
45+
Value: "rectangle"
46+
Allows to use the Cesium Rectangle geometry instead of a polygon geometry. See the vector example.
47+
48+
## olcs_3d_geometry (OL vector source)
49+
Value: https://openlayers.org/en/latest/apidoc/module-ol_geom_Geometry-Geometry.html
50+
Allows to use an alternative geometry in CesiumJS.
51+
52+
## olcs_proxy
53+
Value: https://cesium.com/learn/cesiumjs/ref-doc/Proxy.html
54+
Allows to add authentication information to requests sent by CesiumJS or manipulate request.
55+
56+
## olcs_extent
57+
Value: An array of numbers representing an extent: [minx, miny, maxx, maxy]
58+
Allows to restrict a tiled imagery layer to a rectangle. This avoid sending useless requests.

examples/customProj.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const customProjSource = new olSourceImageWMS({
1818
url: 'https://wms.geo.admin.ch/'
1919
});
2020

21-
customProjSource.set('olcs.projection', getProjection('EPSG:3857'));
21+
customProjSource.set('olcs_projection', getProjection('EPSG:3857'));
2222

2323
Cesium.Ion.defaultAccessToken = OLCS_ION_TOKEN;
2424
const ol2d = new olMap({

examples/vectors.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ const cartographicRectangleStyle = new olStyleStyle({
246246
});
247247
const cartographicRectangleGeometry = new olGeomPolygon([[[-5e6, 11e6],
248248
[4e6, 11e6], [4e6, 10.5e6], [-5e6, 10.5e6], [-5e6, 11e6]]]);
249-
cartographicRectangleGeometry.set('olcs.polygon_kind', 'rectangle');
249+
cartographicRectangleGeometry.set('olcs_polygon_kind', 'rectangle');
250250
const cartographicRectangle = new olFeature({
251251
geometry: cartographicRectangleGeometry
252252
});
@@ -263,7 +263,7 @@ const cartographicRectangleGeometry2 = new olGeomMultiPolygon([
263263
[-5e6, 11e6, 1e6], [-5e6, 11.5e6, 1e6]
264264
]]
265265
]);
266-
cartographicRectangleGeometry2.set('olcs.polygon_kind', 'rectangle');
266+
cartographicRectangleGeometry2.set('olcs_polygon_kind', 'rectangle');
267267
const cartographicRectangle2 = new olFeature({
268268
geometry: cartographicRectangleGeometry2
269269
});

src/olcs/FeatureConverter.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ export default class FeatureConverter {
472472
let fillGeometry, outlineGeometry;
473473
let outlinePrimitive: GroundPolylinePrimitive;
474474
if ((olGeometry.getCoordinates()[0].length == 5) &&
475-
(feature.get('olcs.polygon_kind') === 'rectangle')) {
475+
(feature.get('olcs_polygon_kind') === 'rectangle')) {
476476
// Create a rectangle according to the longitude and latitude curves
477477
const coordinates = olGeometry.getCoordinates()[0];
478478
// Extract the West, South, East, North coordinates
@@ -1033,7 +1033,7 @@ export default class FeatureConverter {
10331033
return opt_geom;
10341034
}
10351035

1036-
const geom3d: OLGeometry = feature.get('olcs.3d_geometry');
1036+
const geom3d: OLGeometry = feature.get('olcs_3d_geometry');
10371037
if (geom3d && geom3d instanceof OLGeometry) {
10381038
return geom3d;
10391039
}

src/olcs/core.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ export function sourceToImageryProvider(
359359
// Convert ImageWMS to TileWMS
360360
if (source instanceof olSourceImageWMS && source.getUrl()) {
361361
const sourceProps = {
362-
'olcs.proxy': source.get('olcs.proxy'),
363-
'olcs.extent': source.get('olcs.extent'),
364-
'olcs.projection': source.get('olcs.projection'),
362+
'olcs_proxy': source.get('olcs_proxy'),
363+
'olcs_extent': source.get('olcs_extent'),
364+
'olcs_projection': source.get('olcs_projection'),
365365
'olcs.imagesource': source
366366
};
367367
const imageLoadFunction = source.getImageLoadFunction();
@@ -482,7 +482,7 @@ export function tileLayerToImageryLayer(olMap: Map, olLayer: BaseLayer, viewProj
482482

483483
const layerOptions: {rectangle?: Rectangle} = {};
484484

485-
const forcedExtent = (olLayer.get('olcs.extent'));
485+
const forcedExtent = (olLayer.get('olcs_extent'));
486486
const ext = forcedExtent || olLayer.getExtent();
487487
if (ext) {
488488
layerOptions.rectangle = extentToRectangle(ext, viewProj);

src/olcs/core/OLImageryProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export default class OLImageryProvider implements ImageryProvider /* should not
196196

197197
this.shouldRequestNextLevel = false;
198198

199-
const proxy = this.source_.get('olcs.proxy');
199+
const proxy = this.source_.get('olcs_proxy');
200200
if (proxy) {
201201
if (typeof proxy === 'function') {
202202
// Duck typing a proxy

src/olcs/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function imageRenderingValue() {
4141
* @return The projection of the source.
4242
*/
4343
export function getSourceProjection(source: Source): Projection {
44-
return source.get('olcs.projection') as Projection || source.getProjection();
44+
return source.get('olcs_projection') as Projection || source.getProjection();
4545
}
4646

4747

0 commit comments

Comments
 (0)