Some fixes

This commit is contained in:
Willem Dantuma
2019-11-01 15:57:50 +01:00
parent 173be180ce
commit ca6331e053
30 changed files with 707 additions and 91 deletions

View File

@@ -30,7 +30,7 @@ export class GpsLocation implements OnInit,OnChanges{
}
recalcLocationTolerance() {
this.locTolerancePixels = this.locationTolerance / this.resolution;
this.locTolerancePixels = this.resolution >0? this.locationTolerance / this.resolution:0;
}
ngOnInit() {

View File

@@ -34,7 +34,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
constructor(private itemService: ItemService, @Host() private map: MapComponent, public appConfig: AppConfig) {
super(map);
this._apiEndPoint = "";//appConfig.getConfig("apiEndPoint");
this._apiEndPoint = appConfig.getConfig("apiEndPoint");
}
private styleCache = {}

View File

@@ -2,7 +2,7 @@ import { Component, Input, Injectable} from '@angular/core';
import { Feature } from 'ol';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers,ItemTypeService } from '@farmmaps/common';
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
import { ForItemType } from '../for-item/for-itemtype.decorator';
@@ -16,7 +16,7 @@ import { ForItemType } from '../for-item/for-itemtype.decorator';
})
export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService) {
super(store, itemTypeService);
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) {
super(store, itemTypeService,config);
}
}

View File

@@ -2,7 +2,7 @@ import { Component, Input, Injectable} from '@angular/core';
import { Feature } from 'ol';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers,ItemTypeService } from '@farmmaps/common';
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
import { ForItemType } from '../for-item/for-itemtype.decorator';
@@ -16,7 +16,7 @@ import { ForItemType } from '../for-item/for-itemtype.decorator';
})
export class FeatureListFeatureCroppingschemeComponent extends AbstractFeatureListFeatureComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService) {
super(store, itemTypeService);
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) {
super(store, itemTypeService,config);
}
}

View File

@@ -1,6 +1,6 @@
<div *ngIf="feature;let feature" class="row m-0">
<div class="col-3 m-0 p-2 thumbnail">
<img *ngIf="feature.get('thumbnail')" [src]="'/api/v1/items/'+feature.get('code')+'/thumbnail'" />
<img *ngIf="feature.get('thumbnail')" [src]="config.getConfig('apiEndPoint') + '/api/v1/items/'+feature.get('code')+'/thumbnail'" />
<div *ngIf="!feature.get('thumbnail')" [style.background-color]="itemTypeService.getColor(feature.get('itemType'))">
<i [ngClass]="itemTypeService.getIcon(feature.get('itemType'))"></i>
</div>

View File

@@ -2,7 +2,7 @@ import { Component, Input, Injectable} from '@angular/core';
import { Feature } from 'ol';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers,ItemTypeService } from '@farmmaps/common';
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
@@ -10,7 +10,7 @@ import { commonReducers,ItemTypeService } from '@farmmaps/common';
export abstract class AbstractFeatureListFeatureComponent {
@Input() feature: Feature
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) {
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
}
}
@@ -22,7 +22,7 @@ export abstract class AbstractFeatureListFeatureComponent {
})
export class FeatureListFeatureComponent extends AbstractFeatureListFeatureComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService) {
super(store, itemTypeService);
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, config:AppConfig) {
super(store, itemTypeService,config);
}
}

View File

@@ -225,7 +225,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) {
//console.log(`Replace url :${mapState.baseLayerCode}`)
this.router.navigate([".", mapState.xCenter.toFixed(5), mapState.yCenter.toFixed(5), mapState.zoom, mapState.rotation.toFixed(2), mapState.baseLayerCode, this.serializeService.serialize(queryState)], { replaceUrl: replace,relativeTo:this.route.parent.parent });
this.router.navigate([".", mapState.xCenter.toFixed(5), mapState.yCenter.toFixed(5), mapState.zoom, mapState.rotation.toFixed(2), mapState.baseLayerCode, this.serializeService.serialize(queryState)], { replaceUrl: replace,relativeTo:this.route.parent });
}
handleOnMoveEnd(event) {
@@ -251,8 +251,6 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
this.store.dispatch(new mapActions.CollapseSearch());
}
handleOnDownload(event) {
}