Skip to content

Commit 350b92d

Browse files
jacmendtPouriaRezz
andauthored
Development 20231215 (#45)
* Add PR template * Update pull_request_template.md * Improve cursor on thumbnail in upload enhancement issue #245 (#246) * edit cursor on thumbnail in upload view issue#245 * Improve cursor behavior --------- Co-authored-by: Jacob Mendt <jacob.mendt@pikobytes.de> * increase the amount of max features that be shown in unreferenzierte-karten to 500 (#248) * serialize the geojson is corrected dataProjection is writed to EPSG:4326 issue #242 (#250) * overflow issue whtin geojson view if the string long is, is corrected issue #240 (#251) * Fix GeoJSON Layer Addition on Enter Key issue #241 (#249) * Fix GeoJSON Layer Addition on Enter Key issue #241 * small enhancement - automatical set the focus on the input field if the add geojson dialog opens * add comment * Add documentation for Dikusa project (#253) * add documentation for Dikusa * add document for Dikusa project * Add loading feedback to upload client enhancement issue #243 (#247) * add loading snipper for save button in upload view issue#243 * delete unnecessary inputs * spinner wobbling corrected close issue 243 * Improve font-size of loading animation --------- Co-authored-by: Jacob Mendt <jacob.mendt@pikobytes.de> * correct the metadata-container style when the text long is (#255) * correct style of metadata-container in layermanagament-record #issue 254 * Remove maxZoom value from XYZ --------- Co-authored-by: Jacob Mendt <jacob.mendt@pikobytes.de> * Correct the Serialize and Deserialize Geojson (#259) * correct the deserilize and serialize geojson function * complete the geojson struktur documentation and add CRS section #issue-258 * proper width and min width for original view for mosaic maps (#260) * Upgrade the bundle files * fetch the max zoom level form Tile map source (#262) * Correct geojson documentation (#264) * correct the deserilize and serialize geojson function * complete the geojson struktur documentation and add CRS section #issue-258 * fine correction of geojsonStylingSpecification.md * fine correction of geojsonStylingSpecification.md * fine correction of geojsonStylingSpecification.md * fine correction * set the predefind propertiy keys to lower case * set the predefind propertiy keys to lower case * GeoJson Style Marker Value should not be case sensitive (#265) * change the marker value to lower case close issue #263 * Fix bug --------- Co-authored-by: Jacob Mendt <jacob.mendt@pikobytes.de> * getting lastmodified date from file corrected close issue#257 (#266) * Update build files --------- Co-authored-by: Pouria Rezaei <129738734+PouriaRezz@users.noreply.github.com>
1 parent 98524bd commit 350b92d

File tree

28 files changed

+544
-397
lines changed

28 files changed

+544
-397
lines changed

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Please insert here a basic description of the content of the PR
2+
3+
### Changes
4+
* Changes as a list of points
5+
6+
### Issue
7+
* Reference the issue by ID

Build/src/apps/map/components/CustomLayers/HistoricMapLayer.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,7 @@ export const HistoricMap = function (settings) {
5858
const source =
5959
settings.tms_urls !== undefined
6060
? new XYZ({
61-
maxZoom:
62-
settings.scale === 0
63-
? 15
64-
: settings.scale <= 5000
65-
? 17
66-
: settings.scale <= 15000
67-
? 16
68-
: 15,
61+
maxZoom: settings.maxZoom,
6962
urls: settings.tms_urls.map(
7063
(url) => `${url}/{z}/{x}/{-y}.png`
7164
),

Build/src/apps/map/components/Dropzone/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const parseGeoJsonFile = (file, callback, errorCallback) => {
1111
try {
1212
callback({
1313
content: JSON.parse(this.result),
14-
modified: file.lastModifiedDate,
14+
modified: file.lastModified,
1515
name: file.name.split(".")[0],
1616
});
1717
} catch (e) {

Build/src/apps/map/components/GeoJsonEditPopUp/util/geojsonParser.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
import { styleFieldSettings } from "../../../views/GeoJsonView/settings.js";
88
import { parseColorStringToHex } from "./util";
99

10+
function isPrimitiveString(value) {
11+
return typeof value === "string" && value.constructor === String;
12+
}
13+
1014
/**
1115
* Apply styling represented in geojson (as used by geojson.io) to a supplied feature
1216
* @param feature
@@ -28,6 +32,8 @@ export const parseGeojsonStyles = (feature) => {
2832
feature,
2933
type === "color"
3034
? parseColorStringToHex(properties[setting])
35+
: isPrimitiveString(properties[setting])
36+
? properties[setting].toLowerCase()
3137
: properties[setting]
3238
);
3339

@@ -44,7 +50,8 @@ export const parseGeojsonStyles = (feature) => {
4450
*/
4551
export const parseDate = (date) => {
4652
// format time based on localization
53+
const formattedDate = new Date(date);
4754
const isEnglish = window.location.pathname.includes("/en/");
4855
const options = { year: "numeric", month: "long", day: "numeric" };
49-
return date.toLocaleString(isEnglish ? "en-US" : "de-DE", options);
56+
return formattedDate.toLocaleString(isEnglish ? "en-US" : "de-DE", options);
5057
};

Build/src/apps/map/components/GeoJsonEditPopUp/util/geojsonSerializer.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,17 @@ import { parseGeojsonStyles } from "./geojsonParser";
1414
/**
1515
* Deserializes a geojson object to an openlayers feature object
1616
* @param featureObject
17-
* @param dataProjection
18-
* @param featureProjection
1917
* @return {*}
2018
*/
21-
export const deserializeGeojson = (
22-
featureObject,
23-
{ dataProjection, featureProjection } = {}
24-
) => {
19+
export const deserializeGeojson = (featureObject) => {
2520
const defaultMapView = SettingsProvider.getDefaultMapView();
2621

2722
const features = new GeoJSON().readFeatures(featureObject, {
28-
dataProjection: dataProjection ?? defaultMapView.projection,
29-
featureProjection: featureProjection ?? defaultMapView.projection,
23+
featureProjection: defaultMapView.projection,
3024
});
31-
3225
features.forEach((f) => {
33-
// set default styles for feature
3426
f.setStyle(defaultStyleFunction(f));
3527

36-
// add in styling information stored ad the feature
3728
parseGeojsonStyles(f);
3829
});
3930

@@ -54,7 +45,7 @@ export const serializeGeojson = (features) => {
5445
});
5546

5647
return new GeoJSON().writeFeaturesObject(features, {
57-
dataProjection: defaultMapView.projection,
48+
featureProjection: defaultMapView.projection,
5849
});
5950
};
6051

Build/src/apps/map/components/GeoJsonPresentationPopUp/GeoJsonPresentationPopUp.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@
9797
font-weight: 600;
9898
line-height: normal;
9999
padding-bottom: 8px;
100+
word-wrap: break-word;
101+
100102
}
101103
p {
102104
margin: 0;
105+
word-wrap: break-word;
106+
103107
}
104108

105109
display: flex;

Build/src/apps/map/components/LayerManagement/GeoJsonUploadHint/GeoJsonUploadHint.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export const GeoJsonUploadHint = ({ onAddGeoJson }) => {
4141
if (refFileInput.current !== undefined && refFileInput.current !== null) {
4242
handleCloseMenu();
4343
refFileInput.current.click();
44+
// Prevents the dialog from reopening when Enter is pressed by removing focus from the "Add GeoJSON" button.
45+
document.activeElement.blur();
4446
}
4547
};
4648

@@ -76,7 +78,9 @@ export const GeoJsonUploadHint = ({ onAddGeoJson }) => {
7678
</span>
7779
</button>
7880
<div className="upload-info">{translate("geojson-adddialog-body")}</div>
79-
<label className="visually-hidden" htmlFor="geojson-upload-file">GeoJSON Upload</label>
81+
<label className="visually-hidden" htmlFor="geojson-upload-file">
82+
GeoJSON Upload
83+
</label>
8084
<input
8185
id="geojson-upload-file"
8286
accept="application/json, application/geo+json, .geojson"

Build/src/apps/map/components/LayerManagement/LayerManagementEntry/LayerManagementEntry.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ ul.layermanagement-body {
116116
margin: 0;
117117
line-height: 1.2;
118118
color: $secondary-color-dark;
119+
word-break: break-word;
119120
hyphens: auto;
120121
}
121122
}

Build/src/apps/map/components/MapWrapper/MapWrapperWithGeojsonSupport.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ export const MapWrapperWithGeojsonSupport = ({ mapWrapperProps }) => {
3535
///
3636

3737
// read geojson and add in supplied information
38-
const handleAddGeoJson = (title, dataProjection) => {
38+
const handleAddGeoJson = (title) => {
3939
try {
40-
const features = deserializeGeojson(refGeoJSON.current.content, {
41-
dataProjection,
42-
});
40+
const features = deserializeGeojson(refGeoJSON.current.content);
4341

4442
const existingFeaturesWithId = selectedFeatures.filter((selFeature) =>
4543
selFeature.feature.getId().startsWith(title)

Build/src/apps/map/components/MapWrapper/components/DialogAddGeoJson/DialogAddGeoJson.jsx

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
* file 'LICENSE.txt', which is part of this source code package.
66
*/
77
import React, { useRef } from "react";
8-
import { Modal, Button } from "react-bootstrap";
8+
import {
9+
Modal,
10+
Button,
11+
ModalHeader,
12+
ModalTitle,
13+
ModalBody,
14+
ModalFooter,
15+
} from "react-bootstrap";
916
import PropTypes from "prop-types";
1017
import { ControlLabel, FormGroup, FormControl } from "react-bootstrap";
1118

@@ -24,7 +31,7 @@ export const DialogAddGeoJson = ({ initialName, onClose, onSubmit }) => {
2431
? refTitleInput.current.value
2532
: undefined;
2633

27-
onSubmit(title, "EPSG:4326");
34+
onSubmit(title);
2835
};
2936

3037
return (
@@ -34,36 +41,44 @@ export const DialogAddGeoJson = ({ initialName, onClose, onSubmit }) => {
3441
onHide={handleOnClose}
3542
show={true}
3643
>
37-
<Modal.Header>
38-
<Modal.Title>{translate("geojson-adddialog-title")}</Modal.Title>
39-
</Modal.Header>
44+
<ModalHeader>
45+
<ModalTitle>{translate("geojson-adddialog-title")}</ModalTitle>
46+
</ModalHeader>
4047

41-
<Modal.Body>
48+
<ModalBody>
4249
<div className="dialog-content">
4350
<form>
4451
<FormGroup>
4552
<ControlLabel>
4653
{translate("geojson-adddialog-layer-title-label")}
4754
</ControlLabel>
4855
<FormControl
56+
autoFocus
4957
defaultValue={initialName ?? "Unknown"}
50-
inputRef={refTitleInput}
58+
inputRef={(ref) => {
59+
refTitleInput.current = ref;
60+
}}
5161
name="title"
5262
type="text"
63+
onKeyDown={(e) => {
64+
if (e.key === "Enter") {
65+
handleOnSubmit();
66+
}
67+
}}
5368
/>
5469
</FormGroup>
5570
</form>
5671
</div>
57-
</Modal.Body>
72+
</ModalBody>
5873

59-
<Modal.Footer>
74+
<ModalFooter>
6075
<Button onClick={handleOnClose}>
6176
{translate("geojson-adddialog-cancel")}
6277
</Button>
6378
<Button onClick={handleOnSubmit} bsStyle="primary">
6479
{translate("geojson-adddialog-confirm")}
6580
</Button>
66-
</Modal.Footer>
81+
</ModalFooter>
6782
</Modal>
6883
</div>
6984
);

0 commit comments

Comments
 (0)