Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different colors for actual use polygons + code comments #397

Merged
merged 44 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
12ac970
Fixed the styling of polygons
Corgam Jul 7, 2024
b1d1df8
Changed the location data output
Corgam Jul 10, 2024
b8e2674
Merge branch 'sprint-release' into dev-eb
Corgam Jul 10, 2024
3955c55
Fixed FE issues after chaning location response
Corgam Jul 10, 2024
36e49b6
Added random ID for rows
Corgam Jul 10, 2024
81d8fe4
Reimplemented 3D view
Corgam Jul 10, 2024
e869936
Fixed closing issues
Corgam Jul 10, 2024
0970781
Added fake zoom buttons for 3D
Corgam Jul 10, 2024
b49c30d
Fixed resizing of 3D view
Corgam Jul 10, 2024
7e5d1d3
3D component cleanup
Corgam Jul 10, 2024
df4749d
Cleanup
Corgam Jul 10, 2024
f5feffa
Final 3D cleanup
Corgam Jul 10, 2024
e20bf7b
Disabling draw polygon in 3D
Corgam Jul 10, 2024
fca2053
Fixed search bar bug
Corgam Jul 10, 2024
f35e607
Map type now stays on tab switch
Corgam Jul 10, 2024
600b996
Fixed polygon reseting on tab switch
Corgam Jul 10, 2024
efd01a1
Fixed padding issues
Corgam Jul 10, 2024
501f855
Started working on the multi row data view
Corgam Jul 10, 2024
e190728
Added fly to button
Corgam Jul 11, 2024
c40ce24
Fixed some fly to bugs
Corgam Jul 11, 2024
06b87af
Optimized datasets fetching
Corgam Jul 12, 2024
62ad4da
Final data view styling
Corgam Jul 12, 2024
319f1f8
Fixed fly to with tabs that are already opened
Corgam Jul 12, 2024
4c6e5e9
Reverted mock data
Corgam Jul 12, 2024
831778a
Merge branch 'sprint-release' into dev-eb
Corgam Jul 12, 2024
8c3c3ec
Added basic polygon coloring
Corgam Jul 12, 2024
ee30de4
Moved the coloring to the backend
Corgam Jul 12, 2024
a0b82be
Merge branch 'sprint-release' into dev-eb2
Corgam Jul 12, 2024
0efe74f
Sending the usage type from BE to FE
Corgam Jul 12, 2024
35fb847
Fixed issue with datatype
Corgam Jul 12, 2024
923c779
Merge branch 'sprint-release' into dev-eb2
Corgam Jul 12, 2024
0958d22
Merge branch 'sprint-release' into dev-eb
Corgam Jul 12, 2024
1738f3c
Merge branch 'sprint-release' into dev-eb2
Corgam Jul 12, 2024
4f6e610
Merge branch 'dev-eb' into dev-eb2
Corgam Jul 12, 2024
53f04de
Reverted BE changes
Corgam Jul 12, 2024
664868b
Changed actual use threshold
Corgam Jul 12, 2024
2503ef9
Merge branch 'sprint-release' into dev-eb2
Corgam Jul 12, 2024
9628834
Improved coloring of polygons in the BE
Corgam Jul 12, 2024
878ce71
Added all colors
Corgam Jul 12, 2024
82bd2cd
Merge branch 'sprint-release' into dev-eb2
Corgam Jul 12, 2024
cfcd2bd
Changed polygon colors
Corgam Jul 12, 2024
6c489d6
Added some comments for data types
Corgam Jul 12, 2024
c678e86
Added a lot of code comments
Corgam Jul 12, 2024
75c00d0
Added one more color to the polygons
Corgam Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion backend/lib/BieMetadata/MetadataObject.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
// ReSharper disable InconsistentNaming

namespace BieMetadata;

Expand Down Expand Up @@ -75,6 +74,12 @@ public class AdditionalData
/// Table data populated by the data pipeline. Contains the name and the size of the all .yaml files correlated to that specific dataset.
/// </summary>
public List<TableData> Tables { get; set; } = new List<TableData>();

/// <summary>
/// A polygon coloring rule for different values.
/// </summary>
[BsonIgnoreIfNull] // Add this attribute to ignore null values
public PolygonColoring? PolygonColoring { get; set; }
}

/// <summary>
Expand Down Expand Up @@ -113,4 +118,19 @@ public class DisplayProperty
// The value to show
public string value { get; set; } = string.Empty;
}

