Skip to content

Commit

Permalink
Merge pull request #1 from geoblocks/GEORD-605_building_illumination
Browse files Browse the repository at this point in the history
Building illumination
  • Loading branch information
gberaudo authored Aug 30, 2024
2 parents 9086d0b + 8198ef5 commit c4b09fe
Show file tree
Hide file tree
Showing 18 changed files with 381 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: CI

on:
Expand Down Expand Up @@ -38,6 +40,8 @@ jobs:
path: 'dist'

deploy:
if: ${{ github.ref == 'refs/heads/master' }}

needs: build

permissions:
Expand Down
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["redhat.vscode-yaml", "runem.lit-plugin"]
}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"files.associations": {"*.json": "jsonc"}
"files.associations": {
"*.json": "jsonc"
},
"lit-plugin.strict": true
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ The "modern" touch comes from today's advances of the technology (CSS vars, type
We provide web applications customized using a json file, CSS variables, graphic resources.
These are focused on a particular use-case.

- [Digital twins: building permits](./src/apps/buildings/README.md) [[demo]](https://geoblocks.github.io/ngv/src/apps/buildings/index.html)
- [Digital twins: building permits](./src/apps/permits/README.md) [[demo]](https://geoblocks.github.io/ngv/src/apps/permits/index.html)
- [Digital twins: illumination / solar](./src/apps/illumination/README.md) [[demo]](https://geoblocks.github.io/ngv/src/apps/illumination/index.html)

# Application builder

Expand Down
7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
<h1>List of turn-key apps:</h1>
<ul>
<li>
<a href="./src/apps/buildings/index.html"
<a href="./src/apps/permits/index.html"
>Digital twins: building permits</a
>
</li>
<li>
<a href="./src/apps/illumination/index.html"
>Digital twins: illumination / solar</a
>
</li>
<li>...</li>
</ul>
<!-- link to documentation -->
Expand Down
1 change: 1 addition & 0 deletions public/Assets
1 change: 1 addition & 0 deletions public/Workers
10 changes: 10 additions & 0 deletions src/apps/illumination/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Digital twins: illumination / solar

Municipalities: a common use-case for digital twins is to see how shadows are cast by buildings, relief and vegetation.

- Display a base 3D tileset with buildings
- Position the sun according to some date
- Be able to easily change day / time
- Color roofs / walls? depending on angle with the sun.
- does it make sense? (instantaneous and does not take into account the shades)
- require the information to be part of the 3d-tiles?
32 changes: 32 additions & 0 deletions src/apps/illumination/defaultConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"header": {
"languages": ["de", "fr", "en", "it"],
"title": {
"fr": "Ma super app",
"en": "My super app",
"de": "Meine supper app",
"it": "Mia super app"
}
},
"footer": {
"contact": "[email protected]",
"impressum": {
"fr": "Bla bla FR impressim",
"en": "Bla bla EN impressim",
"de": "Bla bla DE impressim",
"it": "Bla bla IT impressim"
}
},
"app": {
"terrain": "https://3d.geo.admin.ch/ch.swisstopo.terrain.3d/v1/",
"buildings": "https://vectortiles0.geo.admin.ch/3d-tiles/ch.swisstopo.swisstlm3d.3d/20201020/tileset.json",
"vegetation": "https://vectortiles.geo.admin.ch/3d-tiles/ch.swisstopo.vegetation.3d/20190313/tileset.json",
"initialView": {
"destination": [6.628484, 46.5, 1000],
"orientation": {
"heading": 0,
"pitch": -30.0
}
}
}
}
15 changes: 15 additions & 0 deletions src/apps/illumination/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Revolutionary illumination / solar app</title>
<!-- <link rel="stylesheet" href="./src/index.css" /> -->
<script type="module" src="./index.ts"></script>
</head>
<body>
<noscript>Enable JS!</noscript>
<ngv-app-illumination></ngv-app-illumination>
</body>
</html>
37 changes: 37 additions & 0 deletions src/apps/illumination/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {html} from 'lit';
import {customElement} from 'lit/decorators.js';

import '../../structure/ngv-structure-app.js';

// // @ts-expect-error ?url parameter is a viteJS specificity
// import logoUrl from "../../logo.svg?url";
import {localized} from '@lit/localize';
import {ABaseApp} from '../../structure/BaseApp.js';

// @ts-expect-error viteJS specific import
import configUrl from './defaultConfig.json?url';

import './ngv-main-illumination.js';
import {IIlluminationConfig} from './ingv-config-illumination.js';

@customElement('ngv-app-illumination')
@localized()
export class NgvAppIllumination extends ABaseApp<IIlluminationConfig> {
constructor() {
super(configUrl as string);
}

render() {
const r = super.render();
if (r) {
return r;
}
return html`
<ngv-structure-app .config=${this.config}>
<ngv-main-illumination
.config=${this.config.app}
></ngv-main-illumination>
</ngv-structure-app>
`;
}
}
16 changes: 16 additions & 0 deletions src/apps/illumination/ingv-config-illumination.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {INgvStructureApp} from '../../structure/ngv-structure-app.js';

export interface IIlluminationConfig extends INgvStructureApp {
app: {
terrain: string;
buildings: string;
vegetation: string;
initialView: {
destination: [number, number, number];
orientation: {
heading: number;
pitch: number;
};
};
};
}
Loading

0 comments on commit c4b09fe

Please sign in to comment.