Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b191751e02 |
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@@ -20,9 +20,9 @@ pipeline {
|
||||
}
|
||||
stage('build'){
|
||||
steps {
|
||||
sh '''ng build common --configuration production
|
||||
ng build common-map --configuration production
|
||||
ng build common-map3d --configuration production'''
|
||||
sh '''ng build common
|
||||
ng build common-map
|
||||
ng build common-map3d'''
|
||||
}
|
||||
}
|
||||
stage('npm publish'){
|
||||
|
@@ -8,21 +8,21 @@ pipeline {
|
||||
stage('npm install'){
|
||||
steps {
|
||||
sh '''rm -rf node_modules/
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
cd projects/common
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
cd ../common-map
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
cd ../common-map3d
|
||||
npm install --legacy-peer-deps
|
||||
npm install
|
||||
'''
|
||||
}
|
||||
}
|
||||
stage('build'){
|
||||
steps {
|
||||
sh '''ng build common --configuration production
|
||||
ng build common-map --configuration production
|
||||
ng build common-map3d --configuration production'''
|
||||
sh '''ng build common
|
||||
ng build common-map
|
||||
ng build common-map3d'''
|
||||
}
|
||||
}
|
||||
stage('npm publish'){
|
||||
|
31
angular.json
31
angular.json
@@ -83,31 +83,6 @@
|
||||
"maximumWarning": "6kb"
|
||||
}
|
||||
]
|
||||
},
|
||||
"development": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"optimization": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true,
|
||||
"extractLicenses": false,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": false,
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "2mb",
|
||||
"maximumError": "7mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "6kb"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -119,12 +94,8 @@
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "farmmaps-lib-app:build:production"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "farmmaps-lib-app:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
|
@@ -1,6 +1,5 @@
|
||||
module.exports = {
|
||||
resolve: {
|
||||
fallback: {
|
||||
node: {
|
||||
// Resolve node module use of fs
|
||||
fs: "empty",
|
||||
Buffer: false,
|
||||
@@ -8,5 +7,4 @@ module.exports = {
|
||||
https: "empty",
|
||||
zlib: "empty"
|
||||
}
|
||||
}
|
||||
};
|
11880
package-lock.json
generated
11880
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
56
package.json
56
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "farmmaps-lib-app",
|
||||
"version": "2.0.3",
|
||||
"version": "1.1.13",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
@@ -11,49 +11,47 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "~12.2.8",
|
||||
"@angular/common": "~12.2.8",
|
||||
"@angular/compiler": "~12.2.8",
|
||||
"@angular/core": "~12.2.8",
|
||||
"@angular/forms": "~12.2.8",
|
||||
"@angular/platform-browser": "~12.2.8",
|
||||
"@angular/platform-browser-dynamic": "~12.2.8",
|
||||
"@angular/router": "~12.2.8",
|
||||
"@farmmaps/common": "file:dist/common",
|
||||
"@farmmaps/common-map": "file:dist/common-map",
|
||||
"@farmmaps/common-map3d": "file:dist/common-map3d",
|
||||
"@angular/animations": "~11.2.14",
|
||||
"@angular/common": "~11.2.14",
|
||||
"@angular/compiler": "~11.2.14",
|
||||
"@angular/core": "~11.2.14",
|
||||
"@angular/forms": "~11.2.14",
|
||||
"@angular/platform-browser": "~11.2.14",
|
||||
"@angular/platform-browser-dynamic": "~11.2.14",
|
||||
"@angular/router": "~11.2.14",
|
||||
"@farmmaps/common": "1.1.12",
|
||||
"@farmmaps/common-map": "1.1.12",
|
||||
"@farmmaps/common-map3d": "1.1.12",
|
||||
"@microsoft/signalr": "^3.1.16",
|
||||
"@ng-bootstrap/ng-bootstrap": "^9.0",
|
||||
"@ngrx/effects": "^12.0",
|
||||
"@ngrx/router-store": "^12.0",
|
||||
"@ngrx/store": "^12.0",
|
||||
"angular-oauth2-oidc": "^12.0",
|
||||
"@ngrx/effects": "^11.0",
|
||||
"@ngrx/router-store": "^11.0",
|
||||
"@ngrx/store": "^11.0",
|
||||
"angular-oauth2-oidc": "^10.0.3",
|
||||
"bootstrap": "^4.6.0",
|
||||
"cesium": "^1.82.1",
|
||||
"core-js": "^2.6.12",
|
||||
"moment": "^2.29.1",
|
||||
"ngrx-store-localstorage": "^12.0",
|
||||
"ngrx-store-localstorage": "^11.0.0",
|
||||
"ngx-avatar": "^4.1.0",
|
||||
"ngx-clipboard": "^14.0.1",
|
||||
"ngx-image-cropper": "^3.3.5",
|
||||
"ngx-openlayers": "1.0.0-next.19",
|
||||
"ngx-openlayers": "1.0.0-next.17",
|
||||
"ngx-uploadx": "^3.5.1",
|
||||
"ol": "6.8.1",
|
||||
"ol": "6.5.0",
|
||||
"ol-cesium": "^2.13.0",
|
||||
"resumablejs": "^1.1.0",
|
||||
"rxjs": "^6.6.7",
|
||||
"tassign": "^1.0.0",
|
||||
"tslib": "^2.2.0",
|
||||
"zone.js": "~0.11.4"
|
||||
"zone.js": "~0.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-builders/custom-webpack": "^12.1.3",
|
||||
"@angular-devkit/build-angular": "^12.2.8",
|
||||
"@angular/cli": "^12.2.8",
|
||||
"@angular/compiler-cli": "~12.2.8",
|
||||
"@angular/language-service": "~12.2.8",
|
||||
"@angular/localize": "^12.2.8",
|
||||
"@types/arcgis-rest-api": "^10.4.5",
|
||||
"@angular-builders/custom-webpack": "^11.1.1",
|
||||
"@angular-devkit/build-angular": "^0.1102.14",
|
||||
"@angular/cli": "^11.2.14",
|
||||
"@angular/compiler-cli": "~11.2.14",
|
||||
"@angular/language-service": "~11.2.14",
|
||||
"@types/jasmine": "~2.8.8",
|
||||
"@types/jasminewd2": "^2.0.9",
|
||||
"@types/node": "^12.20.15",
|
||||
@@ -65,10 +63,10 @@
|
||||
"karma-coverage-istanbul-reporter": "~3.0.2",
|
||||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "^1.6.0",
|
||||
"ng-packagr": "^12.2.2",
|
||||
"ng-packagr": "^11.2.4",
|
||||
"protractor": "~7.0.0",
|
||||
"ts-node": "^8.8.1",
|
||||
"tslint": "~6.1.0",
|
||||
"typescript": "~4.3.5"
|
||||
"typescript": "~4.1.0"
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
},
|
||||
"allowedNonPeerDependencies": [
|
||||
"whitelistedNonPeerDependencies": [
|
||||
"."
|
||||
]
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@farmmaps/common-map",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.0",
|
||||
"publishConfig": {
|
||||
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
||||
},
|
||||
@@ -8,14 +8,14 @@
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": "~12.2.8",
|
||||
"ngrx-store-localstorage": "^12.0",
|
||||
"@ngrx/effects": "^12.0",
|
||||
"@ngrx/router-store":"^12.0",
|
||||
"@ngrx/store":"^12.0",
|
||||
"@angular/core": "^10.2.4",
|
||||
"ngrx-store-localstorage": "^10.0",
|
||||
"@ngrx/effects": "^10.0",
|
||||
"@ngrx/router-store": "^10.0",
|
||||
"@ngrx/store": "^10.0",
|
||||
"tassign": "^1.0.0",
|
||||
"@farmmaps/common": "~2.0",
|
||||
"ngx-openlayers": "1.0.0-next.19",
|
||||
"ol": "6.8.1"
|
||||
"@farmmaps/common": "~1.0",
|
||||
"ngx-openlayers": "1.0.0-next.17",
|
||||
"ol": "6.4.3"
|
||||
}
|
||||
}
|
||||
|
@@ -5,9 +5,7 @@ import { IItemLayer } from '../models/item.layer';
|
||||
import { ILayervalue } from '../models/layer.value';
|
||||
import { IQueryState } from '@farmmaps/common';
|
||||
import { IItem } from '@farmmaps/common';
|
||||
import { Feature } from 'ol';
|
||||
import { Style } from 'ol/style';
|
||||
import { Geometry } from 'ol/geom';
|
||||
import { Feature,Style } from 'ol';
|
||||
import { IPeriodState } from '../models/period.state';
|
||||
|
||||
export const SETSTATE = '[Map] SetState';
|
||||
@@ -105,13 +103,13 @@ export class StartSearch implements Action {
|
||||
export class StartSearchSuccess implements Action {
|
||||
readonly type = STARTSEARCHSUCCESS;
|
||||
|
||||
constructor(public features: Array<Feature<Geometry>>, public query:IQueryState) { }
|
||||
constructor(public features: Array<Feature>, public query:IQueryState) { }
|
||||
}
|
||||
|
||||
export class SelectFeature implements Action {
|
||||
readonly type = SELECTFEATURE;
|
||||
|
||||
constructor(public feature:Feature<Geometry>) { }
|
||||
constructor(public feature:Feature) { }
|
||||
}
|
||||
|
||||
export class SelectItem implements Action {
|
||||
@@ -153,13 +151,13 @@ export class SelectTemporal implements Action {
|
||||
export class AddFeatureSuccess implements Action {
|
||||
readonly type = ADDFEATURESUCCESS;
|
||||
|
||||
constructor(public feature: Feature<Geometry>) { }
|
||||
constructor(public feature: Feature) { }
|
||||
}
|
||||
|
||||
export class UpdateFeatureSuccess implements Action {
|
||||
readonly type = UPDATEFEATURESUCCESS;
|
||||
|
||||
constructor(public feature: Feature<Geometry>) { }
|
||||
constructor(public feature: Feature) { }
|
||||
}
|
||||
|
||||
export class ExpandSearch implements Action {
|
||||
@@ -273,7 +271,7 @@ export class DoQuery implements Action {
|
||||
export class SetStyle implements Action {
|
||||
readonly type = SETSTYLE;
|
||||
|
||||
constructor(public itemType:string,public style: Style | ((feature:Feature<Geometry>) => Style )) { }
|
||||
constructor(public itemType:string,public style: Style | (Feature)) { }
|
||||
}
|
||||
|
||||
export class ShowLayerSwitcher implements Action {
|
||||
@@ -289,7 +287,7 @@ export class SetReplaceUrl implements Action {
|
||||
export class SetFeatures implements Action {
|
||||
readonly type = SETFEATURES;
|
||||
|
||||
constructor(public features: Array<Feature<Geometry>>) { }
|
||||
constructor(public features: Array<Feature>) { }
|
||||
}
|
||||
|
||||
export class SetLayerValuesLocation implements Action {
|
||||
|
@@ -21,7 +21,7 @@ export class FileDropTargetComponent implements OnInit, OnDestroy {
|
||||
element: Element;
|
||||
@Output() onFileDropped = new EventEmitter<IDroppedFile>();
|
||||
@Input() parentCode: string;
|
||||
@Input() features: Array<Feature<Geometry>>;
|
||||
@Input() features: Array<Feature>;
|
||||
|
||||
constructor(private map: MapComponent) {
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ export class GpsLocation implements OnInit,OnChanges{
|
||||
this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)";
|
||||
this.locTolerancePixels = this.locationTolerance;
|
||||
this.map.instance.addOverlay(this.instance);
|
||||
this.map.instance.getView().on('change:resolution', (evt:any) => {
|
||||
this.map.instance.getView().on('change:resolution', (evt) => {
|
||||
this.resolution = evt.target.get('resolution');
|
||||
this.recalcLocationTolerance();
|
||||
});
|
||||
|
@@ -10,14 +10,12 @@ import * as proj from 'ol/proj';
|
||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
||||
import * as style from 'ol/style';
|
||||
import {Tile,Layer,Image} from 'ol/layer';
|
||||
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON,Source} from 'ol/source';
|
||||
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON} from 'ol/source';
|
||||
import {Vector as VectorSource} from 'ol/source';
|
||||
import { Vector as VectorLayer } from 'ol/layer';
|
||||
import VectorTileSource from 'ol/source/VectorTile';
|
||||
import VectorTileLayer from 'ol/layer/VectorTile';
|
||||
import {GeoJSON,MVT} from 'ol/format';
|
||||
import { Geometry } from 'ol/geom';
|
||||
import TileSource from 'ol/source/Tile';
|
||||
|
||||
@Component({
|
||||
selector: 'fm-map-item-layers',
|
||||
@@ -36,7 +34,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
private initialized:boolean = false;
|
||||
private mapEventHandlerInstalled = false;
|
||||
private selectedFeatures = {};
|
||||
private selectionLayer:Layer<Source> = null;
|
||||
private selectionLayer:Layer = null;
|
||||
|
||||
constructor(private itemService: ItemService, private map: MapComponent, public appConfig: AppConfig) {
|
||||
super(map);
|
||||
@@ -121,9 +119,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
return this.styleCache[key];
|
||||
}
|
||||
|
||||
createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||
createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
||||
var layerIndex = -1;
|
||||
var layer: Layer<Source> = null;
|
||||
var layer: Layer = null;
|
||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
||||
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
|
||||
layer = new Tile({ source: source });
|
||||
@@ -144,9 +142,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
return layer;
|
||||
}
|
||||
|
||||
createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||
createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
||||
var layerIndex = -1;
|
||||
var layer: Layer<Source> = null;
|
||||
var layer: Layer = null;
|
||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
||||
var data = item.data;
|
||||
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
||||
@@ -179,7 +177,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
let source = new VectorSource({
|
||||
strategy: loadingstrategy.bbox,
|
||||
loader: function (extent: Extent, resolution: number, projection: Projection) {
|
||||
var source = this as VectorSource<Geometry>;
|
||||
var source = this as VectorSource;
|
||||
__this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
|
||||
var features = format.readFeatures(data);
|
||||
for (let f of features) {
|
||||
@@ -232,16 +230,16 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
return layer;
|
||||
}
|
||||
|
||||
createSelectionLayer(itemLayer:IItemLayer):Layer<Source> {
|
||||
createSelectionLayer(itemLayer:IItemLayer):Layer {
|
||||
var layerIndex = -1;
|
||||
var layer: Layer<Source> = null;
|
||||
var layer: Layer = null;
|
||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
||||
var data = itemLayer.item.data;
|
||||
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
||||
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
||||
return new VectorTileLayer({
|
||||
renderMode: 'vector',
|
||||
source: (itemLayer.layer as VectorTileLayer).getSource(),
|
||||
source: itemLayer.layer.getSource(),
|
||||
style: (feature) => {
|
||||
if (feature.getId() in this.selectedFeatures) {
|
||||
|
||||
@@ -262,9 +260,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
return null;
|
||||
}
|
||||
|
||||
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
||||
let data = item.data as ILayerData;
|
||||
var layer: Layer<Source> = null;
|
||||
var layer: Layer = null;
|
||||
switch (data.interfaceType) {
|
||||
case 'OSM': {
|
||||
let source = new OSM();
|
||||
@@ -314,8 +312,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
return layer;
|
||||
}
|
||||
|
||||
createLayer(itemLayer: IItemLayer): Layer<Source> {
|
||||
var layer: Layer<Source> = null;
|
||||
createLayer(itemLayer: IItemLayer): Layer {
|
||||
var layer: Layer = null;
|
||||
var layerIndex = -1;
|
||||
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
||||
layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
|
||||
@@ -362,7 +360,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
}
|
||||
}
|
||||
|
||||
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> {
|
||||
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer {
|
||||
if(!itemLayer) return null;
|
||||
var olLayers = this.instance.getLayers();
|
||||
var layer = itemLayer.layer;
|
||||
@@ -387,7 +385,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
}
|
||||
|
||||
updateLayers(itemLayers: IItemLayer[]) {
|
||||
let newLayers: Layer<Source>[] = [];
|
||||
let newLayers: IItemLayer[] = [];
|
||||
if (itemLayers) {
|
||||
itemLayers.forEach((itemLayer, index) => {
|
||||
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
||||
|
@@ -3,15 +3,14 @@ import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-o
|
||||
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
|
||||
|
||||
import { Feature } from 'ol';
|
||||
import { Point,Geometry } from 'ol/geom';
|
||||
import { Point } from 'ol/geom';
|
||||
import { MapBrowserEvent } from 'ol';
|
||||
import { Types } from 'ol/MapBrowserEventType';
|
||||
import * as style from 'ol/style';
|
||||
import * as color from 'ol/color';
|
||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
||||
import * as condition from 'ol/events/condition';
|
||||
import * as extent from 'ol/extent';
|
||||
import {Vector,Cluster,Source} from 'ol/source';
|
||||
import {Vector,Cluster} from 'ol/source';
|
||||
import {Layer} from 'ol/layer';
|
||||
import {GeoJSON} from 'ol/format';
|
||||
import {Select} from 'ol/interaction';
|
||||
@@ -26,17 +25,17 @@ import {FeatureIconService} from '../../../services/feature-icon.service';
|
||||
]
|
||||
})
|
||||
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
|
||||
instance: Vector<Geometry>;
|
||||
instance: Vector;
|
||||
private _format: GeoJSON;
|
||||
private _select: Select;
|
||||
private _hoverSelect: Select;
|
||||
private _iconScale: number = 0.05;
|
||||
@Input() features: Array<Feature<Geometry>>;
|
||||
@Input() selectedFeature: Feature<Geometry>;
|
||||
@Input() features: Array<Feature>;
|
||||
@Input() selectedFeature: Feature;
|
||||
@Input() selectedItem: IItem;
|
||||
@Input() styles:IStyles;
|
||||
@Output() onFeatureSelected: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
|
||||
@Output() onFeatureHover: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
|
||||
@Output() onFeatureSelected: EventEmitter<Feature> = new EventEmitter<Feature>();
|
||||
@Output() onFeatureHover: EventEmitter<Feature> = new EventEmitter<Feature>();
|
||||
private stylesCache:IStyles = {};
|
||||
|
||||
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
|
||||
@@ -44,7 +43,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
this._format = new GeoJSON();
|
||||
}
|
||||
|
||||
geometry(feature: Feature<Geometry>) {
|
||||
geometry(feature: Feature) {
|
||||
let view = this.map.instance.getView();
|
||||
let resolution = view.getResolution();
|
||||
var geometry = feature.getGeometry();
|
||||
@@ -56,9 +55,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
return geometry;
|
||||
}
|
||||
|
||||
getSelectedStyle(feature:Feature<Geometry>):style.Style {
|
||||
getSelectedStyle(feature:Feature):style.Style {
|
||||
let key = feature.get('itemType')+"_selected";
|
||||
let evaluatedStyle: style.Style =undefined;
|
||||
let evaluatedStyle =null;
|
||||
var styleEntry = this.stylesCache[key];
|
||||
if(styleEntry) {
|
||||
if(typeof styleEntry === 'function') {
|
||||
@@ -67,12 +66,12 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
evaluatedStyle = styleEntry;
|
||||
}
|
||||
} else {
|
||||
evaluatedStyle = this.stylesCache["selected"] as style.Style;
|
||||
evaluatedStyle = this.stylesCache["selected"];
|
||||
}
|
||||
if(evaluatedStyle ) {
|
||||
evaluatedStyle .setGeometry((feature:Feature<Geometry>) => this.geometry(feature));
|
||||
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
|
||||
}
|
||||
return evaluatedStyle as style.Style
|
||||
return evaluatedStyle
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -81,17 +80,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
this._select = new Select({
|
||||
style:null,
|
||||
hitTolerance: 10,
|
||||
layers: [this.layer.instance as Layer<Source>]
|
||||
layers: [this.layer.instance as Layer]
|
||||
});
|
||||
this._hoverSelect = new Select({
|
||||
style: (feature:Feature<Geometry>) => {
|
||||
style: (feature) => {
|
||||
return this.getSelectedStyle(feature);
|
||||
},
|
||||
hitTolerance: 10,
|
||||
condition: (e: MapBrowserEvent<UIEvent>) => {
|
||||
condition: (e: MapBrowserEvent) => {
|
||||
return e.type == 'pointermove';
|
||||
},
|
||||
layers: [this.layer.instance as Layer<Source>]
|
||||
layers: [this.layer.instance as Layer]
|
||||
});
|
||||
this.map.instance.addInteraction(this._select);
|
||||
this.map.instance.addInteraction(this._hoverSelect);
|
||||
@@ -133,7 +132,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
fill: new style.Fill({
|
||||
color: fillColor
|
||||
}),
|
||||
geometry:(feature:Feature<Geometry>) => this.geometry(feature)
|
||||
geometry:(feature) => this.geometry(feature)
|
||||
});
|
||||
} else {
|
||||
key = 'file';
|
||||
|
@@ -13,7 +13,7 @@
|
||||
</span>
|
||||
<a href="#" title="Zoom to extent" class="btn btn-light btn-sm" (click)="handleZoomToExtent($event,itemLayer)"><i class="far fa-search-plus" aria-hidden="true"></i></a>
|
||||
<span *ngIf="firstLayer(itemLayer)"><a href="#" title="Toggle legend" class="btn btn-light btn-sm" (click)="itemLayer.legendVisible=toggleLegend($event,itemLayer.legendVisible)"><i class="far fa-chart-bar" aria-hidden="true"></i></a></span>
|
||||
<span *ngIf="!dataLayers" class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fas fa-layer-minus" aria-hidden="true"></i></a></span>
|
||||
<span class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fas fa-layer-minus" aria-hidden="true"></i></a></span>
|
||||
</div>
|
||||
<div *ngIf="itemLayer.legendVisible">
|
||||
<div class="card legend">
|
||||
|
@@ -10,7 +10,6 @@ import { IItemLayer } from '../../../models/item.layer';
|
||||
export class LayerListComponent {
|
||||
@Input() itemLayers: IItemLayer[] = [];
|
||||
@Input() baseLayers: boolean = false;
|
||||
@Input() dataLayers: boolean = false;
|
||||
@Output() onToggleVisibility = new EventEmitter<IItemLayer>();
|
||||
@Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>();
|
||||
@Output() onDelete = new EventEmitter<IItemLayer>();
|
||||
|
@@ -1,8 +1,9 @@
|
||||
import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { LayerVectorComponent, MapComponent } from 'ngx-openlayers';
|
||||
import RenderType from 'ol/layer/Vector';
|
||||
import { Vector as VectorSource } from 'ol/source';
|
||||
import { Geometry } from 'ol/geom';
|
||||
import { Component, OnDestroy, OnInit, Input, Optional, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { Vector } from 'ol/layer';
|
||||
import { Style } from 'ol/style';
|
||||
import { StyleFunction } from 'ol/style/Style';
|
||||
import { LayerVectorComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
|
||||
import { RenderType } from 'ol/layer/Vector';
|
||||
|
||||
@Component({
|
||||
selector: 'fm-map-aol-layer-vector-image',
|
||||
@@ -11,10 +12,10 @@ import { Geometry } from 'ol/geom';
|
||||
`,
|
||||
})
|
||||
export class LayerVectorImageComponent extends LayerVectorComponent implements OnInit, OnDestroy, OnChanges {
|
||||
//public source: Vector;
|
||||
public source: Vector;
|
||||
|
||||
@Input()
|
||||
renderMode: RenderType<VectorSource<Geometry>> | string = "image";
|
||||
renderMode: RenderType | string = "image";
|
||||
|
||||
constructor(map: MapComponent) {
|
||||
super(map);
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject} from '@angular/core';
|
||||
import { Feature } from 'ol';
|
||||
import { Geometry} from 'ol/geom';
|
||||
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
|
||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||
import {IQueryState,PackageService } from '@farmmaps/common';
|
||||
@@ -21,10 +20,10 @@ export class FeatureListContainerComponent {
|
||||
this.featureLists = [...this.featureLists].reverse();
|
||||
}
|
||||
|
||||
@Input() features: Array<Feature<Geometry>>
|
||||
@Input() features: Array<Feature>
|
||||
@Input() queryState: IQueryState;
|
||||
@Input() selectedFeature: Feature<Geometry>;
|
||||
@Input() clickedFeature:Observable<Feature<Geometry>>;
|
||||
@Input() selectedFeature: Feature;
|
||||
@Input() clickedFeature:Observable<Feature>;
|
||||
|
||||
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||
componentRef:any;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<div class="card border-0">
|
||||
<div class="card-body">
|
||||
<fm-back-button></fm-back-button>
|
||||
<h3><i class="far fa-farm"></i> <span i18n>Farms</span></h3>
|
||||
<h3><i class="fm fm-farm"></i> <span i18n>Farms</span></h3>
|
||||
<div *ngIf="features;let features">
|
||||
<div class="farms">
|
||||
<div class="row m-0 pl-3 pr-3" *ngFor="let feature of features"[ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
||||
|
@@ -9,7 +9,6 @@ import * as mapActions from '../../actions/map.actions';
|
||||
import { tassign } from 'tassign';
|
||||
import { Router } from '@angular/router';
|
||||
import { Feature } from 'ol';
|
||||
import { Geometry} from 'ol/geom';
|
||||
|
||||
@ForItemType("vnd.farmmaps.itemtype.croppingscheme")
|
||||
@Injectable()
|
||||
@@ -24,7 +23,7 @@ export class FeatureListCroppingschemeComponent extends AbstractFeatureListCompo
|
||||
super(store, itemTypeService, location);
|
||||
}
|
||||
|
||||
getAction(feature:Feature<Geometry>):Action {
|
||||
getAction(feature:Feature):Action {
|
||||
var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
|
||||
return new mapActions.DoQuery(queryState);
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
||||
import { Feature } from 'ol';
|
||||
import { Geometry } from 'ol/geom';
|
||||
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||
|
||||
@@ -19,7 +18,7 @@ export class FeatureListFeatureContainerComponent {
|
||||
this.featureLists = [...this.featureLists].reverse();
|
||||
}
|
||||
|
||||
@Input() feature: Feature<Geometry>;
|
||||
@Input() feature: Feature;
|
||||
|
||||
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
|
||||
import { Feature } from 'ol';
|
||||
import { Geometry } from 'ol/geom';
|
||||
import { Store } from '@ngrx/store';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||
@@ -24,11 +23,11 @@ export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFea
|
||||
super(store, itemTypeService,config);
|
||||
}
|
||||
|
||||
areaInHa(feature:Feature<Geometry>):number {
|
||||
areaInHa(feature:Feature):number {
|
||||
if(!feature) return 0;
|
||||
// get area from faeture if 0 calculate from polygon
|
||||
let a = feature.get('area');
|
||||
if(a) return a;
|
||||
return getArea(feature.getGeometry(),{projection:"EPSG:3857"}) / 10000;
|
||||
return getArea(feature.getGeometry(),{projectio:"EPSG:3857"}) / 10000;
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { Component, Input, Injectable,Directive} from '@angular/core';
|
||||
import { Feature } from 'ol';
|
||||
import { Geometry } from 'ol/geom';
|
||||
import { Store } from '@ngrx/store';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||
@@ -10,7 +9,7 @@ import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||
@Injectable()
|
||||
@Directive()
|
||||
export abstract class AbstractFeatureListFeatureComponent {
|
||||
@Input() feature: Feature<Geometry>
|
||||
@Input() feature: Feature
|
||||
|
||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { Feature } from 'ol';
|
||||
import { Geometry} from 'ol/geom';
|
||||
import { Store,Action} from '@ngrx/store';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
||||
@@ -15,20 +14,20 @@ import { IQueryState } from '@farmmaps/common';
|
||||
@Injectable()
|
||||
@Directive()
|
||||
export abstract class AbstractFeatureListComponent {
|
||||
@Input() features: Array<Feature<Geometry>>;
|
||||
@Input() features: Array<Feature>;
|
||||
@Input() queryState: IQueryState;
|
||||
@Input() selectedFeature: Feature<Geometry>;
|
||||
@Input() selectedFeature: Feature;
|
||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
||||
}
|
||||
|
||||
handleFeatureClick(feature:Feature<Geometry>) {
|
||||
handleFeatureClick(feature:Feature) {
|
||||
if(feature) {
|
||||
let action = this.getAction(feature);
|
||||
this.store.dispatch(action);
|
||||
}
|
||||
}
|
||||
|
||||
getAction(feature:Feature<Geometry>):Action {
|
||||
getAction(feature:Feature):Action {
|
||||
var newQuery: any = tassign(mapReducers.initialState.queryState);
|
||||
newQuery.parentCode = feature.get('parentCode');
|
||||
newQuery.itemCode = feature.get('code');
|
||||
@@ -49,7 +48,7 @@ export abstract class AbstractFeatureListComponent {
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
isFeatureSelected(feature:Feature<Geometry>):boolean {
|
||||
isFeatureSelected(feature:Feature):boolean {
|
||||
if(!this.selectedFeature) return false;
|
||||
return feature.getId() == this.selectedFeature.getId();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Component, Input, AfterViewInit, ViewChild } from '@angular/core';
|
||||
import { Feature} from 'ol';
|
||||
import { Geometry,Polygon,MultiPolygon } from 'ol/geom';
|
||||
import { Geometry } from 'ol/geom';
|
||||
import * as extent from 'ol/extent';
|
||||
import * as render from 'ol/render';
|
||||
import * as style from 'ol/style';
|
||||
@@ -19,7 +19,7 @@ export class GeometryThumbnailComponent implements AfterViewInit {
|
||||
@ViewChild('container') container;
|
||||
|
||||
private geometry:Geometry = null;
|
||||
@Input() set feature(value:Feature<Geometry>) {
|
||||
@Input() set feature(value:Feature) {
|
||||
if(value) {
|
||||
this.geometry = value.getGeometry();
|
||||
} else {
|
||||
@@ -59,7 +59,7 @@ export class GeometryThumbnailComponent implements AfterViewInit {
|
||||
if(canvas && canvas.nativeElement && geometry && style) {
|
||||
let renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] });
|
||||
|
||||
let geom = geometry.clone() as Polygon,
|
||||
let geom = geometry.clone(),
|
||||
line = geom.getCoordinates()[0],
|
||||
e = extent.boundingExtent( line );
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core';
|
||||
import { Layer } from 'ol/layer';
|
||||
import { Source } from 'ol/source';
|
||||
import { layer } from 'ol';
|
||||
import { MapComponent } from 'ngx-openlayers';
|
||||
|
||||
@Directive({
|
||||
@@ -8,7 +7,7 @@ import { MapComponent } from 'ngx-openlayers';
|
||||
})
|
||||
export class ifZoomToShowDirective implements OnInit {
|
||||
@Input()
|
||||
set fmMapIfZoomToShow(layer:Layer<Source>) {
|
||||
set fmMapIfZoomToShow(layer:layer) {
|
||||
this.layer$=layer;
|
||||
this.checkZoom();
|
||||
}
|
||||
@@ -25,7 +24,7 @@ export class ifZoomToShowDirective implements OnInit {
|
||||
this.checkZoom();
|
||||
}
|
||||
|
||||
private layer$:Layer<Source>;
|
||||
private layer$:layer;
|
||||
private thenTemplate$:TemplateRef<any>;
|
||||
private elseTemplate$:TemplateRef<any>;
|
||||
private showView = false;
|
||||
|
@@ -19,13 +19,6 @@
|
||||
<fm-map-layer-list [itemLayers]="overlayLayers|async" [selectedLayer]="selectedOverlayLayer|async" (onDelete)="handleOnDelete($event)" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item py-0" *ngIf="selectedItemLayer$ | async as selectedItemLayer">
|
||||
<span><i class="fal fa-layer-group" aria-hidden="true"></i> <span i18n>Data</span></span>
|
||||
<div class="mb-4">
|
||||
<fm-map-layer-list [dataLayers]="true" [itemLayers]="[selectedItemLayer]" [selectedLayer]="selectedItemLayer" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -16,7 +16,6 @@ export class LayerSwitcher implements OnInit,OnChanges{
|
||||
public showLayerSwitcher:Observable<boolean>;
|
||||
public overlayLayers: Observable<Array<IItemLayer>>;
|
||||
public selectedOverlayLayer: Observable<IItemLayer>;
|
||||
public selectedItemLayer$: Observable<IItemLayer>;
|
||||
public baseLayers: Observable<Array<IItemLayer>>;
|
||||
public selectedBaseLayer: Observable<IItemLayer>;
|
||||
|
||||
@@ -28,7 +27,6 @@ export class LayerSwitcher implements OnInit,OnChanges{
|
||||
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
||||
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
|
||||
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
|
||||
this.selectedItemLayer$ = this.store.select(mapReducers.selectGetSelectedItemLayer)
|
||||
this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<ng-template #rt let-r="result" let-t="term">
|
||||
<i [class]="getIcon(r.type)" aria-hidden="true" style="width:2rem"></i>
|
||||
<i class="fal fa-search" aria-hidden="true" style="width:2rem"></i>
|
||||
<ngb-highlight [result]="formatter(r)" [term]="t"></ngb-highlight>
|
||||
</ng-template>
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core';
|
||||
import { Observable , of,merge,forkJoin } from 'rxjs';
|
||||
import { debounceTime,distinctUntilChanged,tap,switchMap,catchError,map} from 'rxjs/operators';
|
||||
import { Observable , of } from 'rxjs';
|
||||
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
|
||||
import { TypeaheadService, TimespanService } from '@farmmaps/common';
|
||||
import { IQueryState } from '@farmmaps/common';
|
||||
import { IPeriodState } from '../../models/period.state';
|
||||
@@ -26,8 +26,7 @@ export class MapSearchComponent {
|
||||
this.periodLocal = tassign(this.periodLocal,{startDate: period.startDate,endDate:period.endDate});
|
||||
this.startEndCaption = this.timespanService.getCaption(period.startDate, period.endDate, 4)
|
||||
}
|
||||
@Output() onSearch = new EventEmitter<IQueryState>()
|
||||
@Output() onCitySearch = new EventEmitter<string>()
|
||||
@Output() onSearch = new EventEmitter<IQueryState>();
|
||||
@Output() onClear = new EventEmitter<any>();
|
||||
@Output() onSearchCollapse = new EventEmitter<any>();
|
||||
@Output() onSearchExpand = new EventEmitter<any>();
|
||||
@@ -74,23 +73,16 @@ export class MapSearchComponent {
|
||||
text$.pipe(
|
||||
debounceTime(300),
|
||||
distinctUntilChanged(),
|
||||
tap(() => {this.searching = true;this.searchFailed=false;}),
|
||||
tap(() => this.searching = true),
|
||||
switchMap(term => term.length < 1 ? of([]) :
|
||||
forkJoin(
|
||||
this.typeaheadService.getTagTypeaheadItems(term).pipe(
|
||||
this.typeaheadService.getSearchTypeaheadItems(term).pipe(
|
||||
tap(() => this.searchFailed = false),
|
||||
catchError(() => {
|
||||
this.searchFailed = true;
|
||||
return of([]);
|
||||
}),map( (sa:string[]) => sa.map((s,i) => ({"name":s,"type":"tag"})))),
|
||||
this.typeaheadService.getCityTypeaheadItems(term).pipe(
|
||||
catchError(() => {
|
||||
this.searchFailed = true;
|
||||
return of([]);
|
||||
}),map( (sa:string[]) => sa.map((s,i) => ({"name":s,"type":"city"})))),
|
||||
).pipe(map(([a1,a2]) => [...a1, ...a2] ),map(a => a.sort((a, b) => (a.name.toUpperCase() > b.name.toUpperCase()) ? 1 : -1)))
|
||||
),
|
||||
})) ),
|
||||
tap(() => this.searching = false),
|
||||
);
|
||||
merge(this.hideSearchingWhenUnsubscribed));
|
||||
|
||||
formatter = (x: { name: string }) => x.name;
|
||||
|
||||
@@ -117,7 +109,6 @@ export class MapSearchComponent {
|
||||
}
|
||||
|
||||
handleSelect(event) {
|
||||
if(event.item.type == "tag") {
|
||||
event.preventDefault();
|
||||
this.filterOptionsLocal.query = null;
|
||||
this.filterOptionsLocal.itemType = null;
|
||||
@@ -130,10 +121,6 @@ export class MapSearchComponent {
|
||||
}
|
||||
this.onSearch.emit(this.filterOptionsLocal);
|
||||
this.searchTextLocal = { name: this.filterOptionsLocal.tags };
|
||||
} else if (event.item.type == "city") {
|
||||
this.clearEnabled = true;
|
||||
this.onCitySearch.emit(event.item.name);
|
||||
}
|
||||
}
|
||||
|
||||
handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
|
||||
@@ -190,15 +177,5 @@ export class MapSearchComponent {
|
||||
handleClearClick(event) {
|
||||
this.onClear.emit({});
|
||||
}
|
||||
|
||||
getIcon(type):string {
|
||||
if(type == "tag")
|
||||
return "fal fa-tag";
|
||||
else if(type == "city")
|
||||
return "fal fa-map-marker-alt";
|
||||
else if(type == "search")
|
||||
return "fal fa-search";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@
|
||||
<fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
|
||||
|
||||
<div *ngIf="noContent">
|
||||
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period" (onPeriodChange)="handlePeriodChange($event)" (onCitySearch)="handleCitySearch($event)"></fm-map-map-search>
|
||||
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period" (onPeriodChange)="handlePeriodChange($event)"></fm-map-map-search>
|
||||
</div>
|
||||
<div class="side-panel-container">
|
||||
<fm-side-panel [resizeable]="true" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false">
|
||||
|
@@ -21,7 +21,6 @@ import {IStyles} from '../../models/style.cache';
|
||||
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
||||
import { StateSerializerService } from '@farmmaps/common';
|
||||
import { GeolocationService} from '../../services/geolocation.service';
|
||||
import { GeolocatorService } from '@farmmaps/common';
|
||||
import {DeviceOrientationService} from '../../services/device-orientation.service';
|
||||
|
||||
// AppCommon
|
||||
@@ -31,7 +30,6 @@ import {commonReducers} from '@farmmaps/common';
|
||||
import {commonActions} from '@farmmaps/common';
|
||||
|
||||
import {Feature} from 'ol';
|
||||
import {Geometry,Point,Circle} from 'ol/geom';
|
||||
import {Extent,createEmpty,extend } from 'ol/extent';
|
||||
import {transform} from 'ol/proj';
|
||||
import { tassign } from 'tassign';
|
||||
@@ -49,7 +47,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
|
||||
public itemTypes$: Observable<{ [id: string]: IItemType }>;
|
||||
public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
|
||||
public features$: Observable<Array<Feature<Geometry>>> = this.store.select(mapReducers.selectGetFeatures);
|
||||
public features$: Observable<Array<Feature>> = this.store.select(mapReducers.selectGetFeatures);
|
||||
public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
|
||||
public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
||||
public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
|
||||
@@ -66,8 +64,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
|
||||
public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
|
||||
public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
|
||||
public selectedFeature$: Observable<Feature<Geometry>> = this.store.select(mapReducers.selectGetSelectedFeature);
|
||||
public clickedFeature: Subject<Feature<Geometry>> = new Subject<Feature<Geometry>>();
|
||||
public selectedFeature$: Observable<Feature> = this.store.select(mapReducers.selectGetSelectedFeature);
|
||||
public clickedFeature: Subject<Feature> = new Subject<Feature>();
|
||||
public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
|
||||
public parentItem$: Observable<IItem> =this.store.select(mapReducers.selectGetParentItem);
|
||||
public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
|
||||
@@ -102,7 +100,6 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
public itemTypeService: ItemTypeService,
|
||||
private location: Location,
|
||||
private geolocationService: GeolocationService,
|
||||
private geolocaterService: GeolocatorService,
|
||||
private zone: NgZone,
|
||||
private deviceorientationService:DeviceOrientationService,
|
||||
public devicesService:DeviceService) {
|
||||
@@ -167,11 +164,11 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
|
||||
}
|
||||
|
||||
handleFeatureClick(feature: Feature<Geometry>) {
|
||||
handleFeatureClick(feature: Feature) {
|
||||
this.clickedFeature.next(feature);
|
||||
}
|
||||
|
||||
handleFeatureHover(feature: Feature<Geometry>) {
|
||||
handleFeatureHover(feature: Feature) {
|
||||
this.store.dispatch(new mapActions.SelectFeature(feature));
|
||||
}
|
||||
|
||||
@@ -454,19 +451,6 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
this.store.dispatch(new mapActions.SetPeriod(period));
|
||||
}
|
||||
|
||||
handleCitySearch(location:string) {
|
||||
this.geolocaterService.geocode(location).subscribe(locations => {
|
||||
if( locations.length > 0) {
|
||||
let point = new Point([locations[0].coordinates.lon,locations[0].coordinates.lat]);
|
||||
point.transform('EPSG:4326', 'EPSG:3857');
|
||||
let circle = new Circle(point.getCoordinates(),5000);//
|
||||
let extent = createEmpty();
|
||||
extend(extent, circle.getExtent());
|
||||
this.store.dispatch(new mapActions.SetExtent(extent))
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.paramSub) this.paramSub.unsubscribe();
|
||||
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
|
||||
|
@@ -1,15 +1,14 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Layer } from 'ol/layer';
|
||||
import { Source } from 'ol/source';
|
||||
import { layer } from 'ol';
|
||||
|
||||
@Component({
|
||||
selector: 'fm-map-zoom-to-show-alert',
|
||||
template: '<div *fmMapIfZoomToShow="layer$" class="alert alert-info"><i class="fas fa-search-plus" aria-hidden="true" i18n-title title="Add as layer"></i> <span i18n>Zoom in to show layer</span></div>'
|
||||
})
|
||||
export class ZoomToShowAlert {
|
||||
public layer$: Layer<Source>;
|
||||
public layer$: layer;
|
||||
@Input()
|
||||
set layer(layer:Layer<Source>) {
|
||||
set layer(layer:layer) {
|
||||
this.layer$ = layer;
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/opera
|
||||
import {GeoJSON,WKT} from 'ol/format';
|
||||
import {Feature} from 'ol';
|
||||
import { getCenter,createEmpty,extend } from 'ol/extent';
|
||||
import {Point,Geometry} from 'ol/geom'
|
||||
import {Point} from 'ol/geom'
|
||||
|
||||
|
||||
import * as mapActions from '../actions/map.actions';
|
||||
@@ -50,7 +50,7 @@ export class MapEffects {
|
||||
private _wktFormat: WKT;
|
||||
private overrideSelectedItemLayer: boolean = false;
|
||||
|
||||
private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> {
|
||||
private updateFeatureGeometry(feature:Feature, updateEvent:commonActions.DeviceUpdateEvent): Feature {
|
||||
let newFeature = feature.clone();
|
||||
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
||||
dataProjection: 'EPSG:4326',
|
||||
@@ -153,7 +153,7 @@ export class MapEffects {
|
||||
if (!action.query.bboxFilter) {
|
||||
if (extent) {
|
||||
for (let f of action.features) {
|
||||
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
|
||||
extend(extent, (f as Feature).getGeometry().getExtent());
|
||||
}
|
||||
if(action.features && action.features.length >0) {
|
||||
actions.push(new mapActions.SetExtent(extent));
|
||||
@@ -169,7 +169,7 @@ export class MapEffects {
|
||||
let extent = createEmpty();
|
||||
if (extent) {
|
||||
for (let f of action.features) {
|
||||
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
|
||||
extend(extent, (f as Feature).getGeometry().getExtent());
|
||||
}
|
||||
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
|
||||
}
|
||||
@@ -256,7 +256,7 @@ export class MapEffects {
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
|
||||
mergeMap(([action, features]) => {
|
||||
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
|
||||
var feature: Feature<Geometry> = null;
|
||||
var feature: Feature = null;
|
||||
for (let f of features) {
|
||||
if (f.getId() == deviceUpdateEventAction.itemCode) {
|
||||
feature = f;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
import { IItem,IListItem } from '@farmmaps/common';
|
||||
import {Layer} from 'ol/layer';
|
||||
import { Source } from 'ol/source';
|
||||
|
||||
export interface IItemLayer {
|
||||
item: IItem,
|
||||
layer: Layer<Source>,
|
||||
layer: Layer,
|
||||
visible: boolean,
|
||||
legendVisible:boolean,
|
||||
projection: string,
|
||||
@@ -14,7 +13,7 @@ export interface IItemLayer {
|
||||
|
||||
export class ItemLayer implements IItemLayer {
|
||||
public item: IItem;
|
||||
public layer: Layer<Source> = null;
|
||||
public layer: Layer = null;
|
||||
public visible: boolean = true;
|
||||
public legendVisible: boolean = false;
|
||||
public projection: string;
|
||||
|
@@ -1,7 +1,5 @@
|
||||
import {Feature} from 'ol';
|
||||
import { Style } from 'ol/style';
|
||||
import {Geometry } from 'ol/geom';
|
||||
import {Style,Feature} from 'ol';
|
||||
|
||||
export interface IStyles{
|
||||
[id: string]: Style | ((featue:Feature<Geometry>) => Style);
|
||||
[id: string]: Style | (Feature);
|
||||
};
|
@@ -11,7 +11,6 @@ import {commonActions} from '@farmmaps/common';
|
||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
||||
|
||||
import {Feature} from 'ol';
|
||||
import {Geometry} from 'ol/geom';
|
||||
|
||||
|
||||
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
|
||||
@@ -46,10 +45,10 @@ export interface State {
|
||||
queryState: IQueryState,
|
||||
query:IQuery,
|
||||
parentCode: string,
|
||||
features: Array<Feature<Geometry>>,
|
||||
features: Array<Feature>,
|
||||
panelVisible: boolean,
|
||||
panelCollapsed: boolean,
|
||||
selectedFeature: Feature<Geometry>,
|
||||
selectedFeature: Feature,
|
||||
selectedItem:IItem,
|
||||
parentItem:IItem,
|
||||
clearEnabled: boolean,
|
||||
@@ -385,26 +384,18 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
||||
}
|
||||
case mapActions.SETVISIBILITY: {
|
||||
let a = action as mapActions.SetVisibility;
|
||||
if(state.selectedItemLayer == a.itemLayer) {
|
||||
return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{visible:a.visibility})});
|
||||
} else {
|
||||
let newLayers = state.overlayLayers.slice(0);
|
||||
let i = state.overlayLayers.indexOf(a.itemLayer);
|
||||
newLayers[i].visible = a.visibility;
|
||||
return tassign(state, { overlayLayers: newLayers });
|
||||
}
|
||||
}
|
||||
case mapActions.SETOPACITY: {
|
||||
let a = action as mapActions.SetOpacity;
|
||||
if(state.selectedItemLayer == a.itemLayer) {
|
||||
return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{opacity:a.opacity})});
|
||||
} else {
|
||||
let newLayers = state.overlayLayers.slice(0);
|
||||
let i = state.overlayLayers.indexOf(a.itemLayer);
|
||||
newLayers[i].opacity = a.opacity;
|
||||
return tassign(state, { overlayLayers: newLayers });
|
||||
}
|
||||
}
|
||||
case mapActions.SETLAYERINDEX: {
|
||||
let a = action as mapActions.SetLayerIndex;
|
||||
if (a.itemLayer == null) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'core-js/es7/reflect';
|
||||
import 'zone.js';
|
||||
import 'zone.js/testing';
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
|
@@ -22,7 +22,8 @@
|
||||
"strictMetadataEmit": true,
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"enableResourceInlining": true
|
||||
"enableResourceInlining": true,
|
||||
"enableIvy": false
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
|
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"esModuleInterop": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2018"
|
||||
],
|
||||
"paths": {
|
||||
"@angular/*": [
|
||||
|
||||
"node_modules/@angular/*"
|
||||
|
||||
]
|
||||
}
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"enableResourceInlining": true,
|
||||
"compilationMode": "partial"
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "@farmmaps/common-map3d",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.0",
|
||||
"publishConfig": {
|
||||
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/common": "~12.2.8",
|
||||
"@angular/core": "~12.2.8",
|
||||
"ngx-openlayers": "1.0.0-next.19",
|
||||
"cesium": "^1.82.1",
|
||||
"ol-cesium": "^2.13.0"
|
||||
"@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"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js';
|
||||
import 'zone.js/testing';
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
|
@@ -22,7 +22,8 @@
|
||||
"strictMetadataEmit": true,
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"enableResourceInlining": true
|
||||
"enableResourceInlining": true,
|
||||
"enableIvy": false
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
|
@@ -1,40 +1,10 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"esModuleInterop": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2018"
|
||||
],
|
||||
"paths": {
|
||||
"@angular/*": [
|
||||
|
||||
"node_modules/@angular/*"
|
||||
|
||||
]
|
||||
}
|
||||
"declarationMap": false
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"enableResourceInlining": true,
|
||||
"compilationMode": "partial"
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
"my-data": "my-data"
|
||||
}
|
||||
},
|
||||
"allowedNonPeerDependencies": [
|
||||
"whitelistedNonPeerDependencies": [
|
||||
"."
|
||||
]
|
||||
}
|
@@ -1,22 +1,22 @@
|
||||
{
|
||||
"name": "@farmmaps/common",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.0",
|
||||
"publishConfig": {
|
||||
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ng-bootstrap/ng-bootstrap": "^7.0",
|
||||
"@angular/common": "~12.2.8",
|
||||
"@angular/core": "~12.2.8",
|
||||
"@angular/forms": "~12.2.8",
|
||||
"@ngrx/effects": "^12.0",
|
||||
"@ngrx/router-store": "^12.0",
|
||||
"@ngrx/store": "^12.0",
|
||||
"@angular/common": "~10.2.4",
|
||||
"@angular/core": "~10.2.4",
|
||||
"@angular/forms": "~10.2.4",
|
||||
"@ngrx/effects": "^10.0",
|
||||
"@ngrx/router-store": "^10.0",
|
||||
"@ngrx/store": "^10.0",
|
||||
"tassign": "^1.0.0",
|
||||
"bootstrap": "^4.4.1",
|
||||
"@microsoft/signalr": "^3.1.3",
|
||||
"ngx-uploadx": "^3.3.4",
|
||||
"angular-oauth2-oidc": "^12.0",
|
||||
"angular-oauth2-oidc": "^10.0.3",
|
||||
"moment": "^2.27.0",
|
||||
"ngx-avatar": "^4.0.0",
|
||||
"ngx-image-cropper": "^3.3.5",
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// angular modules
|
||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf,InjectionToken } from '@angular/core';
|
||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
|
||||
import { CommonModule, DatePipe } from '@angular/common';
|
||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
@@ -66,7 +66,6 @@ import { AvatarComponent } from './components/avatar/avatar.component';
|
||||
import { AvatarModule } from 'ngx-avatar';
|
||||
import { ImageCropperModule } from 'ngx-image-cropper';
|
||||
|
||||
export const FM_COMMON_STARTPAGE = new InjectionToken<string>('fm-common-startpage');
|
||||
|
||||
export {
|
||||
SafePipe,
|
||||
@@ -111,9 +110,7 @@ export {
|
||||
IGradientstop,
|
||||
BackButtonComponent,
|
||||
AvatarComponent,
|
||||
EditImageModalComponent,
|
||||
GradientComponent,
|
||||
GradientSelectComponent
|
||||
EditImageModalComponent
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<button type="button" class="btn btn-outline-secondary apponly" (click)="handleToggleMenu($event)"><i class="fal fa-bars" aria-hidden="true"></i></button>
|
||||
<router-outlet name="menu" class="ml-4"></router-outlet>
|
||||
<div class="collapse navbar-collapse pageonly">
|
||||
<a class="btn btn-primary ml-auto" role="button" [routerLink]="[ startPage == null?'/map':startPage]">
|
||||
<a class="btn btn-primary ml-auto" role="button" [routerLink]="['/map']">
|
||||
<span *ngIf="(user|async)==null" i18n>Sign in</span>
|
||||
<span *ngIf="(user|async)!=null" i18n>To app</span>
|
||||
</a>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, OnDestroy, Inject, Optional,ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
|
||||
import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
|
||||
import { Meta, Title, MetaDefinition } from '@angular/platform-browser'; import { DOCUMENT } from "@angular/common";
|
||||
import { Subscription, Observable } from 'rxjs';
|
||||
@@ -6,7 +6,6 @@ import { distinctUntilChanged } from 'rxjs/operators';
|
||||
import { Store, Action } from '@ngrx/store';
|
||||
import { IUser } from '../../models/user';
|
||||
import { OAuthService, OAuthErrorEvent } from 'angular-oauth2-oidc';
|
||||
import { FM_COMMON_STARTPAGE} from '../../common.module';
|
||||
|
||||
//AppCommon
|
||||
import { IEventMessage } from '../../models/event.message';
|
||||
@@ -52,7 +51,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
@Input() showUploadProgress: boolean = true;
|
||||
|
||||
constructor(
|
||||
@Optional() @Inject(FM_COMMON_STARTPAGE) public startPage: string,
|
||||
public router: Router,
|
||||
private activatedRoute$: ActivatedRoute,
|
||||
private title$: Title,
|
||||
|
@@ -58,13 +58,13 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
||||
case appCommonActions.INITUSERSUCCESS: {
|
||||
let a = action as appCommonActions.InitUserSuccess;
|
||||
let claims = {}
|
||||
Object.getOwnPropertyNames(a.userinfo.info).forEach((k) => {
|
||||
Object.getOwnPropertyNames(a.userinfo).forEach((k) => {
|
||||
claims[k] = a.userinfo[k];
|
||||
});
|
||||
var user:IUser = {
|
||||
code:a.user.code,
|
||||
email:claims["email"]!== undefined ? claims["email"] : a.user.name,
|
||||
name:claims["name"]!== undefined?claims["name"] : a.user.email,
|
||||
email:a.userinfo["email"],
|
||||
name:a.userinfo["name"],
|
||||
claims:claims,
|
||||
searchable: false
|
||||
};
|
||||
|
@@ -24,7 +24,7 @@ export class ItemService {
|
||||
return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`);
|
||||
}
|
||||
|
||||
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number,indexed?:boolean): Observable<any> {
|
||||
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number): Observable<any> {
|
||||
var params = new HttpParams();
|
||||
params = params.append("crs", crs);
|
||||
if (extent) params =params.append("bbox", extent.join(","));
|
||||
@@ -42,7 +42,6 @@ export class ItemService {
|
||||
if (parentCode) params = params.append("pc", parentCode);
|
||||
if (dataFilter) params = params.append("df", dataFilter);
|
||||
if (level) params = params.append("lvl", level.toString());
|
||||
params = params.append("ind", indexed ?? true);
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
|
||||
}
|
||||
|
||||
|
@@ -55,5 +55,4 @@ export function isValidPackage(pack: IPackage): boolean {
|
||||
const utcToday = Date.UTC(now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate());
|
||||
return pack !== null && new Date(pack.dataDate).getTime() <= utcToday
|
||||
&& (!pack.dataEndDate || new Date(pack.dataEndDate).getTime() >= utcToday);
|
||||
|
||||
}
|
||||
|
@@ -22,8 +22,4 @@ export class TypeaheadService {
|
||||
getTagTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
|
||||
return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/tag/?q=${searchText}&skip=${skip}&take=${take}`);
|
||||
}
|
||||
|
||||
getCityTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
|
||||
return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/city/?q=${searchText}&skip=${skip}&take=${take}`);
|
||||
}
|
||||
}
|
||||
|
@@ -49,22 +49,6 @@ export class WeatherService {
|
||||
return this.getWeatherRange(centroid, startDateString, endDateString);
|
||||
}
|
||||
|
||||
public getDailyHistoricalObservations(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
|
||||
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
|
||||
const apiKey = this.appConfig.getConfig('weatherApiKey');
|
||||
|
||||
// weather does not support UTC format, also remove Z
|
||||
const sd = encodeURIComponent(startDate);
|
||||
|
||||
const edHistoricalDate = new Date();
|
||||
edHistoricalDate.setHours(edHistoricalDate.getHours(), 0, 0, 0);
|
||||
const edHistorical = moment(edHistoricalDate).local().format('YYYY-MM-DD[T]HH:mm:ss');
|
||||
|
||||
const historical = `${endpoint}${this.apiObservation}/?c=${centroid[0]},${centroid[1]}&sd=${sd}&ed=${edHistorical}&t=cleanedobservation&interval=daily&key=${apiKey}`;
|
||||
|
||||
return this.httpClient.get<any[]>(historical);
|
||||
}
|
||||
|
||||
public getWeatherRange(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
|
||||
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
|
||||
const apiKey = this.appConfig.getConfig('weatherApiKey');
|
||||
|
@@ -1,8 +1,8 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'core-js/es7/reflect';
|
||||
import 'zone.js';
|
||||
import 'zone.js/testing';
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
|
@@ -30,7 +30,8 @@
|
||||
"strictMetadataEmit": true,
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"enableResourceInlining": true
|
||||
"enableResourceInlining": true,
|
||||
"enableIvy": false
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
|
@@ -31,7 +31,7 @@
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"enableResourceInlining": true,
|
||||
"compilationMode": "partial"
|
||||
"enableIvy": false
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
|
@@ -6,7 +6,8 @@ import {
|
||||
} from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
|
||||
import { AppCommonModule,AppCommonServiceModule,AuthConfigFactory,FM_COMMON_STARTPAGE } from '@farmmaps/common';
|
||||
import { AppCommonModule,AppCommonServiceModule,AuthConfigFactory } from '@farmmaps/common';
|
||||
import { AppCommonMapModule} from '@farmmaps/common-map';
|
||||
|
||||
import {AppRootComponent} from './app.component';
|
||||
|
||||
@@ -89,10 +90,6 @@ export const metaReducers: MetaReducer<any>[] = [debug];
|
||||
{
|
||||
provide:AuthConfigFactory,
|
||||
useClass:Id4AuthconfigFactory
|
||||
},
|
||||
{
|
||||
provide: FM_COMMON_STARTPAGE,
|
||||
useValue: '/map'
|
||||
}
|
||||
],
|
||||
bootstrap: [AppRootComponent]
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"issuer": "http://localhost:8094",
|
||||
"clientId": "farmmapsdev",
|
||||
"audience": "http://localhost:8082",
|
||||
"audience": "http://localhost:8082/",
|
||||
"requireHttps": false,
|
||||
"apiEndPoint": "http://localhost:8082",
|
||||
"grantType":"code"
|
||||
|
@@ -13,4 +13,4 @@ export const environment = {
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* on performance if an error is thrown.
|
||||
*/
|
||||
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
||||
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
||||
|
@@ -55,8 +55,7 @@
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
import '@angular/localize/init';
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/testing';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
|
@@ -10,5 +10,8 @@
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"importHelpers": true,
|
||||
"skipLibCheck": true,
|
||||
"target": "es2015",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
|
Reference in New Issue
Block a user