Skip to content

Commit

Permalink
Merge branch 'main' into support-time-interval
Browse files Browse the repository at this point in the history
  • Loading branch information
mwu2018 authored Sep 14, 2023
2 parents ef506f4 + 6abb083 commit aa9fd41
Show file tree
Hide file tree
Showing 147 changed files with 1,799 additions and 2,748 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#### next release (8.3.4)

- Move map credits to map column so it don't get hidden by chart panel
- TSify `MapColumn` module and reorganize components directory structure.
- Add null check to `WebMapServiceCatalogItem` `rectangle` calculation - and now we ascend tree of WMS `Layers` until we find a rectangle.
- Add `timeWindowDuration`, `timeWindowUnit` and `isForwardTimeWindow` traits to esri-mapServer type to support time window query.
- [The next improvement]

Expand Down
4 changes: 4 additions & 0 deletions lib/Models/Catalog/Ows/WebMapServiceCapabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ export function getRectangleFromLayer(
};
}
}

// Work way through ancestors until we get a rectangle.
if (layer._parent) return getRectangleFromLayer(layer._parent);

return undefined;
}

Expand Down
16 changes: 13 additions & 3 deletions lib/Models/Catalog/Ows/WebMapServiceCapabilitiesStratum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,17 +638,27 @@ export default class WebMapServiceCapabilitiesStratum extends LoadableStratum(
(unionRectangle, layer) => {
// Convert to cesium Rectangle (so we can use Rectangle.union)
const latLonRect = getRectangleFromLayer(layer);
const ceisumRect = Rectangle.fromDegrees(

if (
!isDefined(latLonRect?.west) ||
!isDefined(latLonRect?.south) ||
!isDefined(latLonRect?.east) ||
!isDefined(latLonRect?.north)
)
return;

const cesiumRectangle = Rectangle.fromDegrees(
latLonRect?.west,
latLonRect?.south,
latLonRect?.east,
latLonRect?.north
);

if (!unionRectangle) {
return ceisumRect;
return cesiumRectangle;
}

return Rectangle.union(unionRectangle, ceisumRect);
return Rectangle.union(unionRectangle, cesiumRectangle);
},
undefined
);
Expand Down
2 changes: 1 addition & 1 deletion lib/Models/Terria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import TimeVarying from "../ModelMixins/TimeVarying";
import { HelpContentItem } from "../ReactViewModels/defaultHelpContent";
import { defaultTerms, Term } from "../ReactViewModels/defaultTerms";
import NotificationState from "../ReactViewModels/NotificationState";
import { ICredit } from "../ReactViews/Credits";
import { ICredit } from "../ReactViews/Map/BottomBar/Credits";
import { SHARE_VERSION } from "../ReactViews/Map/Panels/SharePanel/BuildShareLink";
import { shareConvertNotification } from "../ReactViews/Notification/shareConvertNotification";
import MappableTraits from "../Traits/TraitsClasses/MappableTraits";
Expand Down
4 changes: 3 additions & 1 deletion lib/ReactViewModels/MouseCoords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ export default class MouseCoords {
);
}

@action
@action.bound
toggleUseProjection() {
this.useProjection = !this.useProjection;
this.updateEvent.raiseEvent();
}

