Refactoring types
This commit is contained in:
parent
4ef077f8d7
commit
160eb10aba
@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
node: {
|
resolve: {
|
||||||
|
fallback: {
|
||||||
// Resolve node module use of fs
|
// Resolve node module use of fs
|
||||||
fs: "empty",
|
fs: "empty",
|
||||||
Buffer: false,
|
Buffer: false,
|
||||||
@ -7,4 +8,5 @@ module.exports = {
|
|||||||
https: "empty",
|
https: "empty",
|
||||||
zlib: "empty"
|
zlib: "empty"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -4289,6 +4289,12 @@
|
|||||||
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
|
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/arcgis-rest-api": {
|
||||||
|
"version": "10.4.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/arcgis-rest-api/-/arcgis-rest-api-10.4.5.tgz",
|
||||||
|
"integrity": "sha512-MhpTj3aaURIFhK6pBRF50yCHW5TpbeuC1E81juovfNesSOshsQnCzludhpBhIr2pNzplTBlfzrT7RKiLZ5F3Tw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/color-name": {
|
"@types/color-name": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"@angular/cli": "^12.2.8",
|
"@angular/cli": "^12.2.8",
|
||||||
"@angular/compiler-cli": "~12.2.8",
|
"@angular/compiler-cli": "~12.2.8",
|
||||||
"@angular/language-service": "~12.2.8",
|
"@angular/language-service": "~12.2.8",
|
||||||
|
"@types/arcgis-rest-api": "^10.4.5",
|
||||||
"@types/jasmine": "~2.8.8",
|
"@types/jasmine": "~2.8.8",
|
||||||
"@types/jasminewd2": "^2.0.9",
|
"@types/jasminewd2": "^2.0.9",
|
||||||
"@types/node": "^12.20.15",
|
"@types/node": "^12.20.15",
|
||||||
|
@ -5,7 +5,9 @@ import { IItemLayer } from '../models/item.layer';
|
|||||||
import { ILayervalue } from '../models/layer.value';
|
import { ILayervalue } from '../models/layer.value';
|
||||||
import { IQueryState } from '@farmmaps/common';
|
import { IQueryState } from '@farmmaps/common';
|
||||||
import { IItem } from '@farmmaps/common';
|
import { IItem } from '@farmmaps/common';
|
||||||
import { Feature,Style } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Style } from 'ol/style';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
import { IPeriodState } from '../models/period.state';
|
import { IPeriodState } from '../models/period.state';
|
||||||
|
|
||||||
export const SETSTATE = '[Map] SetState';
|
export const SETSTATE = '[Map] SetState';
|
||||||
@ -103,13 +105,13 @@ export class StartSearch implements Action {
|
|||||||
export class StartSearchSuccess implements Action {
|
export class StartSearchSuccess implements Action {
|
||||||
readonly type = STARTSEARCHSUCCESS;
|
readonly type = STARTSEARCHSUCCESS;
|
||||||
|
|
||||||
constructor(public features: Array<Feature>, public query:IQueryState) { }
|
constructor(public features: Array<Feature<Geometry>>, public query:IQueryState) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SelectFeature implements Action {
|
export class SelectFeature implements Action {
|
||||||
readonly type = SELECTFEATURE;
|
readonly type = SELECTFEATURE;
|
||||||
|
|
||||||
constructor(public feature:Feature) { }
|
constructor(public feature:Feature<Geometry>) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SelectItem implements Action {
|
export class SelectItem implements Action {
|
||||||
@ -151,13 +153,13 @@ export class SelectTemporal implements Action {
|
|||||||
export class AddFeatureSuccess implements Action {
|
export class AddFeatureSuccess implements Action {
|
||||||
readonly type = ADDFEATURESUCCESS;
|
readonly type = ADDFEATURESUCCESS;
|
||||||
|
|
||||||
constructor(public feature: Feature) { }
|
constructor(public feature: Feature<Geometry>) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateFeatureSuccess implements Action {
|
export class UpdateFeatureSuccess implements Action {
|
||||||
readonly type = UPDATEFEATURESUCCESS;
|
readonly type = UPDATEFEATURESUCCESS;
|
||||||
|
|
||||||
constructor(public feature: Feature) { }
|
constructor(public feature: Feature<Geometry>) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ExpandSearch implements Action {
|
export class ExpandSearch implements Action {
|
||||||
@ -271,7 +273,7 @@ export class DoQuery implements Action {
|
|||||||
export class SetStyle implements Action {
|
export class SetStyle implements Action {
|
||||||
readonly type = SETSTYLE;
|
readonly type = SETSTYLE;
|
||||||
|
|
||||||
constructor(public itemType:string,public style: Style | (Feature)) { }
|
constructor(public itemType:string,public style: Style | (Feature<Geometry>)) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ShowLayerSwitcher implements Action {
|
export class ShowLayerSwitcher implements Action {
|
||||||
@ -287,7 +289,7 @@ export class SetReplaceUrl implements Action {
|
|||||||
export class SetFeatures implements Action {
|
export class SetFeatures implements Action {
|
||||||
readonly type = SETFEATURES;
|
readonly type = SETFEATURES;
|
||||||
|
|
||||||
constructor(public features: Array<Feature>) { }
|
constructor(public features: Array<Feature<Geometry>>) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SetLayerValuesLocation implements Action {
|
export class SetLayerValuesLocation implements Action {
|
||||||
|
@ -21,7 +21,7 @@ export class FileDropTargetComponent implements OnInit, OnDestroy {
|
|||||||
element: Element;
|
element: Element;
|
||||||
@Output() onFileDropped = new EventEmitter<IDroppedFile>();
|
@Output() onFileDropped = new EventEmitter<IDroppedFile>();
|
||||||
@Input() parentCode: string;
|
@Input() parentCode: string;
|
||||||
@Input() features: Array<Feature>;
|
@Input() features: Array<Feature<Geometry>>;
|
||||||
|
|
||||||
constructor(private map: MapComponent) {
|
constructor(private map: MapComponent) {
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ export class GpsLocation implements OnInit,OnChanges{
|
|||||||
this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)";
|
this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)";
|
||||||
this.locTolerancePixels = this.locationTolerance;
|
this.locTolerancePixels = this.locationTolerance;
|
||||||
this.map.instance.addOverlay(this.instance);
|
this.map.instance.addOverlay(this.instance);
|
||||||
this.map.instance.getView().on('change:resolution', (evt) => {
|
this.map.instance.getView().on('change:resolution', (evt:any) => {
|
||||||
this.resolution = evt.target.get('resolution');
|
this.resolution = evt.target.get('resolution');
|
||||||
this.recalcLocationTolerance();
|
this.recalcLocationTolerance();
|
||||||
});
|
});
|
||||||
|
@ -10,12 +10,14 @@ import * as proj from 'ol/proj';
|
|||||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
import * as loadingstrategy from 'ol/loadingstrategy';
|
||||||
import * as style from 'ol/style';
|
import * as style from 'ol/style';
|
||||||
import {Tile,Layer,Image} from 'ol/layer';
|
import {Tile,Layer,Image} from 'ol/layer';
|
||||||
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON} from 'ol/source';
|
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON,Source} from 'ol/source';
|
||||||
import {Vector as VectorSource} from 'ol/source';
|
import {Vector as VectorSource} from 'ol/source';
|
||||||
import { Vector as VectorLayer } from 'ol/layer';
|
import { Vector as VectorLayer } from 'ol/layer';
|
||||||
import VectorTileSource from 'ol/source/VectorTile';
|
import VectorTileSource from 'ol/source/VectorTile';
|
||||||
import VectorTileLayer from 'ol/layer/VectorTile';
|
import VectorTileLayer from 'ol/layer/VectorTile';
|
||||||
import {GeoJSON,MVT} from 'ol/format';
|
import {GeoJSON,MVT} from 'ol/format';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
|
import TileSource from 'ol/source/Tile';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-item-layers',
|
selector: 'fm-map-item-layers',
|
||||||
@ -34,7 +36,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
private initialized:boolean = false;
|
private initialized:boolean = false;
|
||||||
private mapEventHandlerInstalled = false;
|
private mapEventHandlerInstalled = false;
|
||||||
private selectedFeatures = {};
|
private selectedFeatures = {};
|
||||||
private selectionLayer:Layer = null;
|
private selectionLayer:Layer<Source> = null;
|
||||||
|
|
||||||
constructor(private itemService: ItemService, private map: MapComponent, public appConfig: AppConfig) {
|
constructor(private itemService: ItemService, private map: MapComponent, public appConfig: AppConfig) {
|
||||||
super(map);
|
super(map);
|
||||||
@ -119,9 +121,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return this.styleCache[key];
|
return this.styleCache[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
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)}` });
|
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 });
|
layer = new Tile({ source: source });
|
||||||
@ -142,9 +144,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
||||||
var data = item.data;
|
var data = item.data;
|
||||||
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
||||||
@ -177,7 +179,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
let source = new VectorSource({
|
let source = new VectorSource({
|
||||||
strategy: loadingstrategy.bbox,
|
strategy: loadingstrategy.bbox,
|
||||||
loader: function (extent: Extent, resolution: number, projection: Projection) {
|
loader: function (extent: Extent, resolution: number, projection: Projection) {
|
||||||
var source = this as VectorSource;
|
var source = this as VectorSource<Geometry>;
|
||||||
__this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
|
__this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
|
||||||
var features = format.readFeatures(data);
|
var features = format.readFeatures(data);
|
||||||
for (let f of features) {
|
for (let f of features) {
|
||||||
@ -230,16 +232,16 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
createSelectionLayer(itemLayer:IItemLayer):Layer {
|
createSelectionLayer(itemLayer:IItemLayer):Layer<Source> {
|
||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
||||||
var data = itemLayer.item.data;
|
var data = itemLayer.item.data;
|
||||||
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
||||||
return new VectorTileLayer({
|
return new VectorTileLayer({
|
||||||
renderMode: 'vector',
|
renderMode: 'vector',
|
||||||
source: itemLayer.layer.getSource(),
|
source: (itemLayer.layer as VectorTileLayer).getSource(),
|
||||||
style: (feature) => {
|
style: (feature) => {
|
||||||
if (feature.getId() in this.selectedFeatures) {
|
if (feature.getId() in this.selectedFeatures) {
|
||||||
|
|
||||||
@ -260,9 +262,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||||
let data = item.data as ILayerData;
|
let data = item.data as ILayerData;
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
switch (data.interfaceType) {
|
switch (data.interfaceType) {
|
||||||
case 'OSM': {
|
case 'OSM': {
|
||||||
let source = new OSM();
|
let source = new OSM();
|
||||||
@ -312,8 +314,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
createLayer(itemLayer: IItemLayer): Layer {
|
createLayer(itemLayer: IItemLayer): Layer<Source> {
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
||||||
layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
|
layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
|
||||||
@ -360,7 +362,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer {
|
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> {
|
||||||
if(!itemLayer) return null;
|
if(!itemLayer) return null;
|
||||||
var olLayers = this.instance.getLayers();
|
var olLayers = this.instance.getLayers();
|
||||||
var layer = itemLayer.layer;
|
var layer = itemLayer.layer;
|
||||||
@ -385,7 +387,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateLayers(itemLayers: IItemLayer[]) {
|
updateLayers(itemLayers: IItemLayer[]) {
|
||||||
let newLayers: IItemLayer[] = [];
|
let newLayers: Layer<Source>[] = [];
|
||||||
if (itemLayers) {
|
if (itemLayers) {
|
||||||
itemLayers.forEach((itemLayer, index) => {
|
itemLayers.forEach((itemLayer, index) => {
|
||||||
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
||||||
|
@ -3,14 +3,14 @@ import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-o
|
|||||||
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
|
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
|
||||||
|
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import { Point } from 'ol/geom';
|
import { Point,Geometry } from 'ol/geom';
|
||||||
import { MapBrowserEvent } from 'ol';
|
import { MapBrowserEvent } from 'ol';
|
||||||
import * as style from 'ol/style';
|
import * as style from 'ol/style';
|
||||||
import * as color from 'ol/color';
|
import * as color from 'ol/color';
|
||||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
import * as loadingstrategy from 'ol/loadingstrategy';
|
||||||
import * as condition from 'ol/events/condition';
|
import * as condition from 'ol/events/condition';
|
||||||
import * as extent from 'ol/extent';
|
import * as extent from 'ol/extent';
|
||||||
import {Vector,Cluster} from 'ol/source';
|
import {Vector,Cluster,Source} from 'ol/source';
|
||||||
import {Layer} from 'ol/layer';
|
import {Layer} from 'ol/layer';
|
||||||
import {GeoJSON} from 'ol/format';
|
import {GeoJSON} from 'ol/format';
|
||||||
import {Select} from 'ol/interaction';
|
import {Select} from 'ol/interaction';
|
||||||
@ -25,17 +25,17 @@ import {FeatureIconService} from '../../../services/feature-icon.service';
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
|
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
|
||||||
instance: Vector;
|
instance: Vector<Geometry>;
|
||||||
private _format: GeoJSON;
|
private _format: GeoJSON;
|
||||||
private _select: Select;
|
private _select: Select;
|
||||||
private _hoverSelect: Select;
|
private _hoverSelect: Select;
|
||||||
private _iconScale: number = 0.05;
|
private _iconScale: number = 0.05;
|
||||||
@Input() features: Array<Feature>;
|
@Input() features: Array<Feature<Geometry>>;
|
||||||
@Input() selectedFeature: Feature;
|
@Input() selectedFeature: Feature<Geometry>;
|
||||||
@Input() selectedItem: IItem;
|
@Input() selectedItem: IItem;
|
||||||
@Input() styles:IStyles;
|
@Input() styles:IStyles;
|
||||||
@Output() onFeatureSelected: EventEmitter<Feature> = new EventEmitter<Feature>();
|
@Output() onFeatureSelected: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
|
||||||
@Output() onFeatureHover: EventEmitter<Feature> = new EventEmitter<Feature>();
|
@Output() onFeatureHover: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
|
||||||
private stylesCache:IStyles = {};
|
private stylesCache:IStyles = {};
|
||||||
|
|
||||||
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
|
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
|
||||||
@ -43,7 +43,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
this._format = new GeoJSON();
|
this._format = new GeoJSON();
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry(feature: Feature) {
|
geometry(feature: Feature<Geometry>) {
|
||||||
let view = this.map.instance.getView();
|
let view = this.map.instance.getView();
|
||||||
let resolution = view.getResolution();
|
let resolution = view.getResolution();
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
@ -55,9 +55,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelectedStyle(feature:Feature):style.Style {
|
getSelectedStyle(feature:Feature<Geometry>):style.Style {
|
||||||
let key = feature.get('itemType')+"_selected";
|
let key = feature.get('itemType')+"_selected";
|
||||||
let evaluatedStyle =null;
|
let evaluatedStyle: style.Style | (Feature<Geometry>) =undefined;
|
||||||
var styleEntry = this.stylesCache[key];
|
var styleEntry = this.stylesCache[key];
|
||||||
if(styleEntry) {
|
if(styleEntry) {
|
||||||
if(typeof styleEntry === 'function') {
|
if(typeof styleEntry === 'function') {
|
||||||
@ -71,7 +71,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
if(evaluatedStyle ) {
|
if(evaluatedStyle ) {
|
||||||
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
|
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
|
||||||
}
|
}
|
||||||
return evaluatedStyle
|
return evaluatedStyle as style.Style
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -80,17 +80,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
this._select = new Select({
|
this._select = new Select({
|
||||||
style:null,
|
style:null,
|
||||||
hitTolerance: 10,
|
hitTolerance: 10,
|
||||||
layers: [this.layer.instance as Layer]
|
layers: [this.layer.instance as Layer<Source>]
|
||||||
});
|
});
|
||||||
this._hoverSelect = new Select({
|
this._hoverSelect = new Select({
|
||||||
style: (feature) => {
|
style: (feature:Feature<Geometry>) => {
|
||||||
return this.getSelectedStyle(feature);
|
return this.getSelectedStyle(feature);
|
||||||
},
|
},
|
||||||
hitTolerance: 10,
|
hitTolerance: 10,
|
||||||
condition: (e: MapBrowserEvent) => {
|
condition: (e: MapBrowserEvent) => {
|
||||||
return e.type == 'pointermove';
|
return e.type == 'pointermove';
|
||||||
},
|
},
|
||||||
layers: [this.layer.instance as Layer]
|
layers: [this.layer.instance as Layer<Source>]
|
||||||
});
|
});
|
||||||
this.map.instance.addInteraction(this._select);
|
this.map.instance.addInteraction(this._select);
|
||||||
this.map.instance.addInteraction(this._hoverSelect);
|
this.map.instance.addInteraction(this._hoverSelect);
|
||||||
@ -132,7 +132,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
fill: new style.Fill({
|
fill: new style.Fill({
|
||||||
color: fillColor
|
color: fillColor
|
||||||
}),
|
}),
|
||||||
geometry:(feature) => this.geometry(feature)
|
geometry:(feature:Feature<Geometry>) => this.geometry(feature)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
key = 'file';
|
key = 'file';
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
import { Component, OnDestroy, OnInit, Input, Optional, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { Vector } from 'ol/layer';
|
import { LayerVectorComponent, MapComponent } from 'ngx-openlayers';
|
||||||
import { Style } from 'ol/style';
|
|
||||||
import { StyleFunction } from 'ol/style/Style';
|
|
||||||
import { LayerVectorComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
|
|
||||||
import { RenderType } from 'ol/layer/Vector';
|
import { RenderType } from 'ol/layer/Vector';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -12,7 +9,7 @@ import { RenderType } from 'ol/layer/Vector';
|
|||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
export class LayerVectorImageComponent extends LayerVectorComponent implements OnInit, OnDestroy, OnChanges {
|
export class LayerVectorImageComponent extends LayerVectorComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
public source: Vector;
|
//public source: Vector;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
renderMode: RenderType | string = "image";
|
renderMode: RenderType | string = "image";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject} from '@angular/core';
|
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry} from 'ol/geom';
|
||||||
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
|
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
|
||||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||||
import {IQueryState,PackageService } from '@farmmaps/common';
|
import {IQueryState,PackageService } from '@farmmaps/common';
|
||||||
@ -20,10 +21,10 @@ export class FeatureListContainerComponent {
|
|||||||
this.featureLists = [...this.featureLists].reverse();
|
this.featureLists = [...this.featureLists].reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() features: Array<Feature>
|
@Input() features: Array<Feature<Geometry>>
|
||||||
@Input() queryState: IQueryState;
|
@Input() queryState: IQueryState;
|
||||||
@Input() selectedFeature: Feature;
|
@Input() selectedFeature: Feature<Geometry>;
|
||||||
@Input() clickedFeature:Observable<Feature>;
|
@Input() clickedFeature:Observable<Feature<Geometry>>;
|
||||||
|
|
||||||
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||||
componentRef:any;
|
componentRef:any;
|
||||||
|
@ -9,6 +9,7 @@ import * as mapActions from '../../actions/map.actions';
|
|||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry} from 'ol/geom';
|
||||||
|
|
||||||
@ForItemType("vnd.farmmaps.itemtype.croppingscheme")
|
@ForItemType("vnd.farmmaps.itemtype.croppingscheme")
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -23,7 +24,7 @@ export class FeatureListCroppingschemeComponent extends AbstractFeatureListCompo
|
|||||||
super(store, itemTypeService, location);
|
super(store, itemTypeService, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAction(feature:Feature):Action {
|
getAction(feature:Feature<Geometry>):Action {
|
||||||
var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
|
var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
|
||||||
return new mapActions.DoQuery(queryState);
|
return new mapActions.DoQuery(queryState);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
||||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ export class FeatureListFeatureContainerComponent {
|
|||||||
this.featureLists = [...this.featureLists].reverse();
|
this.featureLists = [...this.featureLists].reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() feature: Feature;
|
@Input() feature: Feature<Geometry>;
|
||||||
|
|
||||||
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
|
import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||||
@ -23,11 +24,11 @@ export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFea
|
|||||||
super(store, itemTypeService,config);
|
super(store, itemTypeService,config);
|
||||||
}
|
}
|
||||||
|
|
||||||
areaInHa(feature:Feature):number {
|
areaInHa(feature:Feature<Geometry>):number {
|
||||||
if(!feature) return 0;
|
if(!feature) return 0;
|
||||||
// get area from faeture if 0 calculate from polygon
|
// get area from faeture if 0 calculate from polygon
|
||||||
let a = feature.get('area');
|
let a = feature.get('area');
|
||||||
if(a) return a;
|
if(a) return a;
|
||||||
return getArea(feature.getGeometry(),{projectio:"EPSG:3857"}) / 10000;
|
return getArea(feature.getGeometry(),{projection:"EPSG:3857"}) / 10000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, Input, Injectable,Directive} from '@angular/core';
|
import { Component, Input, Injectable,Directive} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||||
@ -9,7 +10,7 @@ import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class AbstractFeatureListFeatureComponent {
|
export abstract class AbstractFeatureListFeatureComponent {
|
||||||
@Input() feature: Feature
|
@Input() feature: Feature<Geometry>
|
||||||
|
|
||||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
|
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
|
import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry} from 'ol/geom';
|
||||||
import { Store,Action} from '@ngrx/store';
|
import { Store,Action} from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
||||||
@ -14,20 +15,20 @@ import { IQueryState } from '@farmmaps/common';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class AbstractFeatureListComponent {
|
export abstract class AbstractFeatureListComponent {
|
||||||
@Input() features: Array<Feature>;
|
@Input() features: Array<Feature<Geometry>>;
|
||||||
@Input() queryState: IQueryState;
|
@Input() queryState: IQueryState;
|
||||||
@Input() selectedFeature: Feature;
|
@Input() selectedFeature: Feature<Geometry>;
|
||||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureClick(feature:Feature) {
|
handleFeatureClick(feature:Feature<Geometry>) {
|
||||||
if(feature) {
|
if(feature) {
|
||||||
let action = this.getAction(feature);
|
let action = this.getAction(feature);
|
||||||
this.store.dispatch(action);
|
this.store.dispatch(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getAction(feature:Feature):Action {
|
getAction(feature:Feature<Geometry>):Action {
|
||||||
var newQuery: any = tassign(mapReducers.initialState.queryState);
|
var newQuery: any = tassign(mapReducers.initialState.queryState);
|
||||||
newQuery.parentCode = feature.get('parentCode');
|
newQuery.parentCode = feature.get('parentCode');
|
||||||
newQuery.itemCode = feature.get('code');
|
newQuery.itemCode = feature.get('code');
|
||||||
@ -48,7 +49,7 @@ export abstract class AbstractFeatureListComponent {
|
|||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
isFeatureSelected(feature:Feature):boolean {
|
isFeatureSelected(feature:Feature<Geometry>):boolean {
|
||||||
if(!this.selectedFeature) return false;
|
if(!this.selectedFeature) return false;
|
||||||
return feature.getId() == this.selectedFeature.getId();
|
return feature.getId() == this.selectedFeature.getId();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ export class GeometryThumbnailComponent implements OnInit {
|
|||||||
|
|
||||||
@ViewChild('canvas') canvas;
|
@ViewChild('canvas') canvas;
|
||||||
@ViewChild('container') container;
|
@ViewChild('container') container;
|
||||||
@Input('feature') feature:Feature;
|
@Input('feature') feature:Feature<Geometry>;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core';
|
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core';
|
||||||
import { layer } from 'ol';
|
import { Layer } from 'ol/layer';
|
||||||
|
import { Source } from 'ol/source';
|
||||||
import { MapComponent } from 'ngx-openlayers';
|
import { MapComponent } from 'ngx-openlayers';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
@ -7,7 +8,7 @@ import { MapComponent } from 'ngx-openlayers';
|
|||||||
})
|
})
|
||||||
export class ifZoomToShowDirective implements OnInit {
|
export class ifZoomToShowDirective implements OnInit {
|
||||||
@Input()
|
@Input()
|
||||||
set fmMapIfZoomToShow(layer:layer) {
|
set fmMapIfZoomToShow(layer:Layer<Source>) {
|
||||||
this.layer$=layer;
|
this.layer$=layer;
|
||||||
this.checkZoom();
|
this.checkZoom();
|
||||||
}
|
}
|
||||||
@ -24,7 +25,7 @@ export class ifZoomToShowDirective implements OnInit {
|
|||||||
this.checkZoom();
|
this.checkZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
private layer$:layer;
|
private layer$:Layer<Source>;
|
||||||
private thenTemplate$:TemplateRef<any>;
|
private thenTemplate$:TemplateRef<any>;
|
||||||
private elseTemplate$:TemplateRef<any>;
|
private elseTemplate$:TemplateRef<any>;
|
||||||
private showView = false;
|
private showView = false;
|
||||||
|
@ -29,6 +29,7 @@ import {commonReducers} from '@farmmaps/common';
|
|||||||
import {commonActions} from '@farmmaps/common';
|
import {commonActions} from '@farmmaps/common';
|
||||||
|
|
||||||
import {Feature} from 'ol';
|
import {Feature} from 'ol';
|
||||||
|
import {Geometry} from 'ol/geom';
|
||||||
import {Extent,createEmpty,extend } from 'ol/extent';
|
import {Extent,createEmpty,extend } from 'ol/extent';
|
||||||
import {transform} from 'ol/proj';
|
import {transform} from 'ol/proj';
|
||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
@ -46,7 +47,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
|
public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
|
||||||
public itemTypes$: Observable<{ [id: string]: IItemType }>;
|
public itemTypes$: Observable<{ [id: string]: IItemType }>;
|
||||||
public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
|
public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
|
||||||
public features$: Observable<Array<Feature>> = this.store.select(mapReducers.selectGetFeatures);
|
public features$: Observable<Array<Feature<Geometry>>> = this.store.select(mapReducers.selectGetFeatures);
|
||||||
public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
|
public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
|
||||||
public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
||||||
public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
|
public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
|
||||||
@ -63,8 +64,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
|
public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
|
||||||
public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
|
public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
|
||||||
public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
|
public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
|
||||||
public selectedFeature$: Observable<Feature> = this.store.select(mapReducers.selectGetSelectedFeature);
|
public selectedFeature$: Observable<Feature<Geometry>> = this.store.select(mapReducers.selectGetSelectedFeature);
|
||||||
public clickedFeature: Subject<Feature> = new Subject<Feature>();
|
public clickedFeature: Subject<Feature<Geometry>> = new Subject<Feature<Geometry>>();
|
||||||
public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
|
public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
|
||||||
public parentItem$: Observable<IItem> =this.store.select(mapReducers.selectGetParentItem);
|
public parentItem$: Observable<IItem> =this.store.select(mapReducers.selectGetParentItem);
|
||||||
public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
|
public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
|
||||||
@ -163,11 +164,11 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
|
this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureClick(feature: Feature) {
|
handleFeatureClick(feature: Feature<Geometry>) {
|
||||||
this.clickedFeature.next(feature);
|
this.clickedFeature.next(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureHover(feature: Feature) {
|
handleFeatureHover(feature: Feature<Geometry>) {
|
||||||
this.store.dispatch(new mapActions.SelectFeature(feature));
|
this.store.dispatch(new mapActions.SelectFeature(feature));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { layer } from 'ol';
|
import { Layer } from 'ol/layer';
|
||||||
|
import { Source } from 'ol/source';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-zoom-to-show-alert',
|
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>'
|
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 {
|
export class ZoomToShowAlert {
|
||||||
public layer$: layer;
|
public layer$: Layer<Source>;
|
||||||
@Input()
|
@Input()
|
||||||
set layer(layer:layer) {
|
set layer(layer:Layer<Source>) {
|
||||||
this.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 {GeoJSON,WKT} from 'ol/format';
|
||||||
import {Feature} from 'ol';
|
import {Feature} from 'ol';
|
||||||
import { getCenter,createEmpty,extend } from 'ol/extent';
|
import { getCenter,createEmpty,extend } from 'ol/extent';
|
||||||
import {Point} from 'ol/geom'
|
import {Point,Geometry} from 'ol/geom'
|
||||||
|
|
||||||
|
|
||||||
import * as mapActions from '../actions/map.actions';
|
import * as mapActions from '../actions/map.actions';
|
||||||
@ -50,7 +50,7 @@ export class MapEffects {
|
|||||||
private _wktFormat: WKT;
|
private _wktFormat: WKT;
|
||||||
private overrideSelectedItemLayer: boolean = false;
|
private overrideSelectedItemLayer: boolean = false;
|
||||||
|
|
||||||
private updateFeatureGeometry(feature:Feature, updateEvent:commonActions.DeviceUpdateEvent): Feature {
|
private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> {
|
||||||
let newFeature = feature.clone();
|
let newFeature = feature.clone();
|
||||||
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
||||||
dataProjection: 'EPSG:4326',
|
dataProjection: 'EPSG:4326',
|
||||||
@ -153,7 +153,7 @@ export class MapEffects {
|
|||||||
if (!action.query.bboxFilter) {
|
if (!action.query.bboxFilter) {
|
||||||
if (extent) {
|
if (extent) {
|
||||||
for (let f of action.features) {
|
for (let f of action.features) {
|
||||||
extend(extent, (f as Feature).getGeometry().getExtent());
|
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
|
||||||
}
|
}
|
||||||
if(action.features && action.features.length >0) {
|
if(action.features && action.features.length >0) {
|
||||||
actions.push(new mapActions.SetExtent(extent));
|
actions.push(new mapActions.SetExtent(extent));
|
||||||
@ -169,7 +169,7 @@ export class MapEffects {
|
|||||||
let extent = createEmpty();
|
let extent = createEmpty();
|
||||||
if (extent) {
|
if (extent) {
|
||||||
for (let f of action.features) {
|
for (let f of action.features) {
|
||||||
extend(extent, (f as Feature).getGeometry().getExtent());
|
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
|
||||||
}
|
}
|
||||||
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
|
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ export class MapEffects {
|
|||||||
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
|
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
|
||||||
mergeMap(([action, features]) => {
|
mergeMap(([action, features]) => {
|
||||||
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
|
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
|
||||||
var feature: Feature = null;
|
var feature: Feature<Geometry> = null;
|
||||||
for (let f of features) {
|
for (let f of features) {
|
||||||
if (f.getId() == deviceUpdateEventAction.itemCode) {
|
if (f.getId() == deviceUpdateEventAction.itemCode) {
|
||||||
feature = f;
|
feature = f;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { IItem,IListItem } from '@farmmaps/common';
|
import { IItem,IListItem } from '@farmmaps/common';
|
||||||
import {Layer} from 'ol/layer';
|
import {Layer} from 'ol/layer';
|
||||||
|
import { Source } from 'ol/source';
|
||||||
|
|
||||||
export interface IItemLayer {
|
export interface IItemLayer {
|
||||||
item: IItem,
|
item: IItem,
|
||||||
layer: Layer,
|
layer: Layer<Source>,
|
||||||
visible: boolean,
|
visible: boolean,
|
||||||
legendVisible:boolean,
|
legendVisible:boolean,
|
||||||
projection: string,
|
projection: string,
|
||||||
@ -13,7 +14,7 @@ export interface IItemLayer {
|
|||||||
|
|
||||||
export class ItemLayer implements IItemLayer {
|
export class ItemLayer implements IItemLayer {
|
||||||
public item: IItem;
|
public item: IItem;
|
||||||
public layer: Layer = null;
|
public layer: Layer<Source> = null;
|
||||||
public visible: boolean = true;
|
public visible: boolean = true;
|
||||||
public legendVisible: boolean = false;
|
public legendVisible: boolean = false;
|
||||||
public projection: string;
|
public projection: string;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import {Style,Feature} from 'ol';
|
import {Feature} from 'ol';
|
||||||
|
import { Style } from 'ol/style';
|
||||||
|
import {Geometry } from 'ol/geom';
|
||||||
|
|
||||||
export interface IStyles{
|
export interface IStyles{
|
||||||
[id: string]: Style | (Feature);
|
[id: string]: Style | (Feature<Geometry>);
|
||||||
};
|
};
|
@ -11,6 +11,7 @@ import {commonActions} from '@farmmaps/common';
|
|||||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
||||||
|
|
||||||
import {Feature} from 'ol';
|
import {Feature} from 'ol';
|
||||||
|
import {Geometry} from 'ol/geom';
|
||||||
|
|
||||||
|
|
||||||
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
|
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
|
||||||
@ -45,10 +46,10 @@ export interface State {
|
|||||||
queryState: IQueryState,
|
queryState: IQueryState,
|
||||||
query:IQuery,
|
query:IQuery,
|
||||||
parentCode: string,
|
parentCode: string,
|
||||||
features: Array<Feature>,
|
features: Array<Feature<Geometry>>,
|
||||||
panelVisible: boolean,
|
panelVisible: boolean,
|
||||||
panelCollapsed: boolean,
|
panelCollapsed: boolean,
|
||||||
selectedFeature: Feature,
|
selectedFeature: Feature<Geometry>,
|
||||||
selectedItem:IItem,
|
selectedItem:IItem,
|
||||||
parentItem:IItem,
|
parentItem:IItem,
|
||||||
clearEnabled: boolean,
|
clearEnabled: boolean,
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
"strictMetadataEmit": true,
|
"strictMetadataEmit": true,
|
||||||
"fullTemplateTypeCheck": true,
|
"fullTemplateTypeCheck": true,
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
"enableResourceInlining": true,
|
"enableResourceInlining": true
|
||||||
"enableIvy": false
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/test.ts",
|
"src/test.ts",
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
"strictMetadataEmit": true,
|
"strictMetadataEmit": true,
|
||||||
"fullTemplateTypeCheck": true,
|
"fullTemplateTypeCheck": true,
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
"enableResourceInlining": true,
|
"enableResourceInlining": true
|
||||||
"enableIvy": false
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/test.ts",
|
"src/test.ts",
|
||||||
|
@ -3,8 +3,5 @@
|
|||||||
"extends": "./tsconfig.lib.json",
|
"extends": "./tsconfig.lib.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declarationMap": false
|
"declarationMap": false
|
||||||
},
|
|
||||||
"angularCompilerOptions": {
|
|
||||||
"enableIvy": false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,9 @@ export {
|
|||||||
IGradientstop,
|
IGradientstop,
|
||||||
BackButtonComponent,
|
BackButtonComponent,
|
||||||
AvatarComponent,
|
AvatarComponent,
|
||||||
EditImageModalComponent
|
EditImageModalComponent,
|
||||||
|
GradientComponent,
|
||||||
|
GradientSelectComponent
|
||||||
};
|
};
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
"strictMetadataEmit": true,
|
"strictMetadataEmit": true,
|
||||||
"fullTemplateTypeCheck": true,
|
"fullTemplateTypeCheck": true,
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
"enableResourceInlining": true,
|
"enableResourceInlining": true
|
||||||
"enableIvy": false
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/test.ts",
|
"src/test.ts",
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
"strictMetadataEmit": true,
|
"strictMetadataEmit": true,
|
||||||
"fullTemplateTypeCheck": true,
|
"fullTemplateTypeCheck": true,
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
"enableResourceInlining": true,
|
"enableResourceInlining": true
|
||||||
"enableIvy": false
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/test.ts",
|
"src/test.ts",
|
||||||
|
@ -10,8 +10,5 @@
|
|||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.d.ts"
|
"src/**/*.d.ts"
|
||||||
],
|
]
|
||||||
"angularCompilerOptions": {
|
|
||||||
"enableIvy": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
"target": "es2015",
|
"target": "es2015",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
|
Loading…
Reference in New Issue
Block a user