Skip to content

Commit

Permalink
Adjustments after merging and wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Aug 20, 2024
1 parent e3e9afd commit 7f6d852
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export type SettingsToViewInterface = {
layerManager: LayerManager;
};

export const interfaceInitialization: InterfaceInitialization<SettingsToViewInterface> = {
export type Interfaces = {
settingsToView: SettingsToViewInterface;
};

export const settingsToViewInterfaceInitialization: InterfaceInitialization<SettingsToViewInterface> = {
layerManager: (get) => {
return get(layerManagerAtom);
},
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/modules/2DViewer/loadModule.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ModuleRegistry } from "@framework/ModuleRegistry";

import { Interfaces, settingsToViewInterfaceInitialization } from "./interfaces";
import { MODULE_NAME } from "./registerModule";
import { Settings } from "./settings/settings";
import { SettingsToViewInterface, interfaceInitialization } from "./settingsToViewInterface";
import { State } from "./state";
import { View } from "./view/view";

const module = ModuleRegistry.initModule<State, SettingsToViewInterface>(MODULE_NAME, {}, {}, interfaceInitialization);
const module = ModuleRegistry.initModule<Interfaces>(MODULE_NAME, { settingsToViewInterfaceInitialization });

module.settingsFC = Settings;
module.viewFC = View;
4 changes: 2 additions & 2 deletions frontend/src/modules/2DViewer/registerModule.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ModuleCategory, ModuleDevState } from "@framework/Module";
import { ModuleRegistry } from "@framework/ModuleRegistry";

import { State } from "./state";
import { Interfaces } from "./interfaces";

export const MODULE_NAME = "2DViewer";

