Add support for auto conversion to RGB
This commit is contained in:
@@ -3,7 +3,7 @@ import TileState from '../../../../../src/ol/TileState.js';
|
||||
|
||||
describe('ol/source/GeoTIFF', function () {
|
||||
describe('constructor', function () {
|
||||
it('configures readMethod_ to read rasters', function () {
|
||||
it('sets convertToRGB false by default', function () {
|
||||
const source = new GeoTIFFSource({
|
||||
sources: [
|
||||
{
|
||||
@@ -11,10 +11,10 @@ describe('ol/source/GeoTIFF', function () {
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(source.readMethod_).to.be('readRasters');
|
||||
expect(source.convertToRGB_).to.be(false);
|
||||
});
|
||||
|
||||
it('configures readMethod_ to read RGB', function () {
|
||||
it('respects the convertToRGB option', function () {
|
||||
const source = new GeoTIFFSource({
|
||||
convertToRGB: true,
|
||||
sources: [
|
||||
@@ -23,7 +23,19 @@ describe('ol/source/GeoTIFF', function () {
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(source.readMethod_).to.be('readRGB');
|
||||
expect(source.convertToRGB_).to.be(true);
|
||||
});
|
||||
|
||||
it('accepts auto convertToRGB', function () {
|
||||
const source = new GeoTIFFSource({
|
||||
convertToRGB: 'auto',
|
||||
sources: [
|
||||
{
|
||||
url: 'spec/ol/source/images/0-0-0.tif',
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(source.convertToRGB_).to.be('auto');
|
||||
});
|
||||
|
||||
it('defaults to wrapX: false', function () {
|
||||
|
||||
BIN
test/rendering/cases/cog-rgb-auto/expected.png
Normal file
BIN
test/rendering/cases/cog-rgb-auto/expected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
22
test/rendering/cases/cog-rgb-auto/main.js
Normal file
22
test/rendering/cases/cog-rgb-auto/main.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import GeoTIFF from '../../../../src/ol/source/GeoTIFF.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import TileLayer from '../../../../src/ol/layer/WebGLTile.js';
|
||||
|
||||
const source = new GeoTIFF({
|
||||
convertToRGB: 'auto',
|
||||
sources: [{url: '/data/raster/masked.tif'}],
|
||||
});
|
||||
|
||||
new Map({
|
||||
layers: [
|
||||
new TileLayer({
|
||||
source: source,
|
||||
}),
|
||||
],
|
||||
target: 'map',
|
||||
view: source.getView(),
|
||||
});
|
||||
|
||||
render({
|
||||
message: 'automatically converts to rgb',
|
||||
});
|
||||
BIN
test/rendering/cases/cog-rgb-no-auto/expected.png
Normal file
BIN
test/rendering/cases/cog-rgb-no-auto/expected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
22
test/rendering/cases/cog-rgb-no-auto/main.js
Normal file
22
test/rendering/cases/cog-rgb-no-auto/main.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import GeoTIFF from '../../../../src/ol/source/GeoTIFF.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import TileLayer from '../../../../src/ol/layer/WebGLTile.js';
|
||||
|
||||
const source = new GeoTIFF({
|
||||
convertToRGB: false,
|
||||
sources: [{url: '/data/raster/masked.tif'}],
|
||||
});
|
||||
|
||||
new Map({
|
||||
layers: [
|
||||
new TileLayer({
|
||||
source: source,
|
||||
}),
|
||||
],
|
||||
target: 'map',
|
||||
view: source.getView(),
|
||||
});
|
||||
|
||||
render({
|
||||
message: 'can be overridden to read raw YCbCr',
|
||||
});
|
||||
Reference in New Issue
Block a user