Skip to content

Commit

Permalink
Merge pull request #63 from ndsev/angular-clean
Browse files Browse the repository at this point in the history
Angular Transition
  • Loading branch information
josephbirkner committed Dec 20, 2023
2 parents f930c35 + a20d749 commit c780568
Show file tree
Hide file tree
Showing 45 changed files with 25,544 additions and 685 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '21.x'
cache: "npm"
cache-dependency-path: package-lock.json

- name: Install npm dependencies
run: npm -g install --force --include=dev

- name: Build demo with Emscripten
run: |
$GITHUB_WORKSPACE/ci/00_linux_setup.bash
Expand All @@ -24,20 +34,4 @@ jobs:
with:
name: erdblick
path: |
build/index.html
build/index.css
build/index.js
build/deps
build/platform.js
build/styles
build/mapcomponent
build/images
build/libs/core/erdblick-core.*
build/erdblick/debugapi.js
build/erdblick/features.js
build/erdblick/fetch.js
build/erdblick/model.js
build/erdblick/timer.js
build/erdblick/view.js
build/erdblick/wasm.js
static/*
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ ci/emsdk/
.idea
cmake-build-debug-wsl
clion-build-*
static/libs
static
.angular
node_modules
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(erdblick)
include(FetchContent)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_OSX_ARCHITECTURES "x86_64")

# Treat warnings as errors, with some exceptions for Cesium.
set (ERDBLICK_CXX_FLAGS
Expand Down Expand Up @@ -50,9 +51,6 @@ FetchContent_MakeAvailable(yaml-cpp)

add_subdirectory(libs/core)

add_custom_target(static-web-files ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/static" "${CMAKE_CURRENT_BINARY_DIR}")

if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
add_subdirectory(test)
endif()
49 changes: 44 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`erdblick` is a dynamic mapviewer built on the `mapget` feature service.

> **Warning ⚠️**: Erdblick is still under active development and hasn't reached its final form. However, we'd love to hear your feedback during this phase. Our goal is to launch a fully functional Desktop app by the end of 2023. Stay tuned! 🚀
> **Warning ⚠️**: Erdblick is still under active development and hasn't reached its final form. However, we'd love to hear your feedback during this phase.
**Capabilities:** 🛠️

Expand All @@ -14,11 +14,18 @@
* 🖼️ Utilize split-screen panes for optional overlay or synchronized navigation with an adjustable splitter **(Planned)**.
* 🔎 View multiple map layer tile zoom levels all at once **(Planned)**.

## Setup
![mapget ui](./docs/erdblick.png)

Ready to try out the latest version? While the Desktop app is still work-in-progress, swing by the [Release Page](https://github.com/Klebert-Engineering/erdblick/releases) to grab the newest build. Currently, `erdblick` is made to be served by a [`mapget`](https://github.com/klebert-engineering/mapget) server, so make sure to serve it up with the `mapget serve` command. Not sure how to do that? Start off with a simple `pip install mapget` and then fire away with `mapget serve -w path-to-unpacked-erdblick`.
## Setup

![mapget alpha ui](./docs/erdblick-alpha.png)
Ready to try out the latest version?
While the Desktop app is still work-in-progress, swing by the [Release Page](https://github.com/Klebert-Engineering/erdblick/releases) to grab the newest build.
Currently, `erdblick` is made to be served by a [`mapget`](https://github.com/klebert-engineering/mapget) server,
so make sure to serve it up with the `mapget serve` command.
Not sure how to do that? Start off with a simple `pip install mapget` and then fire away with
```bash
mapget serve -w <path-to-unpacked-erdblick>
```

## Styling System

Expand All @@ -44,9 +51,31 @@ Each rule within the YAML `rules` array can have the following fields. Any field
| `opacity`__*__ | A float value between 0 and 1 indicating the opacity. | Float | `0.8` |
| `width`__*__ | Specifies the line width or point diameter (default in pixels). | Float | `4.5` |
| `flat`__*__ | Clamps the feature to the ground (Does not work for meshes). | Boolean | `true`, `false` |
| `outline-color`__*__ | Feature outline color (works only for points). | String | `green`, `#fff` |
| `outline-color`__*__ | Point outline color. | String | `green`, `#fff` |
| `outline-width`__*__ | Point outline width in px. | Float | `3.6` |
| `near-far-scale`__*__ | For points, indicate (`near-alt-meters`, `near-scale`, `far-alt-meters`, `far-scale`). | Array of four Floats. | `[1.5e2,10,8.0e6,0]` |
| `first-of`__*__ | Mark a rule as a parent of a fallback rule list. See description below. | Array of Rule objects. | See example below. |

**About `first-of`:**

Normally, all style rules from a style sheet are naively applied to all matching features.
However, usually, it will be sufficient if only the first matching rule from a list
is applied. This allows a simple fallback rule at the bottom of the list. For this purpose,
the `first-of` style rule field exists. It may be applied as follows:

```yaml
rules:
- type: Road
first-of:
- (subrule-1...)
- (subrule-2...)
- (subrule-n)
```
Note, that all attributes except for `type`, `filter` and `first-of` are propagated
from the parent rule to the subrules. For example, a parent rule `color` will be applied
to the child, unless the child overrides the color. It is explicitly allowed
that sub-rules may have sub-rules themselves.

**A brief example:**

Expand Down Expand Up @@ -74,6 +103,14 @@ rules:
<details>
<summary>Show instructions</summary>

Make sure that these prerequisite dependencies are installed:

| Dependency | Version |
|------------|---------|
| `node` | 21.3.0+ |
| `npm` | 10.2.4+ |
| `cmake` | 3.24+ |

Run the setup script once to pull Emscripten SDK:

```bash
Expand All @@ -92,6 +129,8 @@ To rebuild the project (skipping checkouts and CMake initialization), run:
./ci/20_linux_rebuild.bash
```

You will find the resulting built web app under the directory `./static`.

You can also build the `erdblick-core` library with a standard C++ compiler
in an IDE of your choice. This is also useful to run the unit-tests.

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.4.0
145 changes: 145 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"erdblick": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "erdblick_app",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"outputPath": "static",
"index": "erdblick_app/index.html",
"main": "erdblick_app/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "node_modules/cesium/Build/Cesium/Workers",
"output": "/bundle/cesium/Workers"
},
{
"glob": "**/*",
"input": "node_modules/cesium/Build/Cesium/ThirdParty",
"output": "/bundle/cesium/ThirdParty"
},
{
"glob": "**/*",
"input": "node_modules/cesium/Build/Cesium/Assets",
"output": "/bundle/cesium/Assets"
},
{
"glob": "**/*",
"input": "node_modules/cesium/Build/Cesium/Widgets",
"output": "/bundle/cesium/Widgets"
},
{
"glob": "**/*",
"input": "styles",
"output": "/bundle/styles"
},
{
"glob": "**/*",
"input": "images",
"output": "/bundle/images"
},
{
"glob": "VERSION",
"input": ".",
"output": "/bundle/"
}
],
"styles": [
"node_modules/primeng/resources/themes/lara-light-blue/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/cesium/Build/Cesium/Widgets/widgets.css",
"erdblick_app/styles.scss"
],
"scripts": [

],
"customWebpackConfig": {
"path": "./webpack.config.js"
}
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "60mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": {
"scripts": false,
"styles": false,
"fonts": false
},
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "development"
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"configurations": {
"production": {
"browserTarget": "erdblick:build:production"
},
"development": {
"browserTarget": "erdblick:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-builders/custom-webpack:extract-i18n",
"options": {
"browserTarget": "erdblick:build"
}
},
"test": {
"builder": "@angular-builders/custom-webpack:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
],
"styles": [
"erdblick_app/styles.scss"
],
"scripts": []
}
}
}
}
}
}
25 changes: 25 additions & 0 deletions build-ui.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

SOURCE_LOC=$1
if [ -z $SOURCE_LOC ]; then
echo "No source location supplied."
exit 1
fi

echo "Using source dir @ $SOURCE_LOC."
cd "$SOURCE_LOC" || exit 1

echo "Collecting npm modules."
npm install

echo "Patching erblick-core TS definitions."
if grep -q "export default libErdblickCore" "$SOURCE_LOC/build/libs/core/erdblick-core.d.ts"; then
echo "! The TS definitions are already patched. !"
else
printf "\ndeclare var libErdblickCore: any; \nexport default libErdblickCore; \n" >> "$SOURCE_LOC/build/libs/core/erdblick-core.d.ts"
fi

echo "Building Angular distribution files."
npm run build -- -c production

exit 0
Binary file removed docs/erdblick-alpha.png
Binary file not shown.
Binary file added docs/erdblick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions erdblick_app/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

const routes: Routes = [];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
35 changes: 35 additions & 0 deletions erdblick_app/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it(`should have as title 'erdblick'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('erdblick');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('erdblick app is running!');
});
});
Loading

0 comments on commit c780568

Please sign in to comment.