ModuleRegistry.registerModule<State>({
ModuleRegistry.registerModule<Interfaces>({
moduleName: MODULE_NAME,
category: ModuleCategory.MAIN,
devState: ModuleDevState.DEV,
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/modules/2DViewer/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ import { PolygonLayerSettingsComponent } from "./components/layerSettings/polygo
import { SurfaceLayerSettingsComponent } from "./components/layerSettings/surfaceLayer";
import { WellboreLayerSettingsComponent } from "./components/layerSettings/wellboreLayer";

import { Interfaces } from "../interfaces";
import { isFaultPolygonLayer } from "../layers/FaultPolygonLayer";
import { LayerFactory } from "../layers/LayerFactory";
import { isPolygonLayer } from "../layers/PolygonLayer";
import { isSurfaceLayer } from "../layers/SurfaceLayer";
import { isWellboreLayer } from "../layers/WellboreLayer";
import { LAYER_TYPE_TO_STRING_MAPPING, LayerType } from "../layers/types";
import { SettingsToViewInterface } from "../settingsToViewInterface";
import { State } from "../state";

export function Settings(props: ModuleSettingsProps<State, SettingsToViewInterface>): React.ReactNode {
export function Settings(props: ModuleSettingsProps<Interfaces>): React.ReactNode {
const ensembleSet = useEnsembleSet(props.workbenchSession);

const selectedFieldIdentifier = useAtomValue(selectedFieldIdentifierAtom);
Expand Down
1 change: 0 additions & 1 deletion frontend/src/modules/2DViewer/state.ts

This file was deleted.

5 changes: 2 additions & 3 deletions frontend/src/modules/2DViewer/view/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ import { Axes2DLayer, MapLayer, WellsLayer } from "@webviz/subsurface-viewer/dis
import { Rgb, parse } from "culori";
import { isEqual } from "lodash";

import { Interfaces } from "../interfaces";
import { FaultPolygonLayer } from "../layers/FaultPolygonLayer";
import { PolygonLayer } from "../layers/PolygonLayer";
import { SurfaceLayer } from "../layers/SurfaceLayer";
import { WellboreLayer } from "../layers/WellboreLayer";
import { SettingsToViewInterface } from "../settingsToViewInterface";
import { State } from "../state";

export function View(props: ModuleViewProps<State, SettingsToViewInterface>): React.ReactNode {
export function View(props: ModuleViewProps<Interfaces>): React.ReactNode {
const statusWriter = useViewStatusWriter(props.viewContext);
const layerManager = props.viewContext.useSettingsToViewInterfaceValue("layerManager");
const allItems = useLayerManagerTopicValue(layerManager, LayerManagerTopic.ITEMS_CHANGED);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/modules/Intersection/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { EnsembleIdent } from "@framework/EnsembleIdent";
import { InterfaceInitialization } from "@framework/UniDirectionalModuleComponentsInterface";
import { IntersectionType } from "@framework/types/intersection";
import { ColorScale } from "@lib/utils/ColorScale";
import { LayerManager } from "@modules/_shared/layers/LayerManager";

import {
gridLayerAtom,
Expand All @@ -19,7 +20,6 @@ import {
selectedWellboreAtom,
} from "./settings/atoms/derivedAtoms";
import { WellboreHeader } from "./typesAndEnums";
import { LayerManager } from "./utils/layers/LayerManager";

export type SettingsToViewInterface = {
showGridlines: boolean;
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/modules/Intersection/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@ import { SurfacesUncertaintyLayerSettingsComponent } from "./components/layerSet
import { WellpicksLayerSettingsComponent } from "./components/layerSettings/wellpicksLayer";

import { Interfaces } from "../interfaces";
import { State } from "../state";
import { isGridLayer } from "../utils/layers/GridLayer";
import { LayerFactory } from "../utils/layers/LayerFactory";
import { isSeismicLayer } from "../utils/layers/SeismicLayer";
import { isSurfaceLayer } from "../utils/layers/SurfaceLayer";
import { isSurfacesUncertaintyLayer } from "../utils/layers/SurfacesUncertaintyLayer";
import { isWellpicksLayer } from "../utils/layers/WellpicksLayer";
import { LAYER_TYPE_TO_STRING_MAPPING, LayerType } from "../utils/layers/types";
import { ViewAtoms } from "../view/atoms/atomDefinitions";

export function Settings(props: ModuleSettingsProps<Interfaces>): JSX.Element {
const ensembleSet = useEnsembleSet(props.workbenchSession);
Expand Down
76 changes: 0 additions & 76 deletions frontend/src/modules/Intersection/settingsToViewInterface.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ import { makeSurfaceStatisticalFanchartFromRealizationSurface } from "@framework
import { IntersectionType } from "@framework/types/intersection";
import { useElementBoundingRect } from "@lib/hooks/useElementBoundingRect";
import { Interfaces } from "@modules/Intersection/interfaces";
import { BaseLayer, LayerStatus, useLayers } from "@modules/Intersection/utils/layers/BaseLayer";
import { GridLayer, isGridLayer } from "@modules/Intersection/utils/layers/GridLayer";
import { SeismicLayer, isSeismicLayer } from "@modules/Intersection/utils/layers/SeismicLayer";
import { isSurfaceLayer } from "@modules/Intersection/utils/layers/SurfaceLayer";
import { isSurfacesUncertaintyLayer } from "@modules/Intersection/utils/layers/SurfacesUncertaintyLayer";
import { isWellpicksLayer } from "@modules/Intersection/utils/layers/WellpicksLayer";
import { BaseLayer, LayerStatus, useLayers } from "@modules/_shared/layers/BaseLayer";
import { ColorLegendsContainer } from "@modules_shared/components/ColorLegendsContainer";
import { BaseLayer, LayerStatus, useLayers } from "@modules_shared/layers/BaseLayer";

import { isEqual } from "lodash";

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/modules/Intersection/view/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useEnsembleSet } from "@framework/WorkbenchSession";
import { IntersectionType } from "@framework/types/intersection";
import { CircularProgress } from "@lib/components/CircularProgress";
import { resolveClassNames } from "@lib/utils/resolveClassNames";
import { BaseLayer, LayerStatus, useLayersStatuses } from "@modules_shared/layers/BaseLayer";
import { BaseLayer, LayerStatus, useLayersStatuses } from "@modules/_shared/layers/BaseLayer";
import { LayerManagerTopic, useLayerManagerTopicValue } from "@modules_shared/layers/LayerManager";

import { useAtomValue } from "jotai";
Expand All @@ -17,7 +17,6 @@ import { LayersWrapper } from "./components/layersWrapper";
import { useWellboreCasingsQuery } from "./queries/wellboreSchematicsQueries";

import { Interfaces } from "../interfaces";
import { LayerStatus, useLayersStatuses } from "../utils/layers/BaseLayer";
import { isGridLayer } from "../utils/layers/GridLayer";
import { isSeismicLayer } from "../utils/layers/SeismicLayer";
import { isSurfaceLayer } from "../utils/layers/SurfaceLayer";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export type AddLayerDropdownProps<TLayerType extends string> = {

export function AddLayerDropdown<TLayerType extends string>(props: AddLayerDropdownProps<TLayerType>): React.ReactNode {
function handleAddLayer(type: TLayerType) {
props.parent.prependItem(props.layerFactory.makeLayer(type, props.layerManager));
const layer = props.layerFactory.makeLayer(type, props.layerManager);
layer.setQueryClient(props.layerManager.getQueryClient());
props.parent.prependItem(layer);
}

return (
Expand Down

0 comments on commit 7f6d852

Please sign in to comment.