/** * A note on the structure of the state: * For anyone familiar with Redux this state structure should raise some warnings, with the main concern being that * the state doesn't contain the whole state of the application. Meaning that you can't derive the exact data of the * application in a random time with just the data saved on the state. * * While this is a non-op for Redux, it is more than desired in this specific application. Rules are to be broken. * This app holds a lot of data in each moment, like 1+ GB A LOT, and refresh picks at more than 60 fps. Having an * immutable state of that size and changing with that rate will most likely mean that our app wouldn't even handle * booting up on a high-range computer. * * The purpose of this state -and thus the Redux workload- is to keep all the simple user toggled (or related) data, * that are small in size and don't change that often. That's the reason that you will find components with logic in * them and complex states that are not visible from this state here and doesn't have corresponding actions. */ import { Cartesian2, Entity } from 'cesium'; import { BaseLayerNames } from '../BaseLayerSelector/baseLayers'; import { userModel } from '../ModellingTool/ModellingData'; import { HintType } from './actions/PointSelectionActions'; import { AnalyticsFilter, AnalyticsType, BuildingsConfig } from './BuildingConfig'; import { LayerInfo } from './InfoTypes'; import { ViewCorridorsState } from './ViewCorridorTypes'; export type Transparency = 0 | 25 | 50 | 75 | 100; export interface TransparencyLayer { transparency: 0 | 25 | 50 | 75 | 100; showing: boolean; } export interface OrthoLayer extends TransparencyLayer { year?: number; } export declare enum Layers2D { showAdministrationUnits = "showAdministrationUnits", showBridges = "showBridges", showCadastres = "showCadastres", showPlanningArea = "showPlanningArea", showRadon = "showRadon", showGeology = "showGeology", showKPO = "showKPO", showKPOAdmin = "showKPOAdmin", showKPOEnvironment = "showKPOEnvironment", showKPOTechno = "showKPOTechno", showRoads = "showRoads", showTraps = "showTraps", showTrafficRoads = "showTrafficRoads", showNoiseWalls = "showNoiseWalls", showBusStops = "showBusStops", showExits = "showExits", showCrossings = "showCrossings", showHydrants = "showHydrants", showWaterSources = "showWaterSources", showTileSquares = "showTileSquares", showCulturalMonuments = "showCulturalMonuments", showCulturalMonumentsArea = "showCulturalMonumentsArea", showHeritageObjects = "showHeritageObjects", showHeritageObjectsArea = "showHeritageObjectsArea", showReservationCategories = "showReservationCategories" } export type Layers2DSubState = { [key in Layers2D]: TransparencyLayer; }; export type Layers2DState = { layers: Layers2DSubState; allowLoading: boolean; }; interface VegetationLayer { showing: boolean; showDetailed: boolean; } export interface ExcludedEhrCodes { lod1: string[]; lod2: string[]; } export interface Layers3DState { showAirzone: TransparencyLayer; showBuildingArea: TransparencyLayer; showVegetation: VegetationLayer; showTerrain: boolean; showLOD1: TransparencyLayer; showLOD2: TransparencyLayer; showLOD3: boolean; showRoadsETAK: boolean; showOldTown: boolean; showFloodMap10: TransparencyLayer; showFloodMap50: TransparencyLayer; showFloodMap100: TransparencyLayer; showFloodMap1000: TransparencyLayer; showRiskAreas: TransparencyLayer; showUtilities: boolean; showColorHeights: boolean; showAnalytics: AnalyticsType; analyticsFilter: AnalyticsFilter; showColorByUsage: boolean; showLabels: boolean; showShadows: boolean; shadowsCanShow: boolean; showTrees: boolean; showForests: boolean; buildingsConfig: BuildingsConfig; excludedEhrCodes: ExcludedEhrCodes; transparencyExp: Transparency; loadedEhrCode: string | undefined; } export interface OrthoPhotoState { showOrthoPhoto: OrthoLayer; loadedSettlements: string[]; } export type LayersKeys = keyof Layers2DSubState | keyof Layers3DState | keyof ViewCorridorsState; export interface FunctionalitiesState { showDistanceMeasurement: boolean; showMeasurement3D: boolean; showDownloadBox: boolean; showFacets: boolean; } export interface LocationState { coords: [number, number]; isShowing: boolean; } export interface BaseState { showOnBoarding: boolean; toggleDetailedTallinn: boolean; transparencyCanShow: boolean; showFirstPersonView: boolean; showCustomAlpha: boolean; baseLayer: { transparency: boolean; layerName: BaseLayerNames; }; cameraOrientationChanged: boolean; linkGenerators: { bimShare: (ehrCode: string) => string; buildingCode: (ehrCode: string) => string; modelShare: (id: string) => string; }; urls: { readonly APP: string; readonly APP_1: string; readonly APP_2: string; readonly APP_3: string; readonly APP_4: string; readonly APP_ENDING: string; readonly GEOPORTAL: string; readonly MAAMET: string; readonly MAAMET_MAP: string; readonly MAAMET_TILES: string; readonly MAAMET_XGIS: string; readonly MAAMET_KATASTER: string; readonly KINNISTUSRAAMAT: string; readonly GSAVALIK: string; readonly TALLINN: string; readonly PLANK: string; readonly DOCUMENT_SERVICE_ENDPOINT: string; readonly CLASSIFIER_SERVICE_ENDPOINT: string; readonly S3: string; }; authenticated: boolean; token: string | undefined; fpCameraTarget: { lon: number; lat: number; direction: number; minv: number; } | undefined; } export interface BaseStateOptional { showOnBoarding?: boolean; transparencyCanShow?: boolean; linkGenerators: { bimShare: (ehrCode: string) => string; buildingCode: (ehrCode: string) => string; modelShare: (id: string) => string; }; urls: { APP: string; APP_1: string; APP_2: string; APP_3: string; APP_4: string; APP_ENDING: string; GEOPORTAL: string; MAAMET: string; MAAMET_MAP: string; MAAMET_TILES: string; MAAMET_XGIS: string; MAAMET_KATASTER: string; KINNISTUSRAAMAT: string; GSAVALIK: string; TALLINN: string; PLANK: string; DOCUMENT_SERVICE_ENDPOINT: string; CLASSIFIER_SERVICE_ENDPOINT: string; S3: string; }; } export interface BoundingBox { lowerCorner: [number, number]; upperCorner: [number, number]; } export interface BoxEntity { box: Entity; smallBoxes: Array; heightBox: Entity; angle: number; } export interface CylinderEntity { cylinder: Entity; radiusBox: Entity; heightBox: Entity; } export interface PolygonEntity { polygon: Entity; smallBoxes: Array; heightBox: Entity; } export interface RoofEntity { polygon: Entity; smallBoxes: Array; heightBox: Entity; } export interface ModellingToolState { isShowing: boolean; measuresShowing: boolean; nameShowing: boolean; modelInfoOn: boolean; nameValue: string; boxes: BoxEntity[]; cylinders: CylinderEntity[]; polygons: PolygonEntity[]; roofs: RoofEntity[]; drawPolygonBoxes: Entity[]; deleteMode: boolean; drawPolygonMode: boolean; userModellings: Modelling[]; sharedModellings: Modelling[]; sharedModellingCodes: string[]; editModel: Modelling | undefined; mainColor: string; mainTransparency: number; selectedModel: BoxEntity | CylinderEntity | PolygonEntity | undefined; } export interface PointSelectionState { position: Cartesian2 | undefined; id: string | undefined; hilightId: string | undefined; kyId: string | undefined; hint?: HintType | undefined; info: LayerInfo | undefined; isLoading: boolean; } export interface Modelling { id: string; nimi: string; model: userModel; isVisible?: boolean; } export interface CustomFile { code: string; name: string; isVisible: boolean; urls: string[]; ehrCode: ExcludedEhrCodes | undefined; } export interface EditableCustomFile extends CustomFile { isDeleting: boolean; } export interface ToggleableAlert { code: string; errorCode: number; name: string; isVisible: boolean; message?: string; } export interface ThirdPartyLayer { id: number; name: string; bbox: string; url: string; layer: string; type: string; apikey: number; jwt: number; visible: boolean; alpha: number; } export interface ThirdParty { id: number; name: string; homepage: string; api: string; layers: ThirdPartyLayer[]; } export interface TehnoSoojusA { code: string; value: string; description: string; api: string; additionalDescription: string; validToDate: string; additionalValue: string; orderNumber: string; } export interface ThirdPartyServicesState { thirdParties: ThirdParty[]; layerToFly: number[] | undefined; } export interface CustomBuildingsState { userFiles: { files: EditableCustomFile[]; filesProcessing: ToggleableAlert[]; filesFailed: ToggleableAlert[]; filesSucceeded: ToggleableAlert[]; }; flyToFile: string | undefined; sharedFiles: CustomFile[]; sharedCodes: string[]; } export interface UiState { layersPanelOpen: boolean; basePanelOpen: boolean; isLoading: boolean; depthTest: boolean; containerTooSmall: boolean; infoModalMinimised: boolean; } export interface UiStateOptional { layersPanelOpen?: boolean; basePanelOpen?: boolean; isLoading?: boolean; depthTest?: boolean; } export interface State { base: BaseState; customBuildingController: CustomBuildingsState; thirdPartyLayersController: ThirdPartyServicesState; functionalities: FunctionalitiesState; layers2D: Layers2DState; layers3D: Layers3DState; location: LocationState; pointSelection: PointSelectionState; modellingToolController: ModellingToolState; ui: UiState; viewCorridors: ViewCorridorsState; orthoPhoto: OrthoPhotoState; } export {};