Skip to content

Commit

Permalink
Modularize Map Component (#1171)
Browse files Browse the repository at this point in the history
* move/rename map component

* create new file for utility functions

* fix initial point display for lines/areas

* move drawing functions from map component
  • Loading branch information
JustinElms authored Nov 20, 2024
1 parent 80ab187 commit 1f4368c
Show file tree
Hide file tree
Showing 4 changed files with 900 additions and 834 deletions.
34 changes: 17 additions & 17 deletions oceannavigator/frontend/src/components/OceanNavigator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Modal from "react-bootstrap/Modal";
import ReactGA from "react-ga";

import { DATASET_DEFAULTS, MAP_DEFAULTS } from "./Defaults.js";
import MainMap from "./MainMap.jsx";
import Map from "./map/Map.jsx";
import MapInputs from "./MapInputs.jsx";
import MapTools from "./MapTools.jsx";
import ScaleViewer from "./ScaleViewer.jsx";
Expand Down Expand Up @@ -72,7 +72,7 @@ function OceanNavigator(props) {

useEffect(() => {
ReactGA.ga("send", "pageview");

if (window.location.search.length > 0) {
try {
const query = JSON.parse(
Expand Down Expand Up @@ -224,7 +224,7 @@ function OceanNavigator(props) {
[key]: value,
};
});
}
};

const updateDataset0 = (key, value) => {
switch (key) {
Expand Down Expand Up @@ -285,7 +285,7 @@ function OceanNavigator(props) {
const generatePermLink = (permalinkSettings) => {
let query = {};
// We have a request from Point/Line/AreaWindow component.

query.subquery = subquery;
query.showModal = uiSettings.showModal;
query.modalType = uiSettings.modalType;
Expand All @@ -294,7 +294,7 @@ function OceanNavigator(props) {
query.vectorType = vectorType;
query.vectorCoordinates = vectorCoordinates;
query.selectedCoordinates = selectedCoordinates;

// We have a request from the Permalink component.
for (let setting in permalinkSettings) {
if (permalinkSettings[setting] === true) {
Expand Down Expand Up @@ -390,18 +390,18 @@ function OceanNavigator(props) {
case "track":
modalBodyContent = (
<TrackWindow
dataset={dataset0}
track={selectedCoordinates}
names={names}
onUpdate={updateDataset0}
init={subquery}
action={action}
obs_query={vectorId}
/>
);
dataset={dataset0}
track={selectedCoordinates}
names={names}
onUpdate={updateDataset0}
init={subquery}
action={action}
obs_query={vectorId}
/>
);

modalTitle = "";
break;
modalTitle = "";
break;
case "presetFeatures":
modalBodyContent = <PresetFeaturesWindow action={action} />;
modalTitle = "Preset Features";
Expand Down Expand Up @@ -471,7 +471,7 @@ function OceanNavigator(props) {
right={true}
/>
) : null}
<MainMap
<Map
ref={mapRef}
mapSettings={mapSettings}
dataset0={dataset0}
Expand Down
Loading

0 comments on commit 1f4368c

Please sign in to comment.