Skip to content

Commit 22f7cc8

Browse files
committed
Merge remote-tracking branch 'origin/development' into ac-fix-symlink
2 parents f053c10 + df8e02d commit 22f7cc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+30164
-18446
lines changed

API/Backend/Config/routes/configs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ function addLayer(req, res, next, cb, forceConfig, caller = "addLayer") {
694694
mission: "{mission_name}",
695695
layer: {
696696
name: "{new_layer_name}",
697-
type: "header || vector || vectortile || query || model || tile || data",
697+
type: "header || vector || vectortile || query || model || tile || data || image",
698698
"more...": "...",
699699
},
700700
"placement?": {

API/Backend/Config/validate.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ const validateLayers = (config) => {
8989
// Check model params (pos, rot, scale)
9090
errs = errs.concat(isValidModelParams(layer));
9191
break;
92+
case "image":
93+
// Check url
94+
errs = errs.concat(isValidUrl(layer));
95+
// Check zooms
96+
errs = errs.concat(isValidZooms(layer));
97+
break;
9298
default:
9399
errs = errs.concat(
94100
err(`Unknown layer type: '${layer.type}'`, ["layers[layer].type"])
@@ -316,6 +322,10 @@ const fillInMissingFieldsWithDefaults = (layer) => {
316322
layer.style = layer.style || {};
317323
layer.style.className = layer.name.replace(/ /g, "").toLowerCase();
318324
break;
325+
case "image":
326+
layer.style = layer.style || {};
327+
layer.style.className = layer.name.replace(/ /g, "").toLowerCase();
328+
break;
319329
case "model":
320330
break;
321331
default:

API/Backend/Draw/routes/draw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ const clipOver = function (
204204
historyIndex: lastHistory[0].history_id + 1,
205205
history: lastHistory[0].history,
206206
};
207-
} else return { historyIndex: 0, history: [] };
207+
} else return { historyIndex: 0, history: null };
208208
})
209209
.then((historyObj) => {
210210
let history = historyObj.history;
@@ -335,7 +335,7 @@ const clipUnder = function (
335335
historyIndex: lastHistory[0].history_id + 1,
336336
history: lastHistory[0].history,
337337
};
338-
} else return { historyIndex: 0, history: [] };
338+
} else return { historyIndex: 0, history: null };
339339
})
340340
.then((historyObj) => {
341341
let history = historyObj.history;

API/Backend/Utils/routes/utils.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,25 @@ router.post("/getbands", function (req, res) {
296296
);
297297
});
298298

299+
//utils getminmax
300+
router.post("/getminmax", function (req, res) {
301+
const path = encodeURIComponent(req.body.path);
302+
const bands = encodeURIComponent(req.body.bands);
303+
304+
execFile(
305+
"python",
306+
["private/api/gdalinfoMinMax.py", path, bands],
307+
function (error, stdout, stderr) {
308+
if (error) {
309+
logger("warn", error);
310+
res.status(400).send();
311+
} else {
312+
res.send(stdout);
313+
}
314+
}
315+
);
316+
});
317+
299318
//utils ll2aerll
300319
router.post("/ll2aerll", function (req, res) {
301320
const lng = encodeURIComponent(req.body.lng);

configuration/env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ function getClientEnvironment(publicUrl) {
109109
THIRD_PARTY_COOKIES: process.env.THIRD_PARTY_COOKIES || "",
110110
SKIP_CLIENT_INITIAL_LOGIN: process.env.SKIP_CLIENT_INITIAL_LOGIN || "",
111111
IS_DOCKER: process.env.IS_DOCKER,
112+
WITH_TITILER: process.env.WITH_TITILER,
112113
}
113114
);
114115
// Stringify all values so we can feed into webpack DefinePlugin

configuration/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ module.exports = function (webpackEnv) {
381381
// Process any JS outside of the app with Babel.
382382
// Unlike the application JS, we only compile the standard ES features.
383383
{
384-
test: /\.(js|mjs)$/,
384+
test: /\.(js|mjs|cjs)$/,
385385
exclude: /@babel(?:\/|\\{1,2})runtime/,
386386
loader: require.resolve("babel-loader"),
387387
options: {

configure/public/toolConfigs.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

configure/src/components/Tabs/Layers/Layers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import LanguageIcon from "@mui/icons-material/Language"; // Tile
2929
import GridViewIcon from "@mui/icons-material/GridView"; // Vector tile
3030
import ViewInArIcon from "@mui/icons-material/ViewInAr"; // Model
3131
import AirIcon from "@mui/icons-material/Air"; // Velocity
32+
import ImageIcon from '@mui/icons-material/Image'; // Image
3233
import AddIcon from "@mui/icons-material/Add";
3334

3435
import VisibilityIcon from "@mui/icons-material/Visibility";
@@ -386,6 +387,9 @@ export default function Layers() {
386387
case "velocity":
387388
iconType = <AirIcon fontSize="small" />;
388389
color = "#24807c";
390+
case "image":
391+
iconType = <ImageIcon fontSize="small" />;
392+
color = "#b0518f";
389393
break;
390394
default:
391395
}

configure/src/components/Tabs/Layers/Modals/LayerModal/LayerModal.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import tileConfig from "../../../../../metaconfigs/layer-tile-config.json";
4545
import vectorConfig from "../../../../../metaconfigs/layer-vector-config.json";
4646
import vectortileConfig from "../../../../../metaconfigs/layer-vectortile-config.json";
4747
import velocityConfig from "../../../../../metaconfigs/layer-velocity-config.json";
48+
import imageConfig from "../../../../../metaconfigs/layer-image-config.json";
4849

4950
const useStyles = makeStyles((theme) => ({
5051
Modal: {
@@ -196,6 +197,10 @@ const LayerModal = (props) => {
196197
config = velocityConfig;
197198
break;
198199

200+
case "image":
201+
config = imageConfig;
202+
break;
203+
199204
default:
200205
break;
201206
}

configure/src/core/Maker.js

Lines changed: 120 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ const getComponent = (
256256
}}
257257
value={value != null ? value : getIn(directConf, com.field, "")}
258258
onChange={(e) => {
259+
updateConfiguration(forceField || com.field, e.target.value, layer);
260+
}}
261+
onBlur={(e) => {
259262
let v = e.target.value;
260263
// remove surrounding whitespace, " hi " -> "hi"
261264
if (typeof v === "string") v = v.trim();
@@ -280,6 +283,39 @@ const getComponent = (
280283
)}
281284
</div>
282285
);
286+
case "textnotrim":
287+
inner = (
288+
<TextField
289+
className={c.text}
290+
label={com.name}
291+
variant="filled"
292+
size="small"
293+
inputProps={{
294+
autoComplete: "off",
295+
}}
296+
value={value != null ? value : getIn(directConf, com.field, "")}
297+
onChange={(e) => {
298+
updateConfiguration(forceField || com.field, e.target.value, layer);
299+
}}
300+
/>
301+
);
302+
return (
303+
<div>
304+
{inlineHelp ? (
305+
<>
306+
{inner}
307+
<div
308+
className={c.subtitle2}
309+
dangerouslySetInnerHTML={{ __html: com.description || "" }}
310+
></div>
311+
</>
312+
) : (
313+
<Tooltip title={com.description || ""} placement="top" arrow>
314+
{inner}
315+
</Tooltip>
316+
)}
317+
</div>
318+
);
283319
case "button":
284320
inner = (
285321
<Button
@@ -685,31 +721,96 @@ const getComponent = (
685721
</FormControl>
686722
);
687723

724+
let domain =
725+
window.mmgisglobal.NODE_ENV === "development"
726+
? "http://localhost:8888/"
727+
: window.mmgisglobal.ROOT_PATH || "";
728+
if (domain.length > 0 && !domain.endsWith("/")) domain += "/";
729+
730+
let colormap_html
731+
if (window.mmgisglobal.WITH_TITILER === "true") {
732+
// Get colors from TiTiler if it is available
733+
colormap_html = (
734+
<div style={{width: "100%"}}>
735+
<img id="titlerCogColormapImage" style={{height: "20px", width: "100%"}} src={`${domain}titiler/colorMaps/${dropdown_value.toLowerCase()}?format=png`} />
736+
</div>
737+
)
738+
} else {
739+
let colormap = dropdown_value
740+
// js-colormaps data object only contains the non reversed color so we need to track if the color is reversed
741+
let reverse = false
742+
743+
// TiTiler colormap variables are all lower case so we need to format them correctly for js-colormaps
744+
if (colormap.toLowerCase().endsWith('_r')) {
745+
colormap = colormap.substring(0, colormap.length - 2)
746+
reverse = true
747+
}
748+
749+
let index = Object.keys(colormapData).findIndex(v => {
750+
return v.toLowerCase() === colormap.toLowerCase();
751+
});
752+
753+
if (index > -1) {
754+
colormap = Object.keys(colormapData)[index]
755+
} else {
756+
console.warn(`The colormap '${colormap}' does not exist`);
757+
}
758+
759+
if (colormap in colormapData) {
760+
colormap_html = colormapData[colormap].colors.map(
761+
(hex) => {
762+
return (
763+
<div
764+
className={c.colorDropdownArrayHex}
765+
style={{ background: `rgb(${hex.map(v => {return Math.floor(v * 255)}).join(',')})` }}
766+
></div>
767+
);
768+
}
769+
)
770+
771+
if (reverse === true) {
772+
colormap_html.reverse()
773+
}
774+
} else if (colormap === 'DEFAULT') {
775+
// Default color for velocity layer
776+
const defaultColors = [
777+
'rgb(36,104, 180)',
778+
'rgb(60,157, 194)',
779+
'rgb(128,205,193 )',
780+
'rgb(151,218,168 )',
781+
'rgb(198,231,181)',
782+
'rgb(238,247,217)',
783+
'rgb(255,238,159)',
784+
'rgb(252,217,125)',
785+
'rgb(255,182,100)',
786+
'rgb(252,150,75)',
787+
'rgb(250,112,52)',
788+
'rgb(245,64,32)',
789+
'rgb(237,45,28)',
790+
'rgb(220,24,32)',
791+
'rgb(180,0,35)',
792+
]
793+
794+
colormap_html = defaultColors.map(
795+
(hex) => {
796+
return (
797+
<div
798+
className={c.colorDropdownArrayHex}
799+
style={{ background: `${hex}`}}
800+
></div>
801+
);
802+
}
803+
)
804+
}
805+
}
806+
688807
return (
689808
<div>
690809
{inlineHelp ? (
691810
<>
692811
{inner}
693812
<div className={c.textArrayHexes}>
694-
{typeof dropdown_value === "string"
695-
? colormapData[dropdown_value] &&
696-
colormapData[dropdown_value].colors
697-
? colormapData[dropdown_value].colors.map((hex) => {
698-
return (
699-
<div
700-
className={c.colorDropdownArrayHex}
701-
style={{
702-
background: `rgb(${hex
703-
.map((v) => {
704-
return Math.floor(v * 255);
705-
})
706-
.join(",")})`,
707-
}}
708-
></div>
709-
);
710-
})
711-
: null
712-
: null}
813+
{colormap_html || null}
713814
</div>
714815
<Typography className={c.subtitle2}>
715816
{com.description || ""}

0 commit comments

Comments
 (0)