From ac414ede4d3223aa9bbd047d0f5769408d8f94db Mon Sep 17 00:00:00 2001 From: Greg Date: Fri, 26 Jul 2024 11:15:04 +0200 Subject: [PATCH 1/2] Add color picker for hillshade shadow color --- .../base/src/formbuilder/formselectors.ts | 6 +++++- .../objectform/hillshadeLayerForm.ts | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts diff --git a/packages/base/src/formbuilder/formselectors.ts b/packages/base/src/formbuilder/formselectors.ts index 87ade70b..6e96150d 100644 --- a/packages/base/src/formbuilder/formselectors.ts +++ b/packages/base/src/formbuilder/formselectors.ts @@ -1,9 +1,10 @@ import { LayerType, SourceType } from '@jupytergis/schema'; import { BaseForm } from './objectform/baseform'; import { GeoJSONSourcePropertiesForm } from './objectform/geojsonsource'; +import { HillshadeLayerPropertiesForm } from './objectform/hillshadeLayerForm'; +import { LayerPropertiesForm } from './objectform/layerform'; import { TileSourcePropertiesForm } from './objectform/tilesourceform'; import { VectorLayerPropertiesForm } from './objectform/vectorlayerform'; -import { LayerPropertiesForm } from './objectform/layerform'; export function getLayerTypeForm( layerType: LayerType @@ -14,6 +15,9 @@ export function getLayerTypeForm( case 'VectorLayer': LayerForm = VectorLayerPropertiesForm; break; + case 'HillshadeLayer': + LayerForm = HillshadeLayerPropertiesForm; + break; // ADD MORE FORM TYPES HERE } diff --git a/packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts b/packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts new file mode 100644 index 00000000..08e307eb --- /dev/null +++ b/packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts @@ -0,0 +1,19 @@ +import { IDict } from '@jupytergis/schema'; +import { LayerPropertiesForm } from './layerform'; + +/** + * The form to modify a hillshade layer. + */ +export class HillshadeLayerPropertiesForm extends LayerPropertiesForm { + protected processSchema( + data: IDict | undefined, + schema: IDict, + uiSchema: IDict + ) { + super.processSchema(data, schema, uiSchema); + console.log('uiSchema', uiSchema); + uiSchema['shadowColor'] = { + 'ui:widget': 'color' + }; + } +} From 7f9d4b5ad2407b9f3cae2c39d2ed1ac71e01b451 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 26 Jul 2024 13:37:47 +0200 Subject: [PATCH 2/2] remove console.log --- packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts b/packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts index 08e307eb..871c83fe 100644 --- a/packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts +++ b/packages/base/src/formbuilder/objectform/hillshadeLayerForm.ts @@ -11,7 +11,6 @@ export class HillshadeLayerPropertiesForm extends LayerPropertiesForm { uiSchema: IDict ) { super.processSchema(data, schema, uiSchema); - console.log('uiSchema', uiSchema); uiSchema['shadowColor'] = { 'ui:widget': 'color' };