@action
updateCoordinatesFromCesium(terria: Terria, position: Cartesian2) {
if (!terria.cesium) {
return;
Expand Down Expand Up @@ -187,6 +188,7 @@ export default class MouseCoords {
}
}

@action
updateCoordinatesFromLeaflet(terria: Terria, mouseMoveEvent: MouseEvent) {
if (!terria.leaflet) {
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/ActionBar/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect } from "react";
import styled from "styled-components";
import Box from "../../Styled/Box";
import { PortalChild } from "../StandardUserInterface/Portal";
import { useViewState } from "../StandardUserInterface/ViewStateContext";
import { useViewState } from "../Context";
import { ActionBarPortalId } from "./ActionBarPortal";

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/ReactViews/BottomDock/BottomDock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import Styles from "./bottom-dock.scss";
import ChartDisclaimer from "./ChartDisclaimer";
import Timeline from "./Timeline/Timeline";

interface PropsType extends MeasureElementProps {
interface PropsType {
terria: Terria;
viewState: ViewState;
}

@observer
class BottomDock extends React.Component<PropsType> {
class BottomDock extends React.Component<PropsType & MeasureElementProps> {
refToMeasure: HTMLDivElement | null = null;

handleClick() {
Expand All @@ -25,7 +25,7 @@ class BottomDock extends React.Component<PropsType> {
});
}

componentDidUpdate(prevProps: PropsType) {
componentDidUpdate(prevProps: PropsType & MeasureElementProps) {
if (
prevProps.heightFromMeasureElementHOC !==
this.props.heightFromMeasureElementHOC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DefaultTheme, ThemeProvider } from "styled-components";
import ViewState from "../../ReactViewModels/ViewState";
import { ViewStateProvider } from "./ViewStateContext";

export default (props: {
export const ContextProviders = (props: {
viewState: ViewState;
theme: DefaultTheme | ((theme: DefaultTheme) => DefaultTheme);
children: React.ReactNode[];
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions lib/ReactViews/Context/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./ViewStateContext";
export * from "./ContextProviders";
2 changes: 0 additions & 2 deletions lib/ReactViews/Credits/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion lib/ReactViews/Custom/ExternalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AnchorHTMLAttributes, default as React } from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { useViewState } from "../StandardUserInterface/ViewStateContext";
import { useViewState } from "../Context";

const Icon = require("../../Styled/Icon").default;
const { StyledIcon } = require("../../Styled/Icon");
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/Disclaimer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Button from "../Styled/Button";
import Spacing from "../Styled/Spacing";
import Text from "../Styled/Text";
import parseCustomMarkdownToReact from "./Custom/parseCustomMarkdownToReact";
import { withViewState } from "./StandardUserInterface/ViewStateContext";
import { withViewState } from "./Context";
import FadeIn from "./Transitions/FadeIn/FadeIn";

const TopElementBox = styled(Box)`
Expand Down
5 changes: 1 addition & 4 deletions lib/ReactViews/DragDropFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import MappableMixin from "../ModelMixins/MappableMixin";
import addUserFiles from "../Models/Catalog/addUserFiles";
import { BaseModel } from "../Models/Definition/Model";
import Styles from "./drag-drop-file.scss";
import {
WithViewState,
withViewState
} from "./StandardUserInterface/ViewStateContext";
import { WithViewState, withViewState } from "./Context";
import { raiseFileDragDropEvent } from "../ViewModels/FileDragDropListener";

interface PropsType extends WithTranslation, WithViewState {}
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/DragDropNotification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PropTypes from "prop-types";
import React from "react";
import Icon from "../Styled/Icon";
import Styles from "./drag-drop-notification.scss";
import { withViewState } from "./StandardUserInterface/ViewStateContext";
import { withViewState } from "./Context";

@observer
class DragDropNotification extends React.Component {
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/ExplorerWindow/ExplorerWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { action } from "mobx";
import { observer } from "mobx-react";
import React from "react";
import ViewState from "../../ReactViewModels/ViewState";
import { useViewState } from "../StandardUserInterface/ViewStateContext";
import { useViewState } from "../Context";
import ModalPopup from "./ModalPopup";
import Tabs from "./Tabs";

Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/FeatureInfo/FeatureInfoDownload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import filterOutUndefined from "../../Core/filterOutUndefined";
import JsonValue, { JsonObject } from "../../Core/Json";
import ViewState from "../../ReactViewModels/ViewState";
import Icon from "../../Styled/Icon";
import { withViewState } from "../StandardUserInterface/ViewStateContext";
import { withViewState } from "../Context";
import Styles from "./feature-info-download.scss";

const Dropdown = require("../Generic/Dropdown");
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/FeatureInfo/FeatureInfoPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Workbench from "../../Models/Workbench";
import ViewState from "../../ReactViewModels/ViewState";
import Icon from "../../Styled/Icon";
import Loader from "../Loader";
import { withViewState } from "../StandardUserInterface/ViewStateContext";
import { withViewState } from "../Context";
import Styles from "./feature-info-panel.scss";
import FeatureInfoCatalogItem from "./FeatureInfoCatalogItem";

Expand Down
5 changes: 1 addition & 4 deletions lib/ReactViews/FeatureInfo/FeatureInfoSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ import FeatureInfoContext from "../../Models/Feature/FeatureInfoContext";
import Icon from "../../Styled/Icon";
import { FeatureInfoPanelButton as FeatureInfoPanelButtonModel } from "../../ViewModels/FeatureInfoPanel";
import parseCustomMarkdownToReact from "../Custom/parseCustomMarkdownToReact";
import {
withViewState,
WithViewState
} from "../StandardUserInterface/ViewStateContext";
import { withViewState, WithViewState } from "../Context";
import Styles from "./feature-info-section.scss";
import FeatureInfoDownload from "./FeatureInfoDownload";
import FeatureInfoPanelButton from "./FeatureInfoPanelButton";
Expand Down
5 changes: 1 addition & 4 deletions lib/ReactViews/Feedback/FeedbackForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import Text from "../../Styled/Text";
import parseCustomMarkdownToReact, {
parseCustomMarkdownToReactWithOptions
} from "../Custom/parseCustomMarkdownToReact";
import {
WithViewState,
withViewState
} from "../StandardUserInterface/ViewStateContext";
import { WithViewState, withViewState } from "../Context";
import { applyTranslationIfExists } from "./../../Language/languageHelpers";

interface IProps extends WithTranslation, WithViewState {
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactViews/HelpScreens/SatelliteHelpPrompt.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { observer } from "mobx-react";
import React from "react";
import { useTranslation } from "react-i18next";
import { useViewState } from "../StandardUserInterface/ViewStateContext";
import { useViewState } from "../Context";
import HelpPrompt from "./HelpPrompt";

export const SATELLITE_HELP_PROMPT_KEY = "satelliteGuidance";
Expand Down
32 changes: 32 additions & 0 deletions lib/ReactViews/Map/BottomBar/BottomBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { VFC } from "react";
import Box from "../../../Styled/Box";
import { useViewState } from "../../Context";
import { MapCredits } from "./Credits";
import { DistanceLegend } from "./DistanceLegend";
import { LocationBar } from "./LocationBar";
import React from "react";

export const BottomBar: VFC = () => {
const viewState = useViewState();
return (
<Box
fullWidth
justifySpaceBetween
css={`
background: linear-gradient(180deg, #000000 0%, #000000 100%);
font-size: 0.7rem;
opacity: 0.75;
`}
>
<MapCredits
hideTerriaLogo={!!viewState.terria.configParameters.hideTerriaLogo}
credits={viewState.terria.configParameters.extraCreditLinks?.slice()}
currentViewer={viewState.terria.mainViewer.currentViewer}
/>
<Box paddedHorizontally={4} gap={2}>
<LocationBar mouseCoords={viewState.terria.currentViewer.mouseCoords} />
<DistanceLegend />
</Box>
</Box>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC } from "react";
import { useTranslation } from "react-i18next";
import { ExternalLinkIcon } from "../Custom/ExternalLink";
import { ExternalLinkIcon } from "../../../Custom/ExternalLink";
import { ICredit } from "./Credit.type";
import { Spacer } from "./Spacer";

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
import styled from "styled-components";
import Box from "../../Styled/Box";
import Box from "../../../../Styled/Box";

export const CreditsContainer = styled(Box).attrs(() => ({
fullWidth: true,
styledHeight: "30px",
styledMaxHeight: "30px",
verticalCenter: true,
gap: true,
position: "absolute"
gap: true
}))`
z-index: 0;
bottom: 0;
background: linear-gradient(180deg, #000000 0%, #000000 100%);
font-size: 0.7rem;
opacity: 0.75;
a {
text-decoration: underline;
cursor: pointer;
color: ${(props) => props.theme.textLight};
display: flex;
align-items: center;
}
img {
height: 24px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import React, { FC } from "react";
import ReactDOM from "react-dom";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import Box from "../../../Styled/Box";
import { Li } from "../../../Styled/List";
import Spacing from "../../../Styled/Spacing";
import Text from "../../../Styled/Text";
import parseCustomHtmlToReact from "../../Custom/parseCustomHtmlToReact";
import CloseButton from "../../Generic/CloseButton";
import { PrefaceBox } from "../../Generic/PrefaceBox";
import Box from "../../../../../Styled/Box";
import { Li } from "../../../../../Styled/List";
import Spacing from "../../../../../Styled/Spacing";
import Text from "../../../../../Styled/Text";
import parseCustomHtmlToReact from "../../../../Custom/parseCustomHtmlToReact";
import CloseButton from "../../../../Generic/CloseButton";
import { PrefaceBox } from "../../../../Generic/PrefaceBox";

interface IDataAttributionModalProps {
closeModal: () => void;
Expand All @@ -20,7 +20,6 @@ const AttributionText = styled(Text).attrs(() => ({ medium: true }))`
a {
color: ${(props) => props.theme.textDark};
text-decoration: underline;
img {
height: 19px;
vertical-align: middle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { FC } from "react";
import CreditDisplay from "terriajs-cesium/Source/Scene/CreditDisplay";
import GlobeOrMap from "../../../Models/GlobeOrMap";
import Leaflet from "../../../Models/Leaflet";
import parseCustomHtmlToReact from "../../Custom/parseCustomHtmlToReact";
import GlobeOrMap from "../../../../Models/GlobeOrMap";
import Leaflet from "../../../../Models/Leaflet";
import parseCustomHtmlToReact from "../../../Custom/parseCustomHtmlToReact";

interface IMapCreditLogoProps {
currentViewer: GlobeOrMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { reaction } from "mobx";
import { observer } from "mobx-react";
import React, { FC, useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import GlobeOrMap from "../../../Models/GlobeOrMap";
import { ICredit } from "../Credit.type";
import { Credits } from "../Credits";
import { CreditsContainer } from "../CreditsContainer";
import { DataAttributionModal } from "../DataAttribution/DataAttributionModal";
import { Spacer } from "../Spacer";
import { TerriaLogo } from "../TerriaLogo";
import GlobeOrMap from "../../../../Models/GlobeOrMap";
import { ICredit } from "./Credit.type";
import { Credits } from "./Credits";
import { CreditsContainer } from "./CreditsContainer";
import { DataAttributionModal } from "./DataAttribution/DataAttributionModal";
import { Spacer } from "./Spacer";
import { TerriaLogo } from "./TerriaLogo";
import { MapCreditLogo } from "./MapCreditLogo";

interface IMapCreditsProps {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from "react";
import Box from "../../Styled/Box";
import Box from "../../../../Styled/Box";

const logo = require("../../../wwwroot/images/terria-watermark.svg");
const logo = require("../../../../../wwwroot/images/terria-watermark.svg");

export const TerriaLogo: FC = () => {
return (
Expand Down
2 changes: 2 additions & 0 deletions lib/ReactViews/Map/BottomBar/Credits/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { ICredit } from "./Credit.type";
export { MapCredits } from "./MapCredits";
Loading

0 comments on commit aa9fd41

Please sign in to comment.