Compare commits
9 Commits
835851350c
...
7696ddd8d2
Author | SHA1 | Date | |
---|---|---|---|
|
7696ddd8d2 | ||
|
1301a9d082 | ||
|
e87affee08 | ||
|
b00b21e6b8 | ||
|
b93218e165 | ||
|
21af6ab2c4 | ||
|
c606e02673 | ||
|
15d1f14ee1 | ||
|
22e007b70b |
@ -13,13 +13,16 @@ pipeline {
|
||||
npm install
|
||||
cd ../common-map
|
||||
npm install
|
||||
cd ../common-map3d
|
||||
npm install
|
||||
'''
|
||||
}
|
||||
}
|
||||
stage('build'){
|
||||
steps {
|
||||
sh '''ng build common
|
||||
ng build common-map'''
|
||||
ng build common-map
|
||||
ng build common-map3d'''
|
||||
}
|
||||
}
|
||||
stage('npm publish'){
|
||||
@ -29,6 +32,9 @@ pipeline {
|
||||
npm publish
|
||||
cd ../common-map
|
||||
npm version ${PACKAGE_VERSION}
|
||||
npm publish
|
||||
cd ../common-map3d
|
||||
npm version ${PACKAGE_VERSION}
|
||||
npm publish'''
|
||||
}
|
||||
}
|
||||
|
56
angular.json
56
angular.json
@ -11,8 +11,11 @@
|
||||
"schematics": {},
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"builder": "@angular-builders/custom-webpack:browser",
|
||||
"options": {
|
||||
"customWebpackConfig": {
|
||||
"path": "./custom-webpack.config.js"
|
||||
},
|
||||
"aot": true,
|
||||
"outputPath": "dist/farmmaps-lib-app",
|
||||
"index": "src/index.html",
|
||||
@ -35,13 +38,20 @@
|
||||
"input": "src/assets",
|
||||
"output": "/"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "node_modules/cesium/Build/Cesium",
|
||||
"output": "/assets/cesium"
|
||||
},
|
||||
"src/configuration.json"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.css",
|
||||
"node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||
"node_modules/font-awesome/css/font-awesome.min.css",
|
||||
"fonts/FMIconFont/style.css"
|
||||
"fonts/FMIconFont/style.css",
|
||||
"node_modules/cesium/Build/Cesium/Widgets/widgets.css",
|
||||
"node_modules/ol/ol.css"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
@ -77,7 +87,7 @@
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"builder": "@angular-builders/custom-webpack:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "farmmaps-lib-app:build"
|
||||
},
|
||||
@ -231,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"
|
||||
|
10
custom-webpack.config.js
Normal file
10
custom-webpack.config.js
Normal file
@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
node: {
|
||||
// Resolve node module use of fs
|
||||
fs: "empty",
|
||||
Buffer: false,
|
||||
http: "empty",
|
||||
https: "empty",
|
||||
zlib: "empty"
|
||||
}
|
||||
};
|
61
package-lock.json
generated
61
package-lock.json
generated
@ -4,6 +4,35 @@
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@angular-builders/custom-webpack": {
|
||||
"version": "10.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@angular-builders/custom-webpack/-/custom-webpack-10.0.1.tgz",
|
||||
"integrity": "sha512-YDy5zEKVwXdoXLjmbsY6kGaEbmunQxaPipxrwLUc9hIjRLU2WcrX9vopf1R9Pgj4POad73IPBNGu+ibqNRFIEQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@angular-devkit/architect": ">=0.1000.0 < 0.1100.0",
|
||||
"@angular-devkit/build-angular": ">=0.1000.0 < 0.1100.0",
|
||||
"@angular-devkit/core": "^10.0.0",
|
||||
"lodash": "^4.17.15",
|
||||
"ts-node": "^9.0.0",
|
||||
"webpack-merge": "^4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ts-node": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz",
|
||||
"integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arg": "^4.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"source-map-support": "^0.5.17",
|
||||
"yn": "3.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@angular-devkit/architect": {
|
||||
"version": "0.1001.3",
|
||||
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1001.3.tgz",
|
||||
@ -1686,9 +1715,9 @@
|
||||
}
|
||||
},
|
||||
"@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": "0.0.1-prerelease.426",
|
||||
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.426.tgz",
|
||||
"integrity": "sha512-wt1GB0UY9GVfzOvhuKmsDeMXR7hvV4rJmIIAB8f8yYkM/5vja8sY9VqFXidNvbW4Kp6KHgkzByCOG4qtcyDLdw==",
|
||||
"requires": {
|
||||
"tslib": "^2.0.0"
|
||||
}
|
||||
@ -3226,6 +3255,11 @@
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
|
||||
},
|
||||
"cesium": {
|
||||
"version": "1.73.0",
|
||||
"resolved": "https://registry.npmjs.org/cesium/-/cesium-1.73.0.tgz",
|
||||
"integrity": "sha512-HqvxPbCEsE1Szdm5qPIrBNjHG2cJ9Xk5uYMELmG0GuBL/sYaQ/0IMton43LUBY4E/wblRivNo1Vz7tIQweraFw=="
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
@ -8188,19 +8222,9 @@
|
||||
"integrity": "sha512-6YHXtdXkGH3w0NQoaUgNYAcrj064Lv5RTO284ha/hvpNTrh55yQz2cVh0VvwBk3MjyY2tdmLH4SuCJDszYdYiw=="
|
||||
},
|
||||
"ngx-openlayers": {
|
||||
"version": "1.0.0-next.13",
|
||||
"resolved": "https://registry.npmjs.org/ngx-openlayers/-/ngx-openlayers-1.0.0-next.13.tgz",
|
||||
"integrity": "sha512-6y724s5JV6n1oxEhryxP3wcbwzpierj9RLiMLXInfKOG3l5IO1AtPNkeK9+mKctVDUVm5URIfzzZH02Ld+bvSQ==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
|
||||
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q=="
|
||||
}
|
||||
}
|
||||
"version": "1.0.0-next.16",
|
||||
"resolved": "https://registry.npmjs.org/ngx-openlayers/-/ngx-openlayers-1.0.0-next.16.tgz",
|
||||
"integrity": "sha512-GzNCyjj72AHEcmf8oT6SDSZLYBwKBJwRebMv1SgPdY4gsoQ/dbpqY7nmjX8k8kuQoVQQxt7UyIak3tcNYbOKVQ=="
|
||||
},
|
||||
"ngx-uploadx": {
|
||||
"version": "3.5.2",
|
||||
@ -8698,6 +8722,11 @@
|
||||
"rbush": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"ol-cesium": {
|
||||
"version": "2.11.3",
|
||||
"resolved": "https://registry.npmjs.org/ol-cesium/-/ol-cesium-2.11.3.tgz",
|
||||
"integrity": "sha512-rdjk2BjNgSQF1i6wV2FfmGATAdnaLQ5d7DMIhIBoxRVpUYvOOp7swptIQZLDXQMVzqkVJUoY7AKFLEFLbUV+TQ=="
|
||||
},
|
||||
"on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
|
@ -28,13 +28,15 @@
|
||||
"@ngrx/store": "^10.0",
|
||||
"angular-oauth2-oidc": "^10.0.3",
|
||||
"bootstrap": "^4.4.1",
|
||||
"cesium": "^1.73.0",
|
||||
"core-js": "^2.6.11",
|
||||
"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",
|
||||
"resumablejs": "^1.1.0",
|
||||
"rxjs": "^6.5.4",
|
||||
"tassign": "^1.0.0",
|
||||
@ -48,6 +50,7 @@
|
||||
"@angular/cli": "^10.1.3",
|
||||
"@angular/compiler-cli": "~10.1.3",
|
||||
"@angular/language-service": "~10.1.3",
|
||||
"@angular-builders/custom-webpack": "~10.0.1",
|
||||
"@types/jasmine": "~2.8.8",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "^12.11.1",
|
||||
|
@ -14,8 +14,8 @@
|
||||
"@ngrx/router-store": "^10.0",
|
||||
"@ngrx/store": "^10.0",
|
||||
"tassign": "^1.0.0",
|
||||
"@farmmaps/common": ">=0.0.1-prerelease.411 <0.0.1",
|
||||
"ngx-openlayers": "1.0.0-next.13",
|
||||
"@farmmaps/common": ">=0.0.1-prerelease.420 <0.0.1",
|
||||
"ngx-openlayers": "1.0.0-next.16",
|
||||
"ol": "6.1.1"
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges ,Host} from '@angular/core';
|
||||
import { MapComponent } from 'ngx-openlayers';
|
||||
import Overlay from 'ol/Overlay';
|
||||
import { fromLonLat, toLonLat } from 'ol/proj';
|
||||
@ -23,9 +23,10 @@ export class GpsLocation implements OnInit,OnChanges{
|
||||
public path: string = "";
|
||||
public rotate: string = "";
|
||||
private resolution: number = 0;
|
||||
initialized:boolean = false;
|
||||
@ViewChild('location', { static: true }) locationElement: ElementRef;
|
||||
|
||||
constructor(private map: MapComponent) {
|
||||
constructor(@Host() private map: MapComponent) {
|
||||
|
||||
}
|
||||
|
||||
@ -54,12 +55,13 @@ export class GpsLocation implements OnInit,OnChanges{
|
||||
this.resolution = evt.target.get('resolution');
|
||||
this.recalcLocationTolerance();
|
||||
});
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes.position && this.instance) {
|
||||
var p = changes.position.currentValue as Position;
|
||||
if(p) {
|
||||
if(p && this.initialized) {
|
||||
this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude]));
|
||||
this.locationTolerance = p.coords.accuracy;
|
||||
this.recalcLocationTolerance();
|
||||
|
@ -99,17 +99,14 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
|
||||
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
||||
var rt = l.rendering as IRenderoutputTiles;
|
||||
let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
|
||||
let source = new XYZ({crossOrigin: 'use-credentials', maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
|
||||
layer = new Tile({ source: source });
|
||||
}
|
||||
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
|
||||
var ri = l.rendering as IRenderoutputImage;
|
||||
let projection = new Projection({
|
||||
code: 'image',
|
||||
units: 'pixels',
|
||||
extent: ri.extent
|
||||
});
|
||||
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` });
|
||||
// convert to EPSG:4326 asworkaround for cesium
|
||||
var projectedExtent = proj.transformExtent( ri.extent, 'EPSG:3857','EPSG:4326');
|
||||
let source = new ImageStatic({ imageExtent:projectedExtent,projection:'EPSG:4326', crossOrigin: 'use-credentials', url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` });
|
||||
layer = new Image({ source: source });
|
||||
}
|
||||
return layer;
|
||||
|
@ -1,40 +0,0 @@
|
||||
// import { Component, OnInit,Input } from '@angular/core';
|
||||
//import { MapComponent } from 'ngx-openlayers';
|
||||
//import OLCesium from 'olcs/OLCesium.js';
|
||||
|
||||
|
||||
// @Component({
|
||||
// selector: 'fm-map-switch2d3d',
|
||||
// template: '<div (click)="handleClick($event)" class="rounded-circle twotreed">{{label}}</div>',
|
||||
// styles: [`.twotreed {
|
||||
// width:2.5em;
|
||||
// height:2.5em;
|
||||
// background-color: white;
|
||||
// text-align:center;
|
||||
// line-height:2.5em;
|
||||
// font-weight:bold;
|
||||
// cursor:default;}`]
|
||||
|
||||
// })
|
||||
// export class Switch2D3DComponent {
|
||||
|
||||
// @Input() enable:boolean;
|
||||
// public label: string = "3D";
|
||||
// private ol3d: OLCesium;
|
||||
|
||||
|
||||
// constructor(private map: MapComponent) {
|
||||
|
||||
// }
|
||||
|
||||
// ngOnInit() {
|
||||
// this.ol3d = new OLCesium({ map: this.map.instance }); // ol2dMap is the ol.Map instance
|
||||
// }
|
||||
|
||||
// handleClick(event) {
|
||||
// this.enable = !this.enable;
|
||||
// if (this.enable)
|
||||
// this.ol3d.setEnabled(this.enable);
|
||||
// this.label = this.enable?"2D":"3D";
|
||||
// }
|
||||
// }
|
@ -37,9 +37,9 @@
|
||||
<aol-layer-vector>
|
||||
<fm-map-item-source-vector [styles]="state.styles" [features]="state.features" (onFeaturesSelected)="handleFeatureClick($event)" (onFeatureHover)="handleFeatureHover($event)" [selectedFeature]="state.selectedFeature" [selectedItem]="state.selectedItem"></fm-map-item-source-vector>
|
||||
</aol-layer-vector>
|
||||
<fm-map-gps-location [position]="state.position" [headingTolerance]="20" [showHeading]="true" [heading]="state.compassHeading"></fm-map-gps-location>
|
||||
<!-- <fm-map-gps-location [position]="state.position" [headingTolerance]="20" [showHeading]="true" [heading]="state.compassHeading"></fm-map-gps-location> -->
|
||||
<div class="control-container">
|
||||
<!-- <switch2d3d></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>
|
||||
|
24
projects/common-map3d/README.md
Normal file
24
projects/common-map3d/README.md
Normal 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).
|
32
projects/common-map3d/karma.conf.js
Normal file
32
projects/common-map3d/karma.conf.js
Normal 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
|
||||
});
|
||||
};
|
7
projects/common-map3d/ng-package.json
Normal file
7
projects/common-map3d/ng-package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../dist/common-map3d",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
14
projects/common-map3d/package.json
Normal file
14
projects/common-map3d/package.json
Normal 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"
|
||||
}
|
||||
}
|
11
projects/common-map3d/src/fm-map3d/common-map3d.module.ts
Normal file
11
projects/common-map3d/src/fm-map3d/common-map3d.module.ts
Normal 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 { }
|
@ -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();
|
||||
});
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CommonMap3dService {
|
||||
|
||||
constructor() { }
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
@import "~bootstrap/scss/bootstrap.scss";
|
||||
|
||||
.twotreed {
|
||||
display:block;
|
||||
width:2.5em;
|
||||
height:2.5em;
|
||||
background-color: $body-bg;
|
||||
background-size: contain;
|
||||
margin-top:0.5em;
|
||||
text-align: center;
|
||||
line-height: 2.5em;
|
||||
border-radius: 1.75em;
|
||||
padding: 0;
|
||||
color: $secondary;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
import { Component, OnInit,Input,Host } from '@angular/core';
|
||||
import { MapComponent } from 'ngx-openlayers';
|
||||
import OLCesium from 'ol-cesium';
|
||||
|
||||
declare var olcs: any;
|
||||
|
||||
@Component({
|
||||
selector: 'fm-map3d-switch2d3d',
|
||||
template: '<div (click)="handleClick($event)" class="btn btn-outline-secondary twotreed">{{label}}</div>',
|
||||
styleUrls: ['./switch2d3d.component.scss']
|
||||
})
|
||||
export class Switch2D3DComponent {
|
||||
|
||||
@Input() enable:boolean;
|
||||
public label: string = "3D";
|
||||
private ol3d: OLCesium;
|
||||
private synchronizers:any[];
|
||||
|
||||
|
||||
constructor(@Host() private map: MapComponent) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.ol3d = new OLCesium({ map: this.map.instance, createSynchronizers: (map,scene) => {
|
||||
this.synchronizers = [
|
||||
new olcs.RasterSynchronizer(map,scene),
|
||||
new olcs.VectorSynchronizer(map,scene)
|
||||
];
|
||||
return this.synchronizers;
|
||||
}, stopOpenLayersEventsPropagation:true});
|
||||
}
|
||||
|
||||
synchronize() {
|
||||
this.synchronizers.forEach((synchronizer) => {
|
||||
synchronizer.synchronize();
|
||||
});
|
||||
}
|
||||
|
||||
handleClick(event) {
|
||||
this.enable = !this.enable;
|
||||
if(this.enable) {
|
||||
this.synchronize();
|
||||
}
|
||||
this.ol3d.setEnabled(this.enable);
|
||||
this.label = this.enable?"2D":"3D";
|
||||
}
|
||||
}
|
7
projects/common-map3d/src/public-api.ts
Normal file
7
projects/common-map3d/src/public-api.ts
Normal 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';
|
26
projects/common-map3d/src/test.ts
Normal file
26
projects/common-map3d/src/test.ts
Normal 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);
|
25
projects/common-map3d/tsconfig.lib.json
Normal file
25
projects/common-map3d/tsconfig.lib.json
Normal 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"
|
||||
]
|
||||
}
|
10
projects/common-map3d/tsconfig.lib.prod.json
Normal file
10
projects/common-map3d/tsconfig.lib.prod.json
Normal 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
|
||||
}
|
||||
}
|
17
projects/common-map3d/tsconfig.spec.json
Normal file
17
projects/common-map3d/tsconfig.spec.json
Normal 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"
|
||||
]
|
||||
}
|
17
projects/common-map3d/tslint.json
Normal file
17
projects/common-map3d/tslint.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"lib",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"lib",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,12 +1,19 @@
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
window['CESIUM_BASE_URL'] = '/assets/cesium/';
|
||||
window['Cesium'] = Cesium;
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
|
@ -26,6 +26,10 @@
|
||||
],
|
||||
"common-map/*": [
|
||||
"dist/common-map/*"
|
||||
],
|
||||
"common-map3d": [
|
||||
"dist/common-map3d/common-map3d",
|
||||
"dist/common-map3d"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user