Refactor 3d to own library

This commit is contained in:
Willem Dantuma 2020-10-02 17:20:00 +02:00
parent b00b21e6b8
commit e87affee08
22 changed files with 265 additions and 13 deletions

View File

@ -241,6 +241,46 @@
}
}
}
},
"common-map3d": {
"projectType": "library",
"root": "projects/common-map3d",
"sourceRoot": "projects/common-map3d/src",
"prefix": "fm-map3d",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/common-map3d/tsconfig.lib.json",
"project": "projects/common-map3d/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/common-map3d/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/common-map3d/src/test.ts",
"tsConfig": "projects/common-map3d/tsconfig.spec.json",
"karmaConfig": "projects/common-map3d/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/common-map3d/tsconfig.lib.json",
"projects/common-map3d/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "farmmaps-lib-app"

4
package-lock.json generated
View File

@ -1715,9 +1715,7 @@
}
},
"@farmmaps/common-map": {
"version": "0.0.1-prerelease.420",
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.420.tgz",
"integrity": "sha512-91vy6x4M0ms/lk8Zc8I0uaAk2IG15UG1SXYDvuxgoQZHpQxaGQhALvKkf1mY8V27pwwx6dVDYs8X9VuTRIy9rw==",
"version": "file:dist/common-map",
"requires": {
"tslib": "^2.0.0"
}

View File

@ -20,7 +20,7 @@
"@angular/platform-browser-dynamic": "~10.1.3",
"@angular/router": "~10.1.3",
"@farmmaps/common": ">=0.0.1-prerelease.420 <0.0.1",
"@farmmaps/common-map": ">=0.0.1-prerelease.420 <0.0.1",
"@farmmaps/common-map": "file:dist/common-map",
"@microsoft/signalr": "^3.1.3",
"@ng-bootstrap/ng-bootstrap": "^7.0",
"@ngrx/effects": "^10.0",
@ -33,7 +33,7 @@
"font-awesome": "^4.7.0",
"ngrx-store-localstorage": "^10.0",
"ngx-bootstrap": "^5.6.1",
"ngx-openlayers": "1.0.0-next.13",
"ngx-openlayers": "1.0.0-next.16",
"ngx-uploadx": "^3.5.1",
"ol": "6.1.1",
"ol-cesium": "^2.11.3",

View File

@ -15,7 +15,7 @@
"@ngrx/store": "^10.0",
"tassign": "^1.0.0",
"@farmmaps/common": ">=0.0.1-prerelease.420 <0.0.1",
"ngx-openlayers": "1.0.0-next.13",
"ngx-openlayers": "1.0.0-next.16",
"ol": "6.1.1"
}
}

View File

@ -24,7 +24,6 @@ import { IPeriodState } from './models/period.state';
// components
import { GpsLocation} from './components/aol/gps-location/gps-location.component';
import {Switch2D3DComponent } from './components/aol/switch2d3d/switch2d3d.component';
import {FeatureListFeatureCropfieldComponent } from './components/feature-list-feature-cropfield/feature-list-feature-cropfield.component';
import { FeatureListFeatureCroppingschemeComponent} from './components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component';
import { ItemWidgetListComponent} from './components/item-widget-list/item-widget-list.component';
@ -102,7 +101,6 @@ export {
MapComponent,
MetaDataModalComponent,
RotationResetComponent,
Switch2D3DComponent,
MapSearchComponent,
SelectPeriodModalComponent,
LayerListComponent,
@ -171,7 +169,6 @@ export {
MapComponent,
MetaDataModalComponent,
RotationResetComponent,
Switch2D3DComponent,
MapSearchComponent,
SelectPeriodModalComponent,
LayerListComponent,
@ -242,7 +239,6 @@ export {
ItemWidgetListComponent,
WidgetStatusComponent,
RotationResetComponent,
Switch2D3DComponent,
MapSearchComponent,
SelectPeriodModalComponent,
LayerListComponent,

View File

@ -39,7 +39,7 @@
</aol-layer-vector>
<!-- <fm-map-gps-location [position]="state.position" [headingTolerance]="20" [showHeading]="true" [heading]="state.compassHeading"></fm-map-gps-location> -->
<div class="control-container">
<fm-map-switch2d3d></fm-map-switch2d3d>
<router-outlet name="map-controls"></router-outlet>
<fm-map-layer-switcher></fm-map-layer-switcher>
<fm-map-pan-to-location [position]="state.position" [mapState]="state.mapState" [animate]="true"></fm-map-pan-to-location>
<fm-map-rotation-reset></fm-map-rotation-reset>

View File

@ -0,0 +1,24 @@
# CommonMap3d
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.3.
## Code scaffolding
Run `ng generate component component-name --project common-map3d` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project common-map3d`.
> Note: Don't forget to add `--project common-map3d` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build common-map3d` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build common-map3d`, go to the dist folder `cd dist/common-map3d` and run `npm publish`.
## Running unit tests
Run `ng test common-map3d` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

View File

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/common-map3d'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

View File

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/common-map3d",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View File

@ -0,0 +1,14 @@
{
"name": "common-map3d",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^10.1.3",
"@angular/core": "^10.1.3",
"ngx-openlayers": "1.0.0-next.16",
"cesium": "^1.73.0",
"ol-cesium": "^2.11.3"
},
"dependencies": {
"tslib": "^2.0.0"
}
}

View File

@ -0,0 +1,11 @@
import { NgModule } from '@angular/core';
import { Switch2D3DComponent } from './components/olcs/switch2d3d/switch2d3d.component';
@NgModule({
declarations: [Switch2D3DComponent],
imports: [
],
exports: [Switch2D3DComponent]
})
export class CommonMap3dModule { }

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { CommonMap3dService } from './common-map3d.service';
describe('CommonMap3dService', () => {
let service: CommonMap3dService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CommonMap3dService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,9 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class CommonMap3dService {
constructor() { }
}

View File

@ -1,12 +1,11 @@
import { Component, OnInit,Input,Host } from '@angular/core';
import { MapComponent } from 'ngx-openlayers';
import OLCesium from 'ol-cesium';
//import OLCesium from '../../../../../../../../ol-cesium/src/olcs/OLCesium.js';
declare var olcs: any;
@Component({
selector: 'fm-map-switch2d3d',
selector: 'fm-map3d-switch2d3d',
template: '<div (click)="handleClick($event)" class="btn btn-outline-secondary twotreed">{{label}}</div>',
styleUrls: ['./switch2d3d.component.scss']
})

View File

@ -0,0 +1,7 @@
/*
* Public API Surface of common-map3d
*/
export * from './fm-map3d/common-map3d.service';
export * from './fm-map3d/components/olcs/switch2d3d/switch2d3d.component';
export * from './fm-map3d/common-map3d.module';

View File

@ -0,0 +1,26 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -0,0 +1,25 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

View File

@ -0,0 +1,10 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"enableIvy": false
}
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"lib",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"kebab-case"
]
}
}

View File

@ -26,6 +26,10 @@
],
"common-map/*": [
"dist/common-map/*"
],
"common-map3d": [
"dist/common-map3d/common-map3d",
"dist/common-map3d"
]
}
}