/// <summary>
/// Polygon coloring rules
/// </summary>
public class PolygonColoring
{
public string attributeName { get; set; } = string.Empty;
public List<PolygonColor> colors { get; set; } = new List<PolygonColor>();
}

public class PolygonColor
{
public string color { get; set; } = string.Empty;
public List<string> values { get; set; } = new List<string>();
}
}
59 changes: 55 additions & 4 deletions backend/metadata-database/init-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const datasets = [
MinZoomLevel: -1,
MarkersThreshold: -1,
DisplayProperty: [],
PolygonColoring: null,
Tables: [],
},
},
Expand All @@ -46,7 +47,8 @@ const datasets = [
LongDescription: `A map of EV charging stations displays the locations of electric vehicle charging points located in Germany, helping drivers plan routes and manage charging needs. It is essential for supporting the adoption and convenience of electric vehicles.`,
MinZoomLevel: 11,
MarkersThreshold: -1,
DisplayProperty: [{ displayName: "Operator", value: "text" }],
DisplayProperty: [{ displayName: "Operator", value: "operator" }],
PolygonColoring: null,
Tables: [],
},
},
Expand All @@ -65,6 +67,7 @@ const datasets = [
MinZoomLevel: 11,
MarkersThreshold: 17,
DisplayProperty: [],
PolygonColoring: null,
Tables: [],
},
},
Expand All @@ -81,8 +84,55 @@ const datasets = [
DataType: "SHAPE",
LongDescription: `The Actual Use map describes the use of the earth's surface in four main groups (settlement, traffic, vegetation and water bodies). The division of these main groups into almost 140 different types of use, such as residential areas, road traffic, agriculture or flowing water, enables detailed evaluations and analyses of the use of the earth's surface.`,
MinZoomLevel: 11,
MarkersThreshold: 17,
MarkersThreshold: 15,
DisplayProperty: [],
PolygonColoring: {
attributeName: "nutzart",
colors: [
{
color: "DarkOrchid",
values: [
"Wohnbaufläche",
"Industrie- und Gewerbefläche",
"Halde",
"Bergbaubetrieb",
"Tagebau, Grube Steinbruch",
"Fläche gemischter Nutzung",
"Fläche besonderer funktionaler Prägung",
"Sport-, Freizeit- und Erholungsfläche",
"Friedhof",
],
},
{
color: "green",
values: ["Wald", "Gehölz", "Sumpf"],
},
{
color: "yellow",
values: [
"Landwirtschaft",
"Heide",
"Moor",
"Unland/Vegetationslose Fläche",
],
},
{
color: "RosyBrown",
values: [
"Straßenverkehr",
"Weg",
"Platz",
"Bahnverkehr",
"Flugverkehr",
"Schiffsverkehr",
],
},
{
color: "Cyan",
values: ["Fließgewässer", "Hafenbecken", "Stehendes Gewässer"],
},
],
},
Tables: [],
},
},
Expand All @@ -91,15 +141,16 @@ const datasets = [
DatasetId: "building_models",
Name: "Building Models",
ShortDescription: `Simplified 3D building models.`,
Icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M136.83,220.43a8,8,0,0,1-11.09,2.23A183.15,183.15,0,0,0,24,192a8,8,0,0,1,0-16,199.11,199.11,0,0,1,110.6,33.34A8,8,0,0,1,136.83,220.43ZM24,144a8,8,0,0,0,0,16,214.81,214.81,0,0,1,151.17,61.71,8,8,0,1,0,11.2-11.42A230.69,230.69,0,0,0,24,144Zm208,16a216.51,216.51,0,0,0-48.59,5.49q8.24,6.25,16,13.16A201.53,201.53,0,0,1,232,176a8,8,0,0,1,0,16c-6,0-11.93.29-17.85.86q8.32,8.67,15.94,18.14a8,8,0,1,1-12.48,10A247,247,0,0,0,24,128a8,8,0,0,1,0-16,266.33,266.33,0,0,1,48,4.37V80a8,8,0,0,1,3.2-6.4l64-48a8,8,0,0,1,9.6,0l64,48A8,8,0,0,1,216,80v32.49c5.31-.31,10.64-.49,16-.49a8,8,0,0,1,0,16,246.3,246.3,0,0,0-84.26,14.69q9.44,5,18.46,10.78A232.2,232.2,0,0,1,232,144a8,8,0,0,1,0,16ZM120,88h48a8,8,0,0,1,8,8v21.94q11.88-2.56,24-4V84L144,42,88,84v35.81q12.19,3,24,7.18V96A8,8,0,0,1,120,88Zm8.07,45.27A262.48,262.48,0,0,1,160,121.94V104H128v29.24Z"></path></svg>',
Icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M104,216V152h48v64h64V120a8,8,0,0,0-2.34-5.66l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,40,120v96Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>',
},
additionalData: {
Icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M136.83,220.43a8,8,0,0,1-11.09,2.23A183.15,183.15,0,0,0,24,192a8,8,0,0,1,0-16,199.11,199.11,0,0,1,110.6,33.34A8,8,0,0,1,136.83,220.43ZM24,144a8,8,0,0,0,0,16,214.81,214.81,0,0,1,151.17,61.71,8,8,0,1,0,11.2-11.42A230.69,230.69,0,0,0,24,144Zm208,16a216.51,216.51,0,0,0-48.59,5.49q8.24,6.25,16,13.16A201.53,201.53,0,0,1,232,176a8,8,0,0,1,0,16c-6,0-11.93.29-17.85.86q8.32,8.67,15.94,18.14a8,8,0,1,1-12.48,10A247,247,0,0,0,24,128a8,8,0,0,1,0-16,266.33,266.33,0,0,1,48,4.37V80a8,8,0,0,1,3.2-6.4l64-48a8,8,0,0,1,9.6,0l64,48A8,8,0,0,1,216,80v32.49c5.31-.31,10.64-.49,16-.49a8,8,0,0,1,0,16,246.3,246.3,0,0,0-84.26,14.69q9.44,5,18.46,10.78A232.2,232.2,0,0,1,232,144a8,8,0,0,1,0,16ZM120,88h48a8,8,0,0,1,8,8v21.94q11.88-2.56,24-4V84L144,42,88,84v35.81q12.19,3,24,7.18V96A8,8,0,0,1,120,88Zm8.07,45.27A262.48,262.48,0,0,1,160,121.94V104H128v29.24Z"></path></svg>',
Icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M104,216V152h48v64h64V120a8,8,0,0,0-2.34-5.66l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,40,120v96Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>',
Type: "areas",
LongDescription: `The building models have a 3D object of each building plus additional information on its dimentions.`,
MinZoomLevel: 11,
MarkersThreshold: 17,
DisplayProperty: [],
PolygonColoring: null,
Tables: [],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public string GetDataInsideArea(BoundingBox boundingBox)
{
"properties", new Dictionary<string, object>
{
{ "text", $"{row["operator"]}" }
{ "operator", $"{row["operator"]}" }
}
}
};
Expand Down
72 changes: 71 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@
"proj4leaflet": "^1.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-leaflet": "^4.2.1"
"react-leaflet": "^4.2.1",
"three": "^0.166.1",
"uuid": "^10.0.0"
},
"devDependencies": {
"@types/leaflet": "^1.9.12",
"@types/node": "^20.12.12",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/three": "^0.166.0",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
44 changes: 21 additions & 23 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
position: fixed;
top: 0;
left: 0;
width: 100%;
width: 100%;
height: 100%;
overflow: hidden;
}
Expand All @@ -12,30 +12,35 @@
overflow: hidden;
height: 100%;
position: relative;
padding: 0.6rem;
}

