|
3 | 3 | This example uses WebGL to raster tiles on a map.
|
4 | 4 |
|
5 | 5 | <script setup>
|
6 |
| -import WebglTileLayerDemo from "@demos/WebglTileLayerDemo.vue" |
| 6 | +import GeoTIFFDemo from "@demos/GeoTIFFDemo.vue" |
7 | 7 | </script>
|
8 | 8 | <ClientOnly>
|
9 |
| -<WebglTileLayerDemo /> |
| 9 | +<GeoTIFFDemo /> |
10 | 10 | </ClientOnly>
|
11 | 11 |
|
12 | 12 | ## Usage
|
13 | 13 |
|
14 | 14 | ::: code-group
|
15 | 15 |
|
16 |
| -<<< ../../../../src/demos/WebglTileLayerDemo.vue |
| 16 | +<<< ../../../../src/demos/GeoTIFFDemo.vue |
17 | 17 |
|
18 | 18 | :::
|
19 | 19 |
|
20 | 20 | ## Properties
|
21 | 21 |
|
22 |
| -### className |
| 22 | +### Props from OpenLayers |
23 | 23 |
|
24 |
| -- **Type**: `string` |
25 |
| -- **Default**: `ol-layer` |
| 24 | +Properties are passed-trough from OpenLayers directly. |
| 25 | +Their types and default values can be checked-out [in the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_layer_WebGLTile-WebGLTileLayer.html). |
| 26 | +Only some properties deviate caused by reserved keywords from Vue / HTML. |
| 27 | +This deviating props are described in the section below. |
26 | 28 |
|
27 |
| -A CSS class name to set to the layer element. |
| 29 | +### Deviating Properties |
28 | 30 |
|
29 |
| -### opacity |
| 31 | +**`visible`** |
30 | 32 |
|
31 |
| -- **Type**: `number ` |
32 |
| -- **Default**: `1` |
| 33 | +The value for `visible` is set to `true` by default. |
33 | 34 |
|
34 |
| -Opacity (0, 1). |
| 35 | +## Events |
35 | 36 |
|
36 |
| -### visible |
| 37 | +You have access to all Events from the underlying source. |
| 38 | +Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_layer_WebGLTile-WebGLTileLayer.html) to see the available events tht will be fired. |
37 | 39 |
|
38 |
| -- **Type**: `boolean` |
39 |
| -- **Default**: `true` |
| 40 | +```html |
| 41 | +<ol-webgl-tile-layer @error="handleEvent" /> |
| 42 | +``` |
40 | 43 |
|
41 |
| -Visibility. |
| 44 | +## Methods |
42 | 45 |
|
43 |
| -### extent |
| 46 | +You have access to all Methods from the underlying source. |
| 47 | +Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_layer_WebGLTile-WebGLTileLayer.html) to see the available methods. |
44 | 48 |
|
45 |
| -- **Type**: `Array` |
| 49 | +To access the source, you can use a `ref()` as shown below: |
46 | 50 |
|
47 |
| -The bounding extent for layer rendering. The layer will not be rendered outside of this extent. |
| 51 | +```vue |
| 52 | +<template> |
| 53 | + <!-- ... --> |
| 54 | + <ol-webgl-tile-layer ref="layerRef" /> |
| 55 | + <!-- ... --> |
| 56 | +</template> |
48 | 57 |
|
49 |
| -### zIndex |
| 58 | +<script setup lang="ts"> |
| 59 | +import { ref, onMounted } from "vue"; |
| 60 | +import type WebGLTileLayer from "ol/layer/WebGLTile"; |
50 | 61 |
|
51 |
| -- **Type**: `number` |
| 62 | +const layerRef = ref<{ tileLayer: WebGLTileLayer }>(null); |
52 | 63 |
|
53 |
| -The z-index for layer rendering. At rendering time, the layers will be ordered, first by Z-index and then by position. |
54 |
| - |
55 |
| -### minResolution |
56 |
| - |
57 |
| -- **Type**: `number` |
58 |
| - |
59 |
| -The minimum resolution (inclusive) at which this layer will be visible. |
60 |
| - |
61 |
| -### maxResolution |
62 |
| - |
63 |
| -- **Type**: `number` |
64 |
| - |
65 |
| -The maximum resolution (exclusive) below which this layer will be visible. |
66 |
| - |
67 |
| -### minZoom |
68 |
| - |
69 |
| -- **Type**: `number` |
70 |
| - |
71 |
| -The minimum view zoom level (exclusive) above which this layer will be visible. |
72 |
| - |
73 |
| -### maxZoom |
74 |
| - |
75 |
| -- **Type**: `number` |
76 |
| - |
77 |
| -The maximum view zoom level (inclusive) at which this layer will be visible. |
78 |
| - |
79 |
| -### preload |
80 |
| - |
81 |
| -- **Type**: `number` |
82 |
| -- **Default**: `0` |
83 |
| - Low-resolution tiles up to preload level will be load. |
| 64 | +onMounted(() => { |
| 65 | + const layer: WebGLTileLayer = sourceRef.value?.tileLayer; |
| 66 | + // call your method on `layer` |
| 67 | +}); |
| 68 | +</script> |
| 69 | +``` |
0 commit comments