Skip to content

Commit

Permalink
Test tiffimageryprovider upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
na9da committed Nov 21, 2024
1 parent 1217b82 commit 710ac46
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
41 changes: 37 additions & 4 deletions lib/Models/Catalog/CatalogItems/CogCatalogItem.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import i18next from "i18next";
import {
action,
computed,
makeObservable,
observable,
onBecomeObserved,
onBecomeUnobserved,
override,
runInAction
} from "mobx";
import {
GeographicTilingScheme,
WebMercatorTilingScheme
} from "terriajs-cesium";
import GeographicTilingScheme from "terriajs-cesium/Source/Core/GeographicTilingScheme";
import CesiumMath from "terriajs-cesium/Source/Core/Math";
import WebMercatorTilingScheme from "terriajs-cesium/Source/Core/WebMercatorTilingScheme";
import TileCoordinatesImageryProvider from "terriajs-cesium/Source/Scene/TileCoordinatesImageryProvider";
import type TIFFImageryProvider from "terriajs-tiff-imagery-provider";
import CatalogMemberMixin from "../../../ModelMixins/CatalogMemberMixin";
import MappableMixin, { MapItem } from "../../../ModelMixins/MappableMixin";
Expand All @@ -24,6 +25,8 @@ import StratumFromTraits from "../../Definition/StratumFromTraits";
import StratumOrder from "../../Definition/StratumOrder";
import Terria from "../../Terria";
import proxyCatalogItemUrl from "../proxyCatalogItemUrl";
import Color from "terriajs-cesium/Source/Core/Color";
import { SelectableDimensionCheckbox } from "../../SelectableDimensions/SelectableDimensions";

/**
* Loadable stratum for overriding CogCatalogItem traits
Expand Down Expand Up @@ -83,6 +86,8 @@ export default class CogCatalogItem extends MappableMixin(
) {
static readonly type = "cog";

@observable private _showGrid = true;

/**
* Private imageryProvider instance. This is set once forceLoadMapItems is
* called.
Expand Down Expand Up @@ -152,6 +157,17 @@ export default class CogCatalogItem extends MappableMixin(
}

return [
{
show: this._showGrid,
alpha: this.opacity,
imageryProvider: new TileCoordinatesImageryProvider({
tilingScheme: this._imageryProvider?.tilingScheme,
tileWidth: this._imageryProvider?.tileWidth,
tileHeight: this._imageryProvider?.tileHeight,
color: Color.YELLOW.withAlpha(0.5)
}),
clippingRectangle: this.cesiumRectangle
},
{
show: this.show,
alpha: this.opacity,
Expand Down Expand Up @@ -199,6 +215,23 @@ export default class CogCatalogItem extends MappableMixin(
})
);
}

@override
get selectableDimensions() {
const showGrid: SelectableDimensionCheckbox = {
id: "show-grid",
type: "checkbox",
options: [
{ id: "true", name: "Show tile grid" },
{ id: "false", name: "Show tile grid" }
],
selectedId: this._showGrid ? "true" : "false",
setDimensionValue: action((_, value) => {
this._showGrid = value === "true";
})
};
return [showGrid, ...super.selectableDimensions];
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
"terriajs-cesium": "8.0.1",
"terriajs-cesium-widgets": "5.0.0",
"terriajs-html2canvas": "1.0.0-alpha.12-terriajs-1",
"terriajs-tiff-imagery-provider": "2.13.3",
"terriajs-tiff-imagery-provider": "2.15.2",
"thredds-catalog-crawler": "0.0.7",
"ts-essentials": "^5.0.0",
"ts-loader": "^5.3.3",
Expand Down

0 comments on commit 710ac46

Please sign in to comment.