.multi-map {
position: relative;
width: 50%;
transition: width 0.5s;
padding-top: 10px;
padding-left: 0px;
padding-bottom: 10px;
transition: width 0.5s;
}

.multimap-container {
height: 100%;
width: 100%;
max-width: 100%;
display: flex;
flex-direction: column;
padding-right: 10px;
position: relative;
}

.data-view {
width: 50%;
position: relative;
transition: width 0.5s;
transition: width 0.5s;
overflow: hidden;
box-sizing: border-box;
padding-top: 10px;
padding-bottom: 10px;
padding-right:10px;
}

.hidden {
width: 0;
width: 0;
overflow: hidden;
padding: 0px;
}
Expand All @@ -44,21 +49,14 @@
width: 100%;
}

.multimap-container {
display: flex;
flex-direction: column;
position: relative;
height: 100%;
}

.toggle-button {
.toggle-data-view-button {
position: absolute;
z-index: 5;
top: 13px;
right: 0px;
align-self: end;
top: 7px;
right: 0px;
align-self: end;
padding: 0;
padding-top:3px;
padding-top: 3px;
align-items: center;
justify-content: center;
min-width: 2rem;
Expand All @@ -82,4 +80,4 @@
.toggle-button:focus {
color: black;
border-color: black;
}
}
Loading
Loading