Remove fm-map-item-features-source ( obsolete )
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2020-02-11 14:48:40 +01:00
parent 7a1ba95212
commit 52170590e3
4 changed files with 2052 additions and 817 deletions

2771
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,8 +20,8 @@
"@angular/platform-browser-dynamic": "~8.2.14", "@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14", "@angular/router": "~8.2.14",
"@aspnet/signalr": "^1.1.4", "@aspnet/signalr": "^1.1.4",
"@farmmaps/common": ">=0.0.1-prerelease.134 <0.0.1", "@farmmaps/common": ">=0.0.1-prerelease.156 <0.0.1",
"@farmmaps/common-map": ">=0.0.1-prerelease.134 <0.0.1", "@farmmaps/common-map": ">=0.0.1-prerelease.156 <0.0.1",
"@ng-bootstrap/ng-bootstrap": "^4.2.1", "@ng-bootstrap/ng-bootstrap": "^4.2.1",
"@ngrx/effects": "^8.6.0", "@ngrx/effects": "^8.6.0",
"@ngrx/router-store": "^8.6.0", "@ngrx/router-store": "^8.6.0",

View File

@ -46,7 +46,6 @@ import { WidgetHostDirective} from './components/widget-host/widget-host.directi
import { FeatureListComponent,AbstractFeatureListComponent} from './components/feature-list/feature-list.component'; import { FeatureListComponent,AbstractFeatureListComponent} from './components/feature-list/feature-list.component';
import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component'; import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component';
import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component'; import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component';
import { ItemFeaturesSourceComponent } from './components/aol/item-features-source/item-features-source.component';
import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component'; import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component';
import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component'; import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component';
import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component'; import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component';
@ -94,7 +93,6 @@ export {
mapActions, mapActions,
ZoomToExtentComponent, ZoomToExtentComponent,
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemFeaturesSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MapComponent, MapComponent,
@ -161,7 +159,6 @@ export {
declarations: [ declarations: [
ZoomToExtentComponent, ZoomToExtentComponent,
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemFeaturesSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MapComponent, MapComponent,
@ -210,7 +207,6 @@ export {
], ],
exports: [ exports: [
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemFeaturesSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MetaDataModalComponent, MetaDataModalComponent,

View File

@ -1,90 +0,0 @@
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { LayerVectorComponent, SourceVectorComponent, MapComponent, LayerImageComponent } from 'ngx-openlayers';
import { LayerVectorImageComponent } from '../layer-vector-image/layer-vector-image.component';
import { ItemService } from '@farmmaps/common';
import { IItem } from '@farmmaps/common';
import { ISelectedFeatures } from '../../../models/selected.features';
import {Vector} from 'ol/source';
import {Feature,Collection} from 'ol';
import {Extent} from 'ol/extent';
import * as style from 'ol/style';
import * as proj from 'ol/proj';
import Projection from 'ol/proj/Projection';
import * as loadingstrategy from 'ol/loadingstrategy';
import {GeoJSON} from 'ol/format';
@Component({
selector: 'fm-map-item-features-source',
template: `<ng-content></ng-content>`,
providers: [
{ provide: SourceVectorComponent, useExisting: forwardRef(() => ItemFeaturesSourceComponent) }
]
})
export class ItemFeaturesSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
instance:Vector;
features: Collection<Feature>;
@Input() item: IItem;
@Input() layerIndex: number = 0;
constructor(@Host() private layer: LayerVectorImageComponent, private itemService: ItemService, @Host() private map: MapComponent) {
super(layer);
}
private colorIndex = 0;
private styleCache = {};
ngOnInit() {
this.instance = new Vector({
loader: (extent: Extent, resolution: number, projection: Projection) => {
let format = new GeoJSON();
this.itemService.getItemFeatures(this.item.code, extent, projection.getCode(), this.layerIndex).subscribe((data) => {
var features = format.readFeatures(data);
// TODO 13/6/2019 The line below causes an endless loop. Action required?
this.instance.addFeatures(features);
// TODO 13/6/2019 Action required: check if feature collection hasn't been changed (Willem)
// var t = this.vectorSource.getFeatures();
});
},
format: new GeoJSON(),
strategy: loadingstrategy.bbox
});
this.features = new Collection<Feature>();
this.layer.instance
this.layer.instance.setStyle((feature) => {
var resolution = this.map.instance.getView().getResolution();
var r = (2 / resolution) / 2;
var color = feature.get("color");
return new style.Style(
{
fill: new style.Fill({
color: color
}),
image: new style.Circle({
fill: new style.Fill({
color: color
}),
stroke: new style.Stroke({
color: color,
width: 1.25
}),
radius: r
}),
stroke: new style.Stroke({
color: color,
width: 1.25
})
});
});
this.host.instance.setSource(this.instance);
}
ngOnChanges(changes: SimpleChanges) {
if (this.instance) {
if (changes['layerIndex']) {
this.instance.clear();
}
}
}
}