AW-6046 Angular 17
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Peter Bastiani 2024-04-09 10:58:42 +02:00
parent e79ae2f623
commit d306d5c4c1
115 changed files with 904 additions and 656 deletions

2
.gitignore vendored
View File

@ -51,5 +51,5 @@ projects/common-map/node_modules/
.angular/* .angular/*
projects/common-map3d/node_modules/ projects/common-map3d/node_modules/
projects/common-map/node_modules/ projects/common-map/node_modules/
projects/ngx-openlayers/node_modules/ projects/ng-openlayers/node_modules/
projects/common/node_modules/ projects/common/node_modules/

View File

@ -21,4 +21,4 @@ pipeline {
postAlways(); postAlways();
} }
} }
} }c

View File

@ -254,38 +254,38 @@
} }
} }
}, },
"ngx-openlayers": { "ng-openlayers": {
"projectType": "library", "projectType": "library",
"root": "projects/ngx-openlayers", "root": "projects/ng-openlayers",
"sourceRoot": "projects/ngx-openlayers/src", "sourceRoot": "projects/ng-openlayers/src",
"prefix": "lib", "prefix": "lib",
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:ng-packagr", "builder": "@angular-devkit/build-angular:ng-packagr",
"options": { "options": {
"tsConfig": "projects/ngx-openlayers/tsconfig.lib.json", "tsConfig": "projects/ng-openlayers/tsconfig.lib.json",
"project": "projects/ngx-openlayers/ng-package.json" "project": "projects/ng-openlayers/ng-package.json"
}, },
"configurations": { "configurations": {
"production": { "production": {
"tsConfig": "projects/ngx-openlayers/tsconfig.lib.prod.json" "tsConfig": "projects/ng-openlayers/tsconfig.lib.prod.json"
} }
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular-devkit/build-angular:karma",
"options": { "options": {
"main": "projects/ngx-openlayers/src/test.ts", "main": "projects/ng-openlayers/src/test.ts",
"tsConfig": "projects/ngx-openlayers/tsconfig.spec.json", "tsConfig": "projects/ng-openlayers/tsconfig.spec.json",
"karmaConfig": "projects/ngx-openlayers/karma.conf.js" "karmaConfig": "projects/ng-openlayers/karma.conf.js"
} }
}, },
"lint": { "lint": {
"builder": "@angular-eslint/builder:lint", "builder": "@angular-eslint/builder:lint",
"options": { "options": {
"lintFilePatterns": [ "lintFilePatterns": [
"projects/ngx-openlayers/**/*.ts", "projects/ng-openlayers/**/*.ts",
"projects/ngx-openlayers/**/*.html" "projects/ng-openlayers/**/*.html"
] ]
} }
} }

View File

@ -23,7 +23,7 @@
"@farmmaps/common": "file:dist/common", "@farmmaps/common": "file:dist/common",
"@farmmaps/common-map": "file:dist/common-map", "@farmmaps/common-map": "file:dist/common-map",
"@farmmaps/common-map3d": "file:dist/common-map3d", "@farmmaps/common-map3d": "file:dist/common-map3d",
"ngx-openlayers": "file:dist/ngx-openlayers", "ng-openlayers": "file:dist/ng-openlayers",
"@microsoft/signalr": "^3.1.16", "@microsoft/signalr": "^3.1.16",
"@ng-bootstrap/ng-bootstrap": "^15.0.0", "@ng-bootstrap/ng-bootstrap": "^15.0.0",
"@ngrx/effects": "^16", "@ngrx/effects": "^16",

View File

@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
//external modules //external modules
import { AngularOpenlayersModule } from 'ngx-openlayers'; import { AngularOpenlayersModule } from 'ng-openlayers';
import { StoreModule, ActionReducer, MetaReducer } from '@ngrx/store'; import { StoreModule, ActionReducer, MetaReducer } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects'; import { EffectsModule } from '@ngrx/effects';
import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
@ -169,119 +169,119 @@ export {
GeometryThumbnailComponent GeometryThumbnailComponent
} }
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
AngularOpenlayersModule, AngularOpenlayersModule,
MapRoutingModule, MapRoutingModule,
StoreModule.forFeature(MODULE_NAME, mapReducers.reducer, { metaReducers: metaReducers }), StoreModule.forFeature(MODULE_NAME, mapReducers.reducer, { metaReducers: metaReducers }),
EffectsModule.forFeature([mapEffects.MapEffects]), EffectsModule.forFeature([mapEffects.MapEffects]),
NgbModule, NgbModule,
FormsModule, FormsModule,
ReactiveFormsModule, ReactiveFormsModule,
AppCommonModule AppCommonModule
], ],
declarations: [ declarations: [
ZoomToExtentComponent, ZoomToExtentComponent,
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MapComponent, MapComponent,
MetaDataModalComponent, MetaDataModalComponent,
RotationResetComponent, RotationResetComponent,
MapSearchComponent, MapSearchComponent,
SelectPeriodModalComponent, SelectPeriodModalComponent,
LayerListComponent, LayerListComponent,
LegendComponent, LegendComponent,
LayerVectorImageComponent, LayerVectorImageComponent,
FeatureListComponent, FeatureListComponent,
WidgetHostDirective, WidgetHostDirective,
FeatureListContainerComponent, FeatureListContainerComponent,
FeatureListCroppingschemeComponent, FeatureListCroppingschemeComponent,
FeatureListCropfieldComponent, FeatureListCropfieldComponent,
FeatureListFeatureContainerComponent, FeatureListFeatureContainerComponent,
FeatureListFeatureComponent, FeatureListFeatureComponent,
FeatureListFeatureCroppingschemeComponent, FeatureListFeatureCroppingschemeComponent,
FeatureListFeatureCropfieldComponent, FeatureListFeatureCropfieldComponent,
SelectedItemContainerComponent, SelectedItemContainerComponent,
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent, SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListItemComponent, ItemListItemComponent,
ItemListItemContainerComponent, ItemListItemContainerComponent,
ItemListComponent, ItemListComponent,
ItemWidgetListComponent, ItemWidgetListComponent,
WidgetStatusComponent, WidgetStatusComponent,
GpsLocation, GpsLocation,
PanToLocation, PanToLocation,
LayerSwitcher, LayerSwitcher,
HistogramDetailsComponent, HistogramDetailsComponent,
StatisticsDetailsComponent, StatisticsDetailsComponent,
ifZoomToShowDirective, ifZoomToShowDirective,
ZoomToShowAlert, ZoomToShowAlert,
LayerValuesComponent, LayerValuesComponent,
GeometryThumbnailComponent GeometryThumbnailComponent
], ],
exports: [ exports: [
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MetaDataModalComponent, MetaDataModalComponent,
MapComponent, MapComponent,
GpsLocation, GpsLocation,
PanToLocation, PanToLocation,
LayerSwitcher, LayerSwitcher,
FeatureListFeatureComponent, FeatureListFeatureComponent,
FeatureListFeatureCropfieldComponent, FeatureListFeatureCropfieldComponent,
FeatureListFeatureCroppingschemeComponent, FeatureListFeatureCroppingschemeComponent,
SelectedItemContainerComponent, SelectedItemContainerComponent,
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent, SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListItemComponent, ItemListItemComponent,
ItemListItemContainerComponent, ItemListItemContainerComponent,
ItemListComponent, ItemListComponent,
ItemWidgetListComponent, ItemWidgetListComponent,
WidgetStatusComponent, WidgetStatusComponent,
RotationResetComponent, RotationResetComponent,
MapSearchComponent, MapSearchComponent,
SelectPeriodModalComponent, SelectPeriodModalComponent,
LayerListComponent, LayerListComponent,
LegendComponent, LegendComponent,
LayerVectorImageComponent, LayerVectorImageComponent,
FeatureListComponent, FeatureListComponent,
WidgetHostDirective, WidgetHostDirective,
FeatureListContainerComponent, FeatureListContainerComponent,
FeatureListCroppingschemeComponent, FeatureListCroppingschemeComponent,
FeatureListCropfieldComponent, FeatureListCropfieldComponent,
FeatureListFeatureContainerComponent, FeatureListFeatureContainerComponent,
ZoomToExtentComponent, ZoomToExtentComponent,
ifZoomToShowDirective, ifZoomToShowDirective,
ZoomToShowAlert, ZoomToShowAlert,
GeometryThumbnailComponent GeometryThumbnailComponent
], ],
providers: [ providers: [
FeatureIconService, FeatureIconService,
GeolocationService, GeolocationService,
DeviceOrientationService, DeviceOrientationService,
TemporalService, TemporalService,
{ provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true }, { provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true },
{ provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true }, { provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true },
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true }, { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true },
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCroppingschemeComponent, multi: true }, { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCroppingschemeComponent, multi: true },
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCropfieldComponent, multi: true }, { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCropfieldComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemTemporalComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemTemporalComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true },
{ provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true }, { provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true },
{ provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true } { provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true }
] ]
}) })

View File

@ -1,5 +1,5 @@
import { Component, Input, OnDestroy, OnInit, EventEmitter, Output, Inject } from '@angular/core'; import { Component, Input, OnDestroy, OnInit, EventEmitter, Output, Inject } from '@angular/core';
import { MapComponent } from 'ngx-openlayers'; import { MapComponent } from 'ng-openlayers';
import * as proj from 'ol/proj'; import * as proj from 'ol/proj';
import {Point,Geometry} from 'ol/geom'; import {Point,Geometry} from 'ol/geom';

View File

@ -1,5 +1,5 @@
import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges ,Host} from '@angular/core'; import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges ,Host} from '@angular/core';
import { MapComponent } from 'ngx-openlayers'; import { MapComponent } from 'ng-openlayers';
import Overlay from 'ol/Overlay'; import Overlay from 'ol/Overlay';
import { fromLonLat, toLonLat } from 'ol/proj'; import { fromLonLat, toLonLat } from 'ol/proj';

View File

@ -1,5 +1,5 @@
import { Component, Host, Input, Output, EventEmitter,OnDestroy, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core'; import { Component, Host, Input, Output, EventEmitter,OnDestroy, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
import { LayerGroupComponent, MapComponent } from 'ngx-openlayers'; import { LayerGroupComponent, MapComponent } from 'ng-openlayers';
import { ItemService,IItem,AppConfig } from '@farmmaps/common'; import { ItemService,IItem,AppConfig } from '@farmmaps/common';
import { IItemLayer, ITemporalItemLayer} from '../../../models/item.layer'; import { IItemLayer, ITemporalItemLayer} from '../../../models/item.layer';
import { ILayerData} from '../../../models/layer.data'; import { ILayerData} from '../../../models/layer.data';

View File

@ -1,5 +1,5 @@
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken, OnDestroy, LOCALE_ID } from '@angular/core'; import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken, OnDestroy, LOCALE_ID } from '@angular/core';
import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers'; import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ng-openlayers';
import { ItemService, ItemTypeService, IItem, IItemType, FolderService } from '@farmmaps/common'; import { ItemService, ItemTypeService, IItem, IItemType, FolderService } from '@farmmaps/common';
import { Feature } from 'ol'; import { Feature } from 'ol';

View File

@ -3,7 +3,7 @@ import { IItemLayer } from '../../../models/item.layer';
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 * as mapActions from '../../../actions/map.actions'; import * as mapActions from '../../../actions/map.actions';
import { MapComponent } from 'ngx-openlayers'; import { MapComponent } from 'ng-openlayers';
import { ILayervalue } from '../../../models/layer.value'; import { ILayervalue } from '../../../models/layer.value';
import { Observable, interval, Subject } from 'rxjs'; import { Observable, interval, Subject } from 'rxjs';
import { debounce, throttle } from 'rxjs/operators'; import { debounce, throttle } from 'rxjs/operators';

View File

@ -1,5 +1,5 @@
import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
import { LayerVectorComponent, MapComponent } from 'ngx-openlayers'; import { LayerVectorComponent, MapComponent } from 'ng-openlayers';
import RenderType from 'ol/layer/Vector'; import RenderType from 'ol/layer/Vector';
import { Vector as VectorSource } from 'ol/source'; import { Vector as VectorSource } from 'ol/source';
import { Geometry } from 'ol/geom'; import { Geometry } from 'ol/geom';

View File

@ -1,5 +1,5 @@
import { Component, OnInit, Input, Host, OnChanges, SimpleChanges,ChangeDetectorRef } from '@angular/core'; import { Component, OnInit, Input, Host, OnChanges, SimpleChanges,ChangeDetectorRef } from '@angular/core';
import { MapComponent } from 'ngx-openlayers'; import { MapComponent } from 'ng-openlayers';
import {IMapState} from '../../../models/map.state' import {IMapState} from '../../../models/map.state'
import {View} from 'ol'; import {View} from 'ol';
import { fromLonLat } from 'ol/proj'; import { fromLonLat } from 'ol/proj';

View File

@ -1,5 +1,5 @@
import { Component, Host, Input, OnInit, ChangeDetectorRef } from '@angular/core'; import { Component, Host, Input, OnInit, ChangeDetectorRef } from '@angular/core';
import { ViewComponent, MapComponent } from 'ngx-openlayers'; import { ViewComponent, MapComponent } from 'ng-openlayers';
import {View} from 'ol'; import {View} from 'ol';

View File

@ -1,6 +1,6 @@
import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core'; import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { ViewComponent, MapComponent } from 'ngx-openlayers'; import { ViewComponent, MapComponent } from 'ng-openlayers';
@Component({ @Component({

View File

@ -1,7 +1,7 @@
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core'; import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core';
import { Layer } from 'ol/layer'; import { Layer } from 'ol/layer';
import { Source } from 'ol/source'; import { Source } from 'ol/source';
import { MapComponent } from 'ngx-openlayers'; import { MapComponent } from 'ng-openlayers';
@Directive({ @Directive({
selector: '[fmMapIfZoomToShow]', selector: '[fmMapIfZoomToShow]',

View File

@ -1,6 +1,6 @@
import { Component, OnInit,Input,Host } from '@angular/core'; import { Component, OnInit,Input,Host } from '@angular/core';
import { Interaction} from 'ol/interaction'; import { Interaction} from 'ol/interaction';
import { MapComponent } from 'ngx-openlayers'; import { MapComponent } from 'ng-openlayers';
import OLCesium from 'olcs/OLCesium'; import OLCesium from 'olcs/OLCesium';
import RasterSynchronizer from 'olcs/RasterSynchronizer'; import RasterSynchronizer from 'olcs/RasterSynchronizer';
import VectorSynchronizer from 'olcs/VectorSynchronizer'; import VectorSynchronizer from 'olcs/VectorSynchronizer';

View File

@ -10,8 +10,7 @@
], ],
"parserOptions": { "parserOptions": {
"project": [ "project": [
"projects/ngx-openlayers/tsconfig.lib.json", "libs/ng-openlayers/tsconfig.*?.json"
"projects/ngx-openlayers/tsconfig.spec.json"
], ],
"createDefaultProgram": true "createDefaultProgram": true
}, },
@ -42,8 +41,7 @@
"off", "off",
"always" "always"
], ],
"import/order": "off", "import/order": "off"
"no-underscore-dangle": "off"
} }
}, },
{ {

2
projects/ng-openlayers/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/node_modules

View File

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/ng-openlayers'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true,
});
};

View File

@ -1,6 +1,6 @@
{ {
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/ngx-openlayers", "dest": "../../dist/libs/ng-openlayers",
"assets": [ "assets": [
"ngcc.config.js" "ngcc.config.js"
], ],

View File

@ -0,0 +1,3 @@
module.exports = {
ignorableDeepImportMatchers: [/ol\//],
};

33
projects/ng-openlayers/package-lock.json generated Normal file
View File

@ -0,0 +1,33 @@
{
"name": "ng-openlayers",
"version": "17.1.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ng-openlayers",
"version": "17.1.3",
"license": "MPL-2.0",
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": ">=17.0.0",
"@angular/core": ">=17.0.0",
"ol": "^8.2.0"
}
},
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
}
},
"dependencies": {
"tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
}
}
}

View File

@ -0,0 +1,39 @@
{
"name": "ng-openlayers",
"version": "17.1.3",
"description": "OpenLayers library for Angular",
"author": "Kamil Furtak (kamil.furtak@gmail.com)",
"repository": {
"type": "git",
"url": "https://github.com/kamilfurtak/ng-openlayers.git"
},
"bugs": {
"url": "https://github.com/kamilfurtak/ng-openlayers/issues"
},
"homepage": "https://github.com/kamilfurtak/ng-openlayers",
"keywords": [
"ngx-openlayers",
"angular",
"angular17",
"openlayers",
"openlayers8",
"ol8"
],
"license": "MPL-2.0",
"private": false,
"scripts": {
"release": "standard-version -m \"chore(release): version %s\" -t \"\"",
"prepublishOnly": "cp projects/ng-openlayers/README.md dist/ng-openlayers/README.md"
},
"standard-version": {
"postchangelog": "cp projects/ng-openlayers/CHANGELOG.md dist/ng-openlayers/CHANGELOG.md"
},
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": ">=17.0.0",
"@angular/core": ">=17.0.0",
"ol": "^8.2.0"
}
}

View File

@ -0,0 +1,38 @@
{
"name": "ng-openlayers",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/ng-openlayers/src",
"prefix": "lib",
"targets": {
"build": {
"executor": "@nx/angular:package",
"options": {
"tsConfig": "libs/ng-openlayers/tsconfig.lib.json",
"project": "libs/ng-openlayers/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "libs/ng-openlayers/tsconfig.lib.prod.json"
}
}
},
"test": {
"executor": "@angular-devkit/build-angular:karma",
"options": {
"main": "libs/ng-openlayers/src/test.ts",
"tsConfig": "libs/ng-openlayers/tsconfig.spec.json",
"karmaConfig": "libs/ng-openlayers/karma.conf.js"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"libs/ng-openlayers/**/*.ts",
"libs/ng-openlayers/**/*.html"
]
}
}
}
}

View File

@ -1,18 +1,15 @@
import { Component, ElementRef, OnInit } from '@angular/core'; import { Component, ElementRef, OnInit } from '@angular/core';
import { Attribution } from 'ol/control';
@Component({ @Component({
selector: 'aol-attribution', selector: 'aol-attribution',
template: '<ng-content></ng-content>', template: '<ng-content></ng-content>',
}) })
export class AttributionComponent implements OnInit { export class AttributionComponent implements OnInit {
instance: Attribution; label: string;
html: string;
constructor(private elementRef: ElementRef) {} constructor(private elementRef: ElementRef) {}
ngOnInit() { ngOnInit() {
this.html = this.elementRef.nativeElement.innerHTML; this.label = this.elementRef.nativeElement.innerHTML;
this.instance = new Attribution(this);
} }
} }

View File

@ -1,7 +1,6 @@
import { AfterViewInit, Component, ContentChildren, Host, QueryList } from '@angular/core'; import { AfterViewInit, Component, ContentChildren, Host, QueryList } from '@angular/core';
import { Attribution } from 'ol/control';
import { AttributionComponent } from './attribution.component';
import { SourceComponent } from './sources/source.component'; import { SourceComponent } from './sources/source.component';
import { AttributionComponent } from './attribution.component';
@Component({ @Component({
selector: 'aol-attributions', selector: 'aol-attributions',
@ -11,14 +10,14 @@ export class AttributionsComponent implements AfterViewInit {
@ContentChildren(AttributionComponent) @ContentChildren(AttributionComponent)
attributions: QueryList<AttributionComponent>; attributions: QueryList<AttributionComponent>;
instance: Array<Attribution>; instance: Array<string>;
constructor(@Host() private source: SourceComponent) {} constructor(@Host() private source: SourceComponent) {}
/* we can do this at the very end */ /* we can do this at the very end */
ngAfterViewInit() { ngAfterViewInit() {
if (this.attributions.length) { if (this.attributions.length) {
this.instance = this.attributions.map((cmp) => cmp.instance); this.instance = this.attributions.map((cmp) => cmp.label);
// console.log('setting attributions:', this.instance); // console.log('setting attributions:', this.instance);
this.source.instance.setAttributions(this.instance); this.source.instance.setAttributions(this.instance);
} }

View File

@ -1,12 +1,12 @@
import { Component, Input, OnChanges, OnInit, Optional, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, OnInit, Optional, SimpleChanges } from '@angular/core';
import { MapComponent } from './map.component';
import { GeometryLinestringComponent } from './geom/geometrylinestring.component';
import { GeometryPolygonComponent } from './geom/geometrypolygon.component';
import { GeometryMultiPointComponent } from './geom/geometrymultipoint.component';
import { GeometryMultiLinestringComponent } from './geom/geometrymultilinestring.component';
import { GeometryMultiPolygonComponent } from './geom/geometrymultipolygon.component';
import { Coordinate } from 'ol/coordinate'; import { Coordinate } from 'ol/coordinate';
import { transform } from 'ol/proj'; import { transform } from 'ol/proj';
import { GeometryLinestringComponent } from './geom/geometrylinestring.component';
import { GeometryMultiLinestringComponent } from './geom/geometrymultilinestring.component';
import { GeometryMultiPointComponent } from './geom/geometrymultipoint.component';
import { GeometryMultiPolygonComponent } from './geom/geometrymultipolygon.component';
import { GeometryPolygonComponent } from './geom/geometrypolygon.component';
import { MapComponent } from './map.component';
@Component({ @Component({
selector: 'aol-collection-coordinates', selector: 'aol-collection-coordinates',

View File

@ -10,11 +10,14 @@ export class ControlAttributionComponent implements OnInit, OnDestroy {
@Input() @Input()
collapsible: boolean; collapsible: boolean;
componentType = 'control'; public componentType = 'control';
instance: Attribution; instance: Attribution;
target: Element; target: HTMLElement;
constructor(private map: MapComponent, private element: ElementRef) {} constructor(
private map: MapComponent,
private element: ElementRef
) {}
ngOnInit() { ngOnInit() {
this.target = this.element.nativeElement; this.target = this.element.nativeElement;

View File

@ -1,7 +1,7 @@
import { Component, ContentChild, OnDestroy, OnInit } from '@angular/core'; import { Component, ContentChild, OnDestroy, OnInit } from '@angular/core';
import { Control } from 'ol/control'; import { Control } from 'ol/control';
import { ContentComponent } from '../content.component';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { ContentComponent } from '../content.component';
@Component({ @Component({
selector: 'aol-control', selector: 'aol-control',
@ -11,9 +11,9 @@ export class ControlComponent implements OnInit, OnDestroy {
@ContentChild(ContentComponent, { static: true }) @ContentChild(ContentComponent, { static: true })
content: ContentComponent; content: ContentComponent;
componentType = 'control'; public componentType = 'control';
instance: Control; instance: Control;
element: Element; element: HTMLElement;
constructor(private map: MapComponent) {} constructor(private map: MapComponent) {}

View File

@ -1,6 +1,6 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { Collection } from 'ol';
import { Control, defaults } from 'ol/control'; import { Control, defaults } from 'ol/control';
import { Collection } from 'ol';
import { Options as AttributionOptions } from 'ol/control/Attribution'; import { Options as AttributionOptions } from 'ol/control/Attribution';
import { Options as RotateOptions } from 'ol/control/Rotate'; import { Options as RotateOptions } from 'ol/control/Rotate';
import { Options as ZoomOptions } from 'ol/control/Zoom'; import { Options as ZoomOptions } from 'ol/control/Zoom';

View File

@ -1,8 +1,8 @@
import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
import MousePosition from 'ol/control/MousePosition'; import MousePosition from 'ol/control/MousePosition';
import { MapComponent } from '../map.component';
import { CoordinateFormat } from 'ol/coordinate'; import { CoordinateFormat } from 'ol/coordinate';
import { ProjectionLike } from 'ol/proj'; import { ProjectionLike } from 'ol/proj';
import { MapComponent } from '../map.component';
@Component({ @Component({
selector: 'aol-control-mouseposition', selector: 'aol-control-mouseposition',
@ -13,11 +13,14 @@ export class ControlMousePositionComponent implements OnInit, OnDestroy {
coordinateFormat: CoordinateFormat; coordinateFormat: CoordinateFormat;
@Input() @Input()
projection: ProjectionLike; projection: ProjectionLike;
target: Element;
instance: MousePosition; instance: MousePosition;
target: HTMLElement;
constructor(private map: MapComponent, private element: ElementRef) {} constructor(
private map: MapComponent,
private element: ElementRef
) {}
ngOnInit() { ngOnInit() {
this.target = this.element.nativeElement; this.target = this.element.nativeElement;

View File

@ -1,7 +1,7 @@
import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { Component, Input, OnDestroy, OnInit, OnChanges, SimpleChanges } from '@angular/core';
import { Layer } from 'ol/layer';
import { View } from 'ol'; import { View } from 'ol';
import { OverviewMap } from 'ol/control'; import { OverviewMap } from 'ol/control';
import { Layer } from 'ol/layer';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
@Component({ @Component({
@ -20,7 +20,7 @@ export class ControlOverviewMapComponent implements OnInit, OnChanges, OnDestroy
@Input() @Input()
layers: Layer[]; layers: Layer[];
@Input() @Input()
target: Element; target: HTMLElement;
@Input() @Input()
tipLabel: string; tipLabel: string;
@Input() @Input()

View File

@ -1,6 +1,7 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { ScaleLine } from 'ol/control'; import { ScaleLine } from 'ol/control';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { Units } from 'ol/control/ScaleLine';
@Component({ @Component({
selector: 'aol-control-scaleline', selector: 'aol-control-scaleline',
@ -8,13 +9,11 @@ import { MapComponent } from '../map.component';
}) })
export class ControlScaleLineComponent implements OnInit, OnDestroy { export class ControlScaleLineComponent implements OnInit, OnDestroy {
@Input() @Input()
units: string; units: Units;
instance: ScaleLine; instance: ScaleLine;
constructor(private map: MapComponent) { constructor(private map: MapComponent) {}
// console.log('instancing aol-control-scaleline');
}
ngOnInit() { ngOnInit() {
this.instance = new ScaleLine(this); this.instance = new ScaleLine(this);
@ -22,7 +21,6 @@ export class ControlScaleLineComponent implements OnInit, OnDestroy {
} }
ngOnDestroy() { ngOnDestroy() {
// console.log('removing aol-control-scaleline');
this.map.instance.removeControl(this.instance); this.map.instance.removeControl(this.instance);
} }
} }

View File

@ -10,9 +10,9 @@ export class ControlZoomComponent implements OnInit, OnDestroy {
@Input() @Input()
duration: number; duration: number;
@Input() @Input()
zoomInLabel: string | Node; zoomInLabel: string | HTMLElement;
@Input() @Input()
zoomOutLabel: string | Node; zoomOutLabel: string | HTMLElement;
@Input() @Input()
zoomInTipLabel: string; zoomInTipLabel: string;
@Input() @Input()

View File

@ -1,7 +1,7 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { ZoomToExtent } from 'ol/control'; import { ZoomToExtent } from 'ol/control';
import { Extent } from 'ol/extent';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { Extent } from 'ol/extent';
@Component({ @Component({
selector: 'aol-control-zoomtoextent', selector: 'aol-control-zoomtoextent',
@ -11,7 +11,7 @@ export class ControlZoomToExtentComponent implements OnInit, OnDestroy {
@Input() @Input()
className: string; className: string;
@Input() @Input()
label: string | Node; label: string | HTMLElement;
@Input() @Input()
tipLabel: string; tipLabel: string;
@Input() @Input()

View File

@ -1,10 +1,10 @@
import { Component, Input, OnChanges, OnInit, Optional, SimpleChanges } from '@angular/core'; import { Component, Optional, OnChanges, Input, SimpleChanges, OnInit } from '@angular/core';
import { transform } from 'ol/proj'; import { transform } from 'ol/proj';
import { GeometryCircleComponent } from './geom/geometrycircle.component';
import { GeometryPointComponent } from './geom/geometrypoint.component';
import { MapComponent } from './map.component'; import { MapComponent } from './map.component';
import { OverlayComponent } from './overlay.component'; import { GeometryPointComponent } from './geom/geometrypoint.component';
import { GeometryCircleComponent } from './geom/geometrycircle.component';
import { ViewComponent } from './view.component'; import { ViewComponent } from './view.component';
import { OverlayComponent } from './overlay.component';
@Component({ @Component({
selector: 'aol-coordinate', selector: 'aol-coordinate',

View File

@ -1,4 +1,4 @@
import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { Component, OnInit, OnDestroy, OnChanges, Input, SimpleChanges } from '@angular/core';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { SourceVectorComponent } from './sources/vector.component'; import { SourceVectorComponent } from './sources/vector.component';
@ -10,8 +10,8 @@ export class FeatureComponent implements OnInit, OnDestroy, OnChanges {
@Input() @Input()
id: string | number | undefined; id: string | number | undefined;
componentType = 'feature'; public componentType = 'feature';
instance: Feature; public instance: Feature;
constructor(private host: SourceVectorComponent) {} constructor(private host: SourceVectorComponent) {}

View File

@ -1,8 +1,7 @@
import { Component, forwardRef, Input } from '@angular/core'; import { Component, forwardRef, Input } from '@angular/core';
import { MVT } from 'ol/format';
import { Geometry } from 'ol/geom';
import GeometryType from 'ol/geom/GeometryType';
import { FormatComponent } from './format.component'; import { FormatComponent } from './format.component';
import { MVT } from 'ol/format';
import { FeatureClass } from 'ol/Feature';
@Component({ @Component({
selector: 'aol-format-mvt', selector: 'aol-format-mvt',
@ -11,9 +10,7 @@ import { FormatComponent } from './format.component';
}) })
export class FormatMVTComponent extends FormatComponent { export class FormatMVTComponent extends FormatComponent {
@Input() @Input()
featureClass: featureClass: FeatureClass;
| ((geom: Geometry | { [k: string]: any }) => any)
| ((geom: GeometryType, arg2: number[], arg3: number[] | number[][], arg4: { [k: string]: any }) => any);
@Input() @Input()
geometryName: string; geometryName: string;
@Input() @Input()

View File

@ -1,23 +1,14 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { Circle } from 'ol/geom';
import { FeatureComponent } from '../feature.component'; import { FeatureComponent } from '../feature.component';
import { MapComponent } from '../map.component'; import { Circle } from 'ol/geom';
import { SimpleGeometryComponent } from './simplegeometry.component'; import { SimpleGeometryComponent } from './simplegeometry.component';
import { MapComponent } from '../map.component';
@Component({ @Component({
selector: 'aol-geometry-circle', selector: 'aol-geometry-circle',
template: ` <ng-content></ng-content> `, template: ` <ng-content></ng-content> `,
}) })
export class GeometryCircleComponent extends SimpleGeometryComponent implements OnInit { export class GeometryCircleComponent extends SimpleGeometryComponent implements OnInit {
componentType = 'geometry-circle';
instance: Circle;
constructor(map: MapComponent, host: FeatureComponent) {
super(map, host);
// defaulting coordinates to [0,0]. To be overridden in child component.
this.instance = new Circle([0, 0]);
}
@Input() @Input()
get radius(): number { get radius(): number {
return this.instance.getRadius(); return this.instance.getRadius();
@ -25,4 +16,13 @@ export class GeometryCircleComponent extends SimpleGeometryComponent implements
set radius(radius: number) { set radius(radius: number) {
this.instance.setRadius(radius); this.instance.setRadius(radius);
} }
public componentType = 'geometry-circle';
public instance: Circle;
constructor(map: MapComponent, host: FeatureComponent) {
super(map, host);
// defaulting coordinates to [0,0]. To be overridden in child component.
this.instance = new Circle([0, 0]);
}
} }

View File

@ -1,16 +1,20 @@
import { Directive, Input, OnInit } from '@angular/core'; import { Input, OnInit, Directive } from '@angular/core';
import SimpleGeometry from 'ol/geom/SimpleGeometry';
import { FeatureComponent } from '../feature.component'; import { FeatureComponent } from '../feature.component';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import SimpleGeometry from 'ol/geom/SimpleGeometry';
@Directive() @Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class SimpleGeometryComponent implements OnInit { export abstract class SimpleGeometryComponent implements OnInit {
@Input() srid: string; @Input() srid: string;
instance: SimpleGeometry; public instance: SimpleGeometry;
componentType = 'simple-geometry'; public componentType = 'simple-geometry';
constructor(protected map: MapComponent, protected host: FeatureComponent) {} protected constructor(
protected map: MapComponent,
protected host: FeatureComponent
) {}
ngOnInit() { ngOnInit() {
this.host.instance.setGeometry(this.instance); this.host.instance.setGeometry(this.instance);

View File

@ -1,4 +1,4 @@
import { AfterContentInit, Component, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'; import { Component, Input, AfterContentInit, OnChanges, SimpleChanges, OnDestroy } from '@angular/core';
import { Graticule } from 'ol'; import { Graticule } from 'ol';
import { Stroke } from 'ol/style'; import { Stroke } from 'ol/style';
import { MapComponent } from './map.component'; import { MapComponent } from './map.component';
@ -18,7 +18,7 @@ export class GraticuleComponent implements AfterContentInit, OnChanges, OnDestro
latLabelPosition: number; latLabelPosition: number;
instance: any; instance: any;
componentType = 'graticule'; public componentType = 'graticule';
constructor(private map: MapComponent) {} constructor(private map: MapComponent) {}

View File

@ -1,4 +1,4 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { defaults, Interaction } from 'ol/interaction'; import { defaults, Interaction } from 'ol/interaction';
import { Collection } from 'ol'; import { Collection } from 'ol';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
@ -8,12 +8,35 @@ import { MapComponent } from '../map.component';
template: '', template: '',
}) })
export class DefaultInteractionComponent implements OnInit, OnDestroy { export class DefaultInteractionComponent implements OnInit, OnDestroy {
@Input()
altShiftDragRotate: boolean;
@Input()
onFocusOnly: boolean;
@Input()
doubleClickZoom: boolean;
@Input()
keyboard: boolean;
@Input()
mouseWheelZoom: boolean;
@Input()
shiftDragZoom: boolean;
@Input()
dragPan: boolean;
@Input()
pinchRotate: boolean;
@Input()
pinchZoom: boolean;
@Input()
zoomDelta: number;
@Input()
zoomDuration: number;
instance: Collection<Interaction>; instance: Collection<Interaction>;
constructor(private map: MapComponent) {} constructor(private map: MapComponent) {}
ngOnInit() { ngOnInit() {
this.instance = defaults(); this.instance = defaults(this);
this.instance.forEach((i) => this.map.instance.addInteraction(i)); this.instance.forEach((i) => this.map.instance.addInteraction(i));
} }

View File

@ -1,8 +1,8 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import Feature from 'ol/format/Feature';
import { DragAndDrop } from 'ol/interaction'; import { DragAndDrop } from 'ol/interaction';
import { ProjectionLike } from 'ol/proj'; import FeatureFormat from 'ol/format/Feature';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { ProjectionLike } from 'ol/proj';
@Component({ @Component({
selector: 'aol-interaction-draganddrop', selector: 'aol-interaction-draganddrop',
@ -10,11 +10,11 @@ import { MapComponent } from '../map.component';
}) })
export class DragAndDropInteractionComponent implements OnInit, OnDestroy { export class DragAndDropInteractionComponent implements OnInit, OnDestroy {
@Input() @Input()
formatConstructors: ((n: Feature) => any)[]; formatConstructors: FeatureFormat[];
@Input() @Input()
projection: ProjectionLike; projection: ProjectionLike;
@Input() @Input()
target: Element; target: HTMLElement;
instance: DragAndDrop; instance: DragAndDrop;

View File

@ -1,8 +1,8 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { Condition } from 'ol/events/condition';
import { DragBox } from 'ol/interaction'; import { DragBox } from 'ol/interaction';
import { EndCondition } from 'ol/interaction/DragBox';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { Condition } from 'ol/events/condition';
import { EndCondition } from 'ol/interaction/DragBox';
@Component({ @Component({
selector: 'aol-interaction-dragbox', selector: 'aol-interaction-dragbox',

View File

@ -1,8 +1,8 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import Kinetic from 'ol/Kinetic';
import { Condition } from 'ol/events/condition';
import { DragPan } from 'ol/interaction'; import { DragPan } from 'ol/interaction';
import Kinetic from 'ol/Kinetic';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { Condition } from 'ol/events/condition';
@Component({ @Component({
selector: 'aol-interaction-dragpan', selector: 'aol-interaction-dragpan',

View File

@ -1,7 +1,7 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { Condition } from 'ol/events/condition';
import { DragRotate } from 'ol/interaction'; import { DragRotate } from 'ol/interaction';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { Condition } from 'ol/events/condition';
@Component({ @Component({
selector: 'aol-interaction-dragrotate', selector: 'aol-interaction-dragrotate',

View File

@ -1,7 +1,7 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { Condition } from 'ol/events/condition';
import { DragRotateAndZoom } from 'ol/interaction'; import { DragRotateAndZoom } from 'ol/interaction';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { Condition } from 'ol/events/condition';
@Component({ @Component({
selector: 'aol-interaction-dragrotateandzoom', selector: 'aol-interaction-dragrotateandzoom',

View File

@ -1,7 +1,7 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { Condition } from 'ol/events/condition';
import { DragZoom } from 'ol/interaction'; import { DragZoom } from 'ol/interaction';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { Condition } from 'ol/events/condition';
@Component({ @Component({
selector: 'aol-interaction-dragzoom', selector: 'aol-interaction-dragzoom',

View File

@ -1,13 +1,15 @@
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { Component, Input, OnDestroy, OnInit, EventEmitter, Output } from '@angular/core';
import { Collection, Feature } from 'ol'; import { MapComponent } from '../map.component';
import { Condition } from 'ol/events/condition';
import GeometryType from 'ol/geom/GeometryType';
import { Draw } from 'ol/interaction'; import { Draw } from 'ol/interaction';
import { DrawEvent, GeometryFunction } from 'ol/interaction/Draw'; import { Collection, Feature } from 'ol';
import { Vector } from 'ol/source'; import { Vector } from 'ol/source';
import { Style } from 'ol/style'; import { Style } from 'ol/style';
import { DrawEvent, GeometryFunction } from 'ol/interaction/Draw';
import { StyleFunction } from 'ol/style/Style'; import { StyleFunction } from 'ol/style/Style';
import { MapComponent } from '../map.component'; import { Condition } from 'ol/events/condition';
import { Type } from 'ol/geom/Geometry';
import { ObjectEvent } from 'ol/Object';
import BaseEvent from 'ol/events/Event';
@Component({ @Component({
selector: 'aol-interaction-draw', selector: 'aol-interaction-draw',
@ -23,7 +25,7 @@ export class DrawInteractionComponent implements OnInit, OnDestroy {
@Input() @Input()
snapTolerance?: number; snapTolerance?: number;
@Input() @Input()
type: GeometryType; type: Type;
@Input() @Input()
maxPoints?: number; maxPoints?: number;
@Input() @Input()
@ -48,13 +50,17 @@ export class DrawInteractionComponent implements OnInit, OnDestroy {
@Output() @Output()
olChange = new EventEmitter<DrawEvent>(); olChange = new EventEmitter<DrawEvent>();
@Output() @Output()
olChangeActive = new EventEmitter<DrawEvent>(); olChangeActive = new EventEmitter<ObjectEvent>();
@Output()
olDrawAbort = new EventEmitter<DrawEvent>();
@Output() @Output()
drawEnd = new EventEmitter<DrawEvent>(); drawEnd = new EventEmitter<DrawEvent>();
@Output() @Output()
drawStart = new EventEmitter<DrawEvent>(); drawStart = new EventEmitter<DrawEvent>();
@Output() @Output()
propertyChange = new EventEmitter<DrawEvent>(); olError = new EventEmitter<BaseEvent>();
@Output()
propertyChange = new EventEmitter<ObjectEvent>();
instance: Draw; instance: Draw;
@ -63,10 +69,12 @@ export class DrawInteractionComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.instance = new Draw(this); this.instance = new Draw(this);
this.instance.on('change', (event: DrawEvent) => this.olChange.emit(event)); this.instance.on('change', (event: DrawEvent) => this.olChange.emit(event));
this.instance.on('change:active', (event: DrawEvent) => this.olChangeActive.emit(event)); this.instance.on('change:active', (event: ObjectEvent) => this.olChangeActive.emit(event));
this.instance.on('drawabort', (event: DrawEvent) => this.olDrawAbort.emit(event));
this.instance.on('drawend', (event: DrawEvent) => this.drawEnd.emit(event)); this.instance.on('drawend', (event: DrawEvent) => this.drawEnd.emit(event));
this.instance.on('drawstart', (event: DrawEvent) => this.drawStart.emit(event)); this.instance.on('drawstart', (event: DrawEvent) => this.drawStart.emit(event));
this.instance.on('propertychange', (event: DrawEvent) => this.propertyChange.emit(event)); this.instance.on('error', (event: BaseEvent) => this.olError.emit(event));
this.instance.on('propertychange', (event: ObjectEvent) => this.propertyChange.emit(event));
this.map.instance.addInteraction(this.instance); this.map.instance.addInteraction(this.instance);
} }

View File

@ -0,0 +1,27 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { KeyboardPan } from 'ol/interaction';
import { MapComponent } from '../map.component';
@Component({
selector: 'aol-interaction-keyboardpan',
template: '',
})
export class KeyboardPanInteractionComponent implements OnInit, OnDestroy {
@Input()
duration: number;
@Input()
pixelDelta: number;
instance: KeyboardPan;
constructor(private map: MapComponent) {}
ngOnInit() {
this.instance = new KeyboardPan(this);
this.map.instance.addInteraction(this.instance);
}
ngOnDestroy() {
this.map.instance.removeInteraction(this.instance);
}
}

View File

@ -0,0 +1,27 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { KeyboardZoom } from 'ol/interaction';
import { MapComponent } from '../map.component';
@Component({
selector: 'aol-interaction-keyboardpan',
template: '',
})
export class KeyboardZoomInteractionComponent implements OnInit, OnDestroy {
@Input()
duration: number;
@Input()
delta: number;
instance: KeyboardZoom;
constructor(private map: MapComponent) {}
ngOnInit() {
this.instance = new KeyboardZoom(this);
this.map.instance.addInteraction(this.instance);
}
ngOnDestroy() {
this.map.instance.removeInteraction(this.instance);
}
}

View File

@ -1,12 +1,15 @@
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Collection, Feature } from 'ol';
import { Condition } from 'ol/events/condition';
import { Modify } from 'ol/interaction';
import { ModifyEvent } from 'ol/interaction/Modify';
import { Vector } from 'ol/source';
import { Style } from 'ol/style';
import { StyleFunction } from 'ol/style/Style';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { Modify } from 'ol/interaction';
import { Collection, Feature } from 'ol';
import { Style } from 'ol/style';
import { Vector } from 'ol/source';
import { ModifyEvent } from 'ol/interaction/Modify';
import { StyleFunction } from 'ol/style/Style';
import { Condition } from 'ol/events/condition';
import { ObjectEvent } from 'ol/Object';
import { DrawEvent } from 'ol/interaction/Draw';
import BaseEvent from 'ol/events/Event';
@Component({ @Component({
selector: 'aol-interaction-modify', selector: 'aol-interaction-modify',
@ -29,15 +32,17 @@ export class ModifyInteractionComponent implements OnInit, OnDestroy {
source?: Vector; source?: Vector;
@Output() @Output()
modifyEnd = new EventEmitter<ModifyEvent>(); olChange = new EventEmitter<DrawEvent>();
@Output() @Output()
modifyStart = new EventEmitter<ModifyEvent>(); olChangeActive = new EventEmitter<ObjectEvent>();
@Output() @Output()
olChange = new EventEmitter<ModifyEvent>(); olError = new EventEmitter<BaseEvent>();
@Output() @Output()
olChangeActive = new EventEmitter<ModifyEvent>(); olModifyEnd = new EventEmitter<ModifyEvent>();
@Output() @Output()
propertyChange = new EventEmitter<ModifyEvent>(); olModifyStart = new EventEmitter<ModifyEvent>();
@Output()
propertyChange = new EventEmitter<ObjectEvent>();
instance: Modify; instance: Modify;
@ -45,11 +50,12 @@ export class ModifyInteractionComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.instance = new Modify(this); this.instance = new Modify(this);
this.instance.on('change', (event: ModifyEvent) => this.olChange.emit(event)); this.instance.on('change', (event: DrawEvent) => this.olChange.emit(event));
this.instance.on('change:active', (event: ModifyEvent) => this.olChangeActive.emit(event)); this.instance.on('change:active', (event: ObjectEvent) => this.olChangeActive.emit(event));
this.instance.on('propertychange', (event: ModifyEvent) => this.propertyChange.emit(event)); this.instance.on('error', (event: BaseEvent) => this.olError.emit(event));
this.instance.on('modifyend', (event: ModifyEvent) => this.modifyEnd.emit(event)); this.instance.on('modifyend', (event: ModifyEvent) => this.olModifyEnd.emit(event));
this.instance.on('modifystart', (event: ModifyEvent) => this.modifyStart.emit(event)); this.instance.on('modifystart', (event: ModifyEvent) => this.olModifyStart.emit(event));
this.instance.on('propertychange', (event: ObjectEvent) => this.propertyChange.emit(event));
this.map.instance.addInteraction(this.instance); this.map.instance.addInteraction(this.instance);
} }

View File

@ -1,4 +1,4 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { PinchZoom } from 'ol/interaction'; import { PinchZoom } from 'ol/interaction';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';

View File

@ -1,12 +1,14 @@
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Collection, Feature } from 'ol'; import { MapComponent } from '../map.component';
import { Condition } from 'ol/events/condition';
import { Select } from 'ol/interaction'; import { Select } from 'ol/interaction';
import { FilterFunction, SelectEvent } from 'ol/interaction/Select';
import { Layer } from 'ol/layer'; import { Layer } from 'ol/layer';
import { Style } from 'ol/style'; import { Style } from 'ol/style';
import { Collection, Feature } from 'ol';
import { SelectEvent, FilterFunction } from 'ol/interaction/Select';
import { StyleFunction } from 'ol/style/Style'; import { StyleFunction } from 'ol/style/Style';
import { MapComponent } from '../map.component'; import { Condition } from 'ol/events/condition';
import { ObjectEvent } from 'ol/Object';
import BaseEvent from 'ol/events/Event';
@Component({ @Component({
selector: 'aol-interaction-select', selector: 'aol-interaction-select',
@ -33,15 +35,17 @@ export class SelectInteractionComponent implements OnInit, OnDestroy {
filter?: FilterFunction; filter?: FilterFunction;
@Input() @Input()
wrapX?: boolean; wrapX?: boolean;
@Input()
hitTolerance?: number;
@Output() @Output()
olChange = new EventEmitter<SelectEvent>(); olChange = new EventEmitter<SelectEvent>();
@Output() @Output()
olSelect = new EventEmitter<SelectEvent>(); olChangeActive = new EventEmitter<ObjectEvent>();
@Output() @Output()
propertyChange = new EventEmitter<SelectEvent>(); olError = new EventEmitter<BaseEvent>();
@Output()
propertyChange = new EventEmitter<ObjectEvent>();
@Output()
olSelect = new EventEmitter<SelectEvent>();
instance: Select; instance: Select;
@ -51,9 +55,10 @@ export class SelectInteractionComponent implements OnInit, OnDestroy {
this.instance = new Select(this); this.instance = new Select(this);
this.instance.on('change', (event: SelectEvent) => this.olChange.emit(event)); this.instance.on('change', (event: SelectEvent) => this.olChange.emit(event));
this.instance.on('change:active', (event: ObjectEvent) => this.olChangeActive.emit(event));
this.instance.on('error', (event: BaseEvent) => this.olError.emit(event));
this.instance.on('propertychange', (event: ObjectEvent) => this.propertyChange.emit(event));
this.instance.on('select', (event: SelectEvent) => this.olSelect.emit(event)); this.instance.on('select', (event: SelectEvent) => this.olSelect.emit(event));
this.instance.on('propertychange', (event: SelectEvent) => this.propertyChange.emit(event));
this.map.instance.addInteraction(this.instance); this.map.instance.addInteraction(this.instance);
} }

View File

@ -1,9 +1,11 @@
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Collection, Feature } from 'ol';
import { Translate } from 'ol/interaction'; import { Translate } from 'ol/interaction';
import { TranslateEvent } from 'ol/interaction/Translate'; import { Collection, Feature } from 'ol';
import { Layer } from 'ol/layer'; import { Layer } from 'ol/layer';
import { TranslateEvent } from 'ol/interaction/Translate';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import BaseEvent from 'ol/events/Event';
import { ObjectEvent } from 'ol/Object';
@Component({ @Component({
selector: 'aol-interaction-translate', selector: 'aol-interaction-translate',
@ -18,31 +20,31 @@ export class TranslateInteractionComponent implements OnInit, OnDestroy {
hitTolerance?: number; hitTolerance?: number;
@Output() @Output()
olChange: EventEmitter<TranslateEvent>; olChange = new EventEmitter<BaseEvent>();
@Output() @Output()
propertyChange: EventEmitter<TranslateEvent>; olChangeActive = new EventEmitter<ObjectEvent>();
@Output() @Output()
translateEnd: EventEmitter<TranslateEvent>; olError = new EventEmitter<BaseEvent>();
@Output() @Output()
translateStart: EventEmitter<TranslateEvent>; propertyChange = new EventEmitter<ObjectEvent>();
@Output() @Output()
translating: EventEmitter<TranslateEvent>; translateEnd = new EventEmitter<TranslateEvent>();
@Output()
translateStart = new EventEmitter<TranslateEvent>();
@Output()
translating = new EventEmitter<TranslateEvent>();
instance: Translate; instance: Translate;
constructor(private map: MapComponent) { constructor(private map: MapComponent) {}
this.olChange = new EventEmitter<TranslateEvent>();
this.propertyChange = new EventEmitter<TranslateEvent>();
this.translateEnd = new EventEmitter<TranslateEvent>();
this.translateStart = new EventEmitter<TranslateEvent>();
this.translating = new EventEmitter<TranslateEvent>();
}
ngOnInit() { ngOnInit() {
this.instance = new Translate(this); this.instance = new Translate(this);
this.instance.on('change', (event: TranslateEvent) => this.olChange.emit(event)); this.instance.on('change', (event: BaseEvent) => this.olChange.emit(event));
this.instance.on('propertychange', (event: TranslateEvent) => this.propertyChange.emit(event)); this.instance.on('change:active', (event: ObjectEvent) => this.olChangeActive.emit(event));
this.instance.on('error', (event: BaseEvent) => this.olError.emit(event));
this.instance.on('propertychange', (event: ObjectEvent) => this.propertyChange.emit(event));
this.instance.on('translateend', (event: TranslateEvent) => this.translateEnd.emit(event)); this.instance.on('translateend', (event: TranslateEvent) => this.translateEnd.emit(event));
this.instance.on('translatestart', (event: TranslateEvent) => this.translateStart.emit(event)); this.instance.on('translatestart', (event: TranslateEvent) => this.translateStart.emit(event));
this.instance.on('translating', (event: TranslateEvent) => this.translating.emit(event)); this.instance.on('translating', (event: TranslateEvent) => this.translating.emit(event));

View File

@ -1,10 +1,11 @@
import { Directive, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { OnDestroy, OnInit, OnChanges, Input, SimpleChanges, Directive } from '@angular/core';
import { Event } from 'ol/events'; import Event from 'ol/events/Event';
import { Extent } from 'ol/extent';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { LayerGroupComponent } from './layergroup.component'; import { LayerGroupComponent } from './layergroup.component';
import { Extent } from 'ol/extent';
@Directive() @Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class LayerComponent implements OnInit, OnChanges, OnDestroy { export abstract class LayerComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
opacity: number; opacity: number;
@ -24,10 +25,10 @@ export abstract class LayerComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
postrender: (evt: Event) => void; postrender: (evt: Event) => void;
instance: any; public instance: any;
componentType = 'layer'; public componentType = 'layer';
constructor(protected host: MapComponent | LayerGroupComponent) {} protected constructor(protected host: MapComponent | LayerGroupComponent) {}
ngOnInit() { ngOnInit() {
if (this.prerender !== null && this.prerender !== undefined) { if (this.prerender !== null && this.prerender !== undefined) {

View File

@ -1,9 +1,9 @@
import { Component, Input, OnChanges, OnInit, Optional, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, OnInit, Optional, SimpleChanges } from '@angular/core';
import { Extent } from 'ol/extent';
import { Image } from 'ol/layer'; import { Image } from 'ol/layer';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { LayerComponent } from './layer.component'; import { LayerComponent } from './layer.component';
import { LayerGroupComponent } from './layergroup.component'; import { LayerGroupComponent } from './layergroup.component';
import { Extent } from 'ol/extent';
@Component({ @Component({
selector: 'aol-layer-image', selector: 'aol-layer-image',
@ -23,8 +23,6 @@ export class LayerImageComponent extends LayerComponent implements OnInit, OnCha
@Input() @Input()
zIndex: number; zIndex: number;
source: Image;
constructor(map: MapComponent, @Optional() group?: LayerGroupComponent) { constructor(map: MapComponent, @Optional() group?: LayerGroupComponent) {
super(group || map); super(group || map);
} }

View File

@ -1,4 +1,4 @@
import { Component, Input, OnChanges, OnDestroy, OnInit, Optional, SimpleChanges } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, Optional, OnChanges, SimpleChanges } from '@angular/core';
import { Tile } from 'ol/layer'; import { Tile } from 'ol/layer';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { LayerComponent } from './layer.component'; import { LayerComponent } from './layer.component';
@ -14,8 +14,6 @@ export class LayerTileComponent extends LayerComponent implements OnInit, OnDest
@Input() @Input()
useInterimTilesOnError: boolean; useInterimTilesOnError: boolean;
source: Tile;
constructor(map: MapComponent, @Optional() group?: LayerGroupComponent) { constructor(map: MapComponent, @Optional() group?: LayerGroupComponent) {
super(group || map); super(group || map);
} }

View File

@ -1,8 +1,8 @@
import { Component, Input, OnChanges, OnDestroy, OnInit, Optional, SimpleChanges } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, Optional, OnChanges, SimpleChanges } from '@angular/core';
import { MapComponent } from '../map.component';
import { Vector } from 'ol/layer'; import { Vector } from 'ol/layer';
import { Style } from 'ol/style'; import { Style } from 'ol/style';
import { StyleFunction } from 'ol/style/Style'; import { StyleFunction } from 'ol/style/Style';
import { MapComponent } from '../map.component';
import { LayerComponent } from './layer.component'; import { LayerComponent } from './layer.component';
import { LayerGroupComponent } from './layergroup.component'; import { LayerGroupComponent } from './layergroup.component';
@ -23,8 +23,6 @@ export class LayerVectorComponent extends LayerComponent implements OnInit, OnDe
@Input() @Input()
updateWhileInteracting: boolean; updateWhileInteracting: boolean;
source: Vector;
constructor(map: MapComponent, @Optional() group?: LayerGroupComponent) { constructor(map: MapComponent, @Optional() group?: LayerGroupComponent) {
super(group || map); super(group || map);
} }

View File

@ -1,6 +1,5 @@
import { Component, OnInit, Input, Optional, SimpleChanges, OnChanges } from '@angular/core'; import { Component, OnInit, Input, Optional, SimpleChanges, OnChanges } from '@angular/core';
import { VectorTile } from 'ol/layer'; import { VectorTile } from 'ol/layer';
import { RenderType } from 'ol/layer/VectorTile';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { Style } from 'ol/style'; import { Style } from 'ol/style';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
@ -16,7 +15,7 @@ export class LayerVectorTileComponent extends LayerComponent implements OnInit,
@Input() @Input()
renderBuffer: number; renderBuffer: number;
@Input() @Input()
renderMode: RenderType | string; renderMode: any | string;
/* not marked as optional in the typings */ /* not marked as optional in the typings */
@Input() @Input()
renderOrder: (feature1: Feature, feature2: Feature) => number; renderOrder: (feature1: Feature, feature2: Feature) => number;

View File

@ -0,0 +1,142 @@
import {
Component,
OnInit,
ElementRef,
Input,
Output,
EventEmitter,
AfterViewInit,
SimpleChanges,
OnChanges,
} from '@angular/core';
import { Map } from 'ol';
import MapBrowserEvent from 'ol/MapBrowserEvent';
import MapEvent from 'ol/MapEvent';
import { ObjectEvent } from 'ol/Object';
import RenderEvent from 'ol/render/Event';
import { Control } from 'ol/control';
import { Interaction } from 'ol/interaction';
import { DrawEvent } from 'ol/interaction/Draw';
import BaseEvent from 'ol/events/Event';
@Component({
selector: 'aol-map',
template: `
<div [style.width]="width" [style.height]="height"></div>
<ng-content></ng-content>
`,
})
export class MapComponent implements OnInit, AfterViewInit, OnChanges {
@Input()
width = '100%';
@Input()
height = '100%';
@Input()
pixelRatio: number;
@Input()
keyboardEventTarget: HTMLElement | string;
@Input()
loadTilesWhileAnimating: boolean;
@Input()
loadTilesWhileInteracting: boolean;
@Input()
logo: string | boolean;
@Input()
renderer: 'canvas' | 'webgl';
@Output()
olChange = new EventEmitter<DrawEvent>();
@Output()
olChangeLayerGroup = new EventEmitter<ObjectEvent>();
@Output()
olChangeSize = new EventEmitter<ObjectEvent>();
@Output()
olChangeTarget = new EventEmitter<ObjectEvent>();
@Output()
olChangeView = new EventEmitter<ObjectEvent>();
@Output()
olClick = new EventEmitter<MapBrowserEvent<MouseEvent>>();
@Output()
dblClick = new EventEmitter<MapBrowserEvent<MouseEvent>>();
@Output()
olError = new EventEmitter<BaseEvent>();
@Output()
loadEnd = new EventEmitter<MapEvent>();
@Output()
loadStart = new EventEmitter<MapEvent>();
@Output()
moveEnd = new EventEmitter<MapEvent>();
@Output()
moveStart = new EventEmitter<MapEvent>();
@Output()
pointerDrag = new EventEmitter<MapBrowserEvent<MouseEvent>>();
@Output()
pointerMove = new EventEmitter<MapBrowserEvent<MouseEvent>>();
@Output()
olPostCompose = new EventEmitter<RenderEvent>();
@Output()
olPostRender = new EventEmitter<RenderEvent>();
@Output()
olPreCompose = new EventEmitter<RenderEvent>();
@Output()
olPropertyChange = new EventEmitter<ObjectEvent>();
@Output()
postRender = new EventEmitter<MapEvent>();
@Output()
propertyChange = new EventEmitter<ObjectEvent>();
@Output()
singleClick = new EventEmitter<MapBrowserEvent<MouseEvent>>();
public instance: Map;
public componentType = 'map';
// we pass empty arrays to not get default controls/interactions because we have our own directives
controls: Control[] = [];
interactions: Interaction[] = [];
constructor(private host: ElementRef) {}
ngOnInit() {
// console.log('creating ol.Map instance with:', this);
this.instance = new Map(this);
this.instance.setTarget(this.host.nativeElement.firstElementChild);
this.instance.on('change', (event: DrawEvent) => this.olChange.emit(event));
this.instance.on('change:layergroup', (event: ObjectEvent) => this.olChangeLayerGroup.emit(event));
this.instance.on('change:size', (event: ObjectEvent) => this.olChangeSize.emit(event));
this.instance.on('change:target', (event: ObjectEvent) => this.olChangeTarget.emit(event));
this.instance.on('change:view', (event: ObjectEvent) => this.olChangeView.emit(event));
this.instance.on('click', (event: MapBrowserEvent<MouseEvent>) => this.olClick.emit(event));
this.instance.on('dblclick', (event: MapBrowserEvent<MouseEvent>) => this.dblClick.emit(event));
this.instance.on('error', (event: BaseEvent) => this.olError.emit(event));
this.instance.on('loadend', (event: MapEvent) => this.loadEnd.emit(event));
this.instance.on('loadstart', (event: MapEvent) => this.loadStart.emit(event));
this.instance.on('moveend', (event: MapEvent) => this.moveEnd.emit(event));
this.instance.on('movestart', (event: MapEvent) => this.moveStart.emit(event));
this.instance.on('pointerdrag', (event: MapBrowserEvent<MouseEvent>) => this.pointerDrag.emit(event));
this.instance.on('pointermove', (event: MapBrowserEvent<MouseEvent>) => this.pointerMove.emit(event));
this.instance.on('postcompose', (event: RenderEvent) => this.olPostCompose.emit(event));
this.instance.on('postrender', (event: RenderEvent) => this.olPostRender.emit(event));
this.instance.on('postrender', (event: MapEvent) => this.postRender.emit(event));
this.instance.on('precompose', (event: RenderEvent) => this.olPreCompose.emit(event));
this.instance.on('propertychange', (event: ObjectEvent) => this.olPropertyChange.emit(event));
this.instance.on('singleclick', (event: MapBrowserEvent<MouseEvent>) => this.singleClick.emit(event));
}
ngOnChanges(changes: SimpleChanges) {
const properties: { [index: string]: any } = {};
if (!this.instance) {
return;
}
for (const key in changes) {
if (changes.hasOwnProperty(key)) {
properties[key] = changes[key].currentValue;
}
}
// console.log('changes detected in aol-map, setting new properties: ', properties);
this.instance.setProperties(properties, false);
}
ngAfterViewInit() {
this.instance.updateSize();
}
}

View File

@ -1,8 +1,7 @@
import { Component, ContentChild, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, ContentChild, Input, OnDestroy, OnInit } from '@angular/core';
import { Overlay, PanOptions } from 'ol';
import OverlayPositioning from 'ol/OverlayPositioning';
import { ContentComponent } from './content.component';
import { MapComponent } from './map.component'; import { MapComponent } from './map.component';
import Overlay, { PanOptions, Positioning } from 'ol/Overlay';
import { ContentComponent } from './content.component';
@Component({ @Component({
selector: 'aol-overlay', selector: 'aol-overlay',
@ -17,7 +16,7 @@ export class OverlayComponent implements OnInit, OnDestroy {
@Input() @Input()
offset: number[]; offset: number[];
@Input() @Input()
positioning: OverlayPositioning | string; positioning: Positioning;
@Input() @Input()
stopEvent: boolean; stopEvent: boolean;
@Input() @Input()
@ -31,7 +30,7 @@ export class OverlayComponent implements OnInit, OnDestroy {
componentType = 'overlay'; componentType = 'overlay';
instance: Overlay; instance: Overlay;
element: Element; element: HTMLElement;
constructor(private map: MapComponent) {} constructor(private map: MapComponent) {}

View File

@ -1,8 +1,8 @@
import { Component, Host, Input, OnInit, forwardRef } from '@angular/core'; import { Component, Host, Input, OnInit, forwardRef } from '@angular/core';
import { LoadFunction } from 'ol/Tile';
import { BingMaps } from 'ol/source'; import { BingMaps } from 'ol/source';
import { LayerTileComponent } from '../layers/layertile.component';
import { SourceComponent } from './source.component'; import { SourceComponent } from './source.component';
import { LayerTileComponent } from '../layers/layertile.component';
import { LoadFunction } from 'ol/Tile';
@Component({ @Component({
selector: 'aol-source-bingmaps', selector: 'aol-source-bingmaps',

View File

@ -29,10 +29,11 @@ export class SourceClusterComponent extends SourceComponent implements AfterCont
@Input() @Input()
wrapX?: boolean; wrapX?: boolean;
@ContentChild(SourceVectorComponent) @ContentChild(SourceVectorComponent, { static: false })
sourceVectorComponent: SourceVectorComponent; sourceVectorComponent: SourceVectorComponent;
source: Vector;
instance: Cluster; instance: Cluster;
source: Vector;
constructor(@Host() layer: LayerVectorComponent) { constructor(@Host() layer: LayerVectorComponent) {
super(layer); super(layer);

View File

@ -1,10 +1,10 @@
import { Component, Host, Input, OnInit, forwardRef } from '@angular/core'; import { Component, Host, Input, OnInit, forwardRef } from '@angular/core';
import { Feature } from 'ol';
import { GeoJSON } from 'ol/format';
import { ProjectionLike } from 'ol/proj';
import { Vector } from 'ol/source';
import { LayerVectorComponent } from '../layers/layervector.component'; import { LayerVectorComponent } from '../layers/layervector.component';
import { SourceComponent } from './source.component'; import { SourceComponent } from './source.component';
import FeatureFormat from 'ol/format/Feature';
import { Vector } from 'ol/source';
import { GeoJSON } from 'ol/format';
import { ProjectionLike } from 'ol/proj';
@Component({ @Component({
selector: 'aol-source-geojson', selector: 'aol-source-geojson',
@ -22,7 +22,7 @@ export class SourceGeoJSONComponent extends SourceComponent implements OnInit {
url: string; url: string;
instance: Vector; instance: Vector;
format: Feature; format: FeatureFormat;
constructor(@Host() layer: LayerVectorComponent) { constructor(@Host() layer: LayerVectorComponent) {
super(layer); super(layer);

View File

@ -9,13 +9,13 @@ import {
Output, Output,
SimpleChanges, SimpleChanges,
} from '@angular/core'; } from '@angular/core';
import { LoadFunction } from 'ol/Image'; import ImageArcGISRest from 'ol/source/ImageArcGISRest';
import { ProjectionLike } from 'ol/proj';
import { ImageArcGISRest } from 'ol/source';
import { ImageSourceEvent } from 'ol/source/Image';
import { AttributionLike } from 'ol/source/Source';
import { LayerImageComponent } from '../layers/layerimage.component'; import { LayerImageComponent } from '../layers/layerimage.component';
import { SourceComponent } from './source.component'; import { SourceComponent } from './source.component';
import { ProjectionLike } from 'ol/proj';
import { AttributionLike } from 'ol/source/Source';
import { LoadFunction } from 'ol/Image';
import { ImageSourceEvent } from 'ol/source/Image';
@Component({ @Component({
selector: 'aol-source-imagearcgisrest', selector: 'aol-source-imagearcgisrest',
@ -25,7 +25,7 @@ import { SourceComponent } from './source.component';
export class SourceImageArcGISRestComponent extends SourceComponent implements OnInit, OnChanges { export class SourceImageArcGISRestComponent extends SourceComponent implements OnInit, OnChanges {
@Input() projection: ProjectionLike | string; @Input() projection: ProjectionLike | string;
@Input() url: string; @Input() url: string;
@Input() attributions: AttributionLike[]; @Input() attributions: AttributionLike;
@Input() crossOrigin?: string; @Input() crossOrigin?: string;
@Input() imageLoadFunction?: LoadFunction; @Input() imageLoadFunction?: LoadFunction;
@Input() params?: { [k: string]: any }; @Input() params?: { [k: string]: any };

View File

@ -1,23 +1,23 @@
import { import {
Component, Component,
EventEmitter,
Host, Host,
Input, Input,
OnChanges,
OnInit,
Output,
SimpleChanges,
forwardRef, forwardRef,
Output,
EventEmitter,
OnChanges,
SimpleChanges,
OnInit,
} from '@angular/core'; } from '@angular/core';
import { LoadFunction } from 'ol/Image';
import { Extent } from 'ol/extent';
import { ProjectionLike } from 'ol/proj';
import { Size } from 'ol/size';
import { ImageStatic } from 'ol/source'; import { ImageStatic } from 'ol/source';
import { ImageSourceEvent } from 'ol/source/Image';
import { AttributionLike } from 'ol/source/Source';
import { LayerImageComponent } from '../layers/layerimage.component';
import { SourceComponent } from './source.component'; import { SourceComponent } from './source.component';
import { LayerImageComponent } from '../layers/layerimage.component';
import { ProjectionLike } from 'ol/proj';
import { Extent } from 'ol/extent';
import { AttributionLike } from 'ol/source/Source';
import { LoadFunction } from 'ol/Image';
import { Size } from 'ol/size';
import { ImageSourceEvent } from 'ol/source/Image';
@Component({ @Component({
selector: 'aol-source-imagestatic', selector: 'aol-source-imagestatic',

View File

@ -16,6 +16,7 @@ import { ProjectionLike } from 'ol/proj';
import { AttributionLike } from 'ol/source/Source'; import { AttributionLike } from 'ol/source/Source';
import { LoadFunction } from 'ol/Image'; import { LoadFunction } from 'ol/Image';
import { ImageSourceEvent } from 'ol/source/Image'; import { ImageSourceEvent } from 'ol/source/Image';
import { ServerType } from 'ol/source/WMSServerType';
@Component({ @Component({
selector: 'aol-source-imagewms', selector: 'aol-source-imagewms',
@ -30,7 +31,7 @@ export class SourceImageWMSComponent extends SourceComponent implements OnChange
@Input() @Input()
hidpi: boolean; hidpi: boolean;
@Input() @Input()
serverType: string; serverType: ServerType;
@Input() @Input()
imageLoadFunction?: LoadFunction; imageLoadFunction?: LoadFunction;
@Input() @Input()

View File

@ -33,11 +33,11 @@ export class SourceOsmComponent extends SourceXYZComponent implements AfterConte
wrapX: boolean; wrapX: boolean;
@Output() @Output()
tileLoadStart: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadStart = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadEnd: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadEnd = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadError: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadError = new EventEmitter<TileSourceEvent>();
instance: OSM; instance: OSM;
@ -53,12 +53,10 @@ export class SourceOsmComponent extends SourceXYZComponent implements AfterConte
if (this.tileGridXYZ) { if (this.tileGridXYZ) {
this.tileGrid = this.tileGridXYZ.instance; this.tileGrid = this.tileGridXYZ.instance;
} }
this.instance = new OSM(this); this.instance = new OSM(this);
this.instance.on('tileloadstart', (event: TileSourceEvent) => this.tileLoadStart.emit(event)); this.instance.on('tileloadstart', (event: TileSourceEvent) => this.tileLoadStart.emit(event));
this.instance.on('tileloadend', (event: TileSourceEvent) => this.tileLoadEnd.emit(event)); this.instance.on('tileloadend', (event: TileSourceEvent) => this.tileLoadEnd.emit(event));
this.instance.on('tileloaderror', (event: TileSourceEvent) => this.tileLoadError.emit(event)); this.instance.on('tileloaderror', (event: TileSourceEvent) => this.tileLoadError.emit(event));
this._register(this.instance); this.register(this.instance);
} }
} }

View File

@ -9,7 +9,7 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { Raster, Source } from 'ol/source'; import { Raster, Source } from 'ol/source';
import { Operation, RasterOperationType, RasterSourceEvent } from 'ol/source/Raster'; import { Operation, RasterSourceEvent } from 'ol/source/Raster';
import { LayerImageComponent } from '../layers/layerimage.component'; import { LayerImageComponent } from '../layers/layerimage.component';
import { SourceComponent } from './source.component'; import { SourceComponent } from './source.component';
@ -32,21 +32,17 @@ export class SourceRasterComponent extends SourceComponent implements AfterConte
@Input() @Input()
lib?: any; lib?: any;
@Input() @Input()
operationType?: RasterOperationType; operationType?: 'pixel' | 'image';
@Output() @Output()
beforeOperations: EventEmitter<RasterSourceEvent> = new EventEmitter<RasterSourceEvent>(); beforeOperations = new EventEmitter<RasterSourceEvent>();
@Output() @Output()
afterOperations: EventEmitter<RasterSourceEvent> = new EventEmitter<RasterSourceEvent>(); afterOperations = new EventEmitter<RasterSourceEvent>();
instance: Raster; instance: Raster;
sources: Source[] = []; sources: Source[] = [];
constructor(@Host() layer: LayerImageComponent) { @ContentChild(SourceComponent, { static: false })
super(layer);
}
@ContentChild(SourceComponent)
set source(sourceComponent: SourceComponent) { set source(sourceComponent: SourceComponent) {
this.sources = [sourceComponent.instance]; this.sources = [sourceComponent.instance];
if (this.instance) { if (this.instance) {
@ -55,6 +51,10 @@ export class SourceRasterComponent extends SourceComponent implements AfterConte
} }
} }
constructor(@Host() layer: LayerImageComponent) {
super(layer);
}
ngAfterContentInit() { ngAfterContentInit() {
this.init(); this.init();
} }
@ -63,6 +63,6 @@ export class SourceRasterComponent extends SourceComponent implements AfterConte
this.instance = new Raster(this); this.instance = new Raster(this);
this.instance.on('beforeoperations', (event: RasterSourceEvent) => this.beforeOperations.emit(event)); this.instance.on('beforeoperations', (event: RasterSourceEvent) => this.beforeOperations.emit(event));
this.instance.on('afteroperations', (event: RasterSourceEvent) => this.afterOperations.emit(event)); this.instance.on('afteroperations', (event: RasterSourceEvent) => this.afterOperations.emit(event));
this._register(this.instance); this.register(this.instance);
} }
} }

View File

@ -1,9 +1,10 @@
import { Directive, Input, OnDestroy } from '@angular/core'; import { Input, OnDestroy, Directive } from '@angular/core';
import { Source } from 'ol'; import Source from 'ol/source/Source';
import { LayerComponent } from '../layers/layer.component'; import { LayerComponent } from '../layers/layer.component';
@Directive() @Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class SourceComponent implements OnDestroy { export abstract class SourceComponent implements OnDestroy {
@Input() @Input()
attributions: any; attributions: any;
@ -11,7 +12,7 @@ export abstract class SourceComponent implements OnDestroy {
public instance: Source; public instance: Source;
public componentType = 'source'; public componentType = 'source';
constructor(protected host: LayerComponent) {} protected constructor(protected host: LayerComponent) {}
ngOnDestroy() { ngOnDestroy() {
if (this.host && this.host.instance) { if (this.host && this.host.instance) {
@ -19,7 +20,7 @@ export abstract class SourceComponent implements OnDestroy {
} }
} }
protected _register(s: Source) { protected register(s: Source) {
if (this.host) { if (this.host) {
this.host.instance.setSource(s); this.host.instance.setSource(s);
} }

View File

@ -2,8 +2,9 @@ import { Component, Host, Input, OnChanges, OnInit, forwardRef, SimpleChanges }
import { LayerTileComponent } from '../layers/layertile.component'; import { LayerTileComponent } from '../layers/layertile.component';
import { SourceComponent } from './source.component'; import { SourceComponent } from './source.component';
import { TileWMS } from 'ol/source'; import { TileWMS } from 'ol/source';
import { TileGrid } from 'ol/tilegrid'; import TileGrid from 'ol/tilegrid/TileGrid';
import { LoadFunction } from 'ol/Tile'; import { LoadFunction } from 'ol/Tile';
import { ServerType } from 'ol/source/WMSServerType';
@Component({ @Component({
selector: 'aol-source-tilewms', selector: 'aol-source-tilewms',
@ -26,7 +27,7 @@ export class SourceTileWMSComponent extends SourceComponent implements OnChanges
@Input() @Input()
reprojectionErrorThreshold: number; reprojectionErrorThreshold: number;
@Input() @Input()
serverType: string; serverType: ServerType;
@Input() @Input()
tileGrid: TileGrid; tileGrid: TileGrid;
@Input() @Input()

View File

@ -13,12 +13,12 @@ import {
import { LayerTileComponent } from '../layers/layertile.component'; import { LayerTileComponent } from '../layers/layertile.component';
import { SourceComponent } from './source.component'; import { SourceComponent } from './source.component';
import { TileGridWMTSComponent } from '../tilegridwmts.component'; import { TileGridWMTSComponent } from '../tilegridwmts.component';
import { WMTS } from 'ol/source'; import { WMTS as SourceWMTS } from 'ol/source';
import { WMTS as TileGridWMTS } from 'ol/tilegrid'; import WMTS from 'ol/tilegrid/WMTS';
import { WMTSRequestEncoding } from 'ol/source';
import { ProjectionLike } from 'ol/proj'; import { ProjectionLike } from 'ol/proj';
import { LoadFunction } from 'ol/Tile'; import { LoadFunction } from 'ol/Tile';
import { TileSourceEvent } from 'ol/source/Tile'; import { TileSourceEvent } from 'ol/source/Tile';
import { RequestEncoding } from 'ol/source/WMTS';
@Component({ @Component({
selector: 'aol-source-tilewmts', selector: 'aol-source-tilewmts',
@ -31,13 +31,13 @@ export class SourceTileWMTSComponent extends SourceComponent implements AfterCon
@Input() @Input()
crossOrigin?: string; crossOrigin?: string;
@Input() @Input()
tileGrid: TileGridWMTS; tileGrid: WMTS;
@Input() @Input()
projection: ProjectionLike; projection: ProjectionLike;
@Input() @Input()
reprojectionErrorThreshold?: number; reprojectionErrorThreshold?: number;
@Input() @Input()
requestEncoding?: WMTSRequestEncoding | string; requestEncoding?: RequestEncoding | undefined;
@Input() @Input()
layer: string; layer: string;
@Input() @Input()
@ -64,16 +64,16 @@ export class SourceTileWMTSComponent extends SourceComponent implements AfterCon
wrapX?: boolean; wrapX?: boolean;
@Output() @Output()
tileLoadStart: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadStart = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadEnd: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadEnd = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadError: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadError = new EventEmitter<TileSourceEvent>();
@ContentChild(TileGridWMTSComponent) @ContentChild(TileGridWMTSComponent, { static: false })
tileGridWMTS: TileGridWMTSComponent; tileGridWMTS: TileGridWMTSComponent;
instance: WMTS; instance: SourceWMTS;
constructor(@Host() layer: LayerTileComponent) { constructor(@Host() layer: LayerTileComponent) {
super(layer); super(layer);
@ -101,7 +101,7 @@ export class SourceTileWMTSComponent extends SourceComponent implements AfterCon
} }
setLayerSource(): void { setLayerSource(): void {
this.instance = new WMTS(this); this.instance = new SourceWMTS(this);
this.instance.on('tileloadstart', (event: TileSourceEvent) => this.tileLoadStart.emit(event)); this.instance.on('tileloadstart', (event: TileSourceEvent) => this.tileLoadStart.emit(event));
this.instance.on('tileloadend', (event: TileSourceEvent) => this.tileLoadEnd.emit(event)); this.instance.on('tileloadend', (event: TileSourceEvent) => this.tileLoadEnd.emit(event));
this.instance.on('tileloaderror', (event: TileSourceEvent) => this.tileLoadError.emit(event)); this.instance.on('tileloaderror', (event: TileSourceEvent) => this.tileLoadError.emit(event));

View File

@ -2,6 +2,7 @@ import { Component, Host, Input, OnInit, forwardRef } from '@angular/core';
import { SourceComponent } from './source.component'; import { SourceComponent } from './source.component';
import { LayerTileComponent } from '../layers/layertile.component'; import { LayerTileComponent } from '../layers/layertile.component';
import { UTFGrid } from 'ol/source'; import { UTFGrid } from 'ol/source';
import { Config } from 'ol/source/TileJSON';
@Component({ @Component({
selector: 'aol-source-utfgrid', selector: 'aol-source-utfgrid',
@ -9,7 +10,7 @@ import { UTFGrid } from 'ol/source';
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceUTFGridComponent) }], providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceUTFGridComponent) }],
}) })
export class SourceUTFGridComponent extends SourceComponent implements OnInit { export class SourceUTFGridComponent extends SourceComponent implements OnInit {
@Input() tileJSON: JSON; @Input() tileJSON: Config;
@Input() url: string; @Input() url: string;
instance: UTFGrid; instance: UTFGrid;

View File

@ -1,5 +1,5 @@
import { Component, Host, Input, forwardRef, ContentChild, AfterContentInit } from '@angular/core'; import { Component, Host, Input, forwardRef, ContentChild, AfterContentInit } from '@angular/core';
import { VectorTile } from 'ol'; import { VectorTile } from 'ol/source';
import Feature from 'ol/format/Feature'; import Feature from 'ol/format/Feature';
import TileGrid from 'ol/tilegrid/TileGrid'; import TileGrid from 'ol/tilegrid/TileGrid';
import { LayerVectorTileComponent } from '../layers/layervectortile.component'; import { LayerVectorTileComponent } from '../layers/layervectortile.component';
@ -32,16 +32,15 @@ export class SourceVectorTileComponent extends SourceComponent implements AfterC
@Input() @Input()
wrapX: boolean; wrapX: boolean;
@ContentChild(FormatComponent) @ContentChild(FormatComponent, { static: false })
formatComponent: FormatComponent; formatComponent: FormatComponent;
@ContentChild(TileGridComponent) @ContentChild(TileGridComponent, { static: false })
tileGridComponent: TileGridComponent; tileGridComponent: TileGridComponent;
public instance: VectorTile;
format: Feature; format: Feature;
tileGrid: TileGrid; tileGrid: TileGrid;
instance: VectorTile;
constructor(@Host() layer: LayerVectorTileComponent) { constructor(@Host() layer: LayerVectorTileComponent) {
super(layer); super(layer);
} }

View File

@ -58,15 +58,15 @@ export class SourceXYZComponent extends SourceComponent implements AfterContentI
@Input() @Input()
wrapX: boolean; wrapX: boolean;
@ContentChild(TileGridComponent) @ContentChild(TileGridComponent, { static: false })
tileGridXYZ: TileGridComponent; tileGridXYZ: TileGridComponent;
@Output() @Output()
tileLoadStart: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadStart = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadEnd: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadEnd = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadError: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>(); tileLoadError = new EventEmitter<TileSourceEvent>();
instance: XYZ; instance: XYZ;
@ -110,6 +110,6 @@ export class SourceXYZComponent extends SourceComponent implements AfterContentI
this.instance.on('tileloadend', (event: TileSourceEvent) => this.tileLoadEnd.emit(event)); this.instance.on('tileloadend', (event: TileSourceEvent) => this.tileLoadEnd.emit(event));
this.instance.on('tileloaderror', (event: TileSourceEvent) => this.tileLoadError.emit(event)); this.instance.on('tileloaderror', (event: TileSourceEvent) => this.tileLoadError.emit(event));
this._register(this.instance); this.register(this.instance);
} }
} }

View File

@ -1,5 +1,5 @@
import { Component, Input, Host, AfterContentInit, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'; import { Component, Input, Host, AfterContentInit, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
import { AtlasManager, Circle, Fill, Stroke } from 'ol/style'; import { Circle, Fill, Stroke } from 'ol/style';
import { StyleComponent } from './style.component'; import { StyleComponent } from './style.component';
@Component({ @Component({
@ -15,11 +15,9 @@ export class StyleCircleComponent implements AfterContentInit, OnChanges, OnDest
snapToPixel: boolean; snapToPixel: boolean;
@Input() @Input()
stroke: Stroke; stroke: Stroke;
@Input()
atlasManager: AtlasManager;
componentType = 'style-circle'; public componentType = 'style-circle';
instance: Circle; public instance: Circle;
constructor(@Host() private host: StyleComponent) {} constructor(@Host() private host: StyleComponent) {}

View File

@ -14,9 +14,8 @@ export class StyleFillComponent implements OnInit, OnChanges {
@Input() @Input()
color: Color | ColorLike; color: Color | ColorLike;
instance: Fill; public instance: Fill;
/* the typings do not have the setters */ private readonly host: StyleComponent | StyleCircleComponent | StyleTextComponent;
private host: /*StyleComponent|StyleCircleComponent|StyleTextComponent*/ any;
constructor( constructor(
@Optional() styleHost: StyleComponent, @Optional() styleHost: StyleComponent,
@ -48,12 +47,11 @@ export class StyleFillComponent implements OnInit, OnChanges {
this.host.instance.setFill(this.instance); this.host.instance.setFill(this.instance);
break; break;
case 'style-circle': case 'style-circle':
this.host.fill = this.instance; (this.host as StyleCircleComponent).fill = this.instance;
// console.log('setting ol.style.circle instance\'s fill:', this.host); // console.log('setting ol.style.circle instance\'s fill:', this.host);
break; break;
default: default:
throw new Error('unknown host type: ' + this.host); throw new Error('unknown host type: ' + this.host);
// break;
} }
} }

View File

@ -1,8 +1,11 @@
import { Component, Input, Host, OnInit, OnChanges, SimpleChanges } from '@angular/core'; import { Component, Input, Host, OnInit, OnChanges, SimpleChanges } from '@angular/core';
import { Icon } from 'ol/style'; import { Icon } from 'ol/style';
import IconAnchorUnits from 'ol/style/IconAnchorUnits';
import IconOrigin from 'ol/style/IconOrigin'; // TODO https://github.com/openlayers/openlayers/issues/12694
// import IconAnchorUnits from 'ol/style/IconAnchorUnits';
// import IconOrigin from 'ol/style/IconOrigin';
import { StyleComponent } from './style.component'; import { StyleComponent } from './style.component';
import { IconAnchorUnits, IconOrigin } from 'ol/style/Icon';
@Component({ @Component({
selector: 'aol-style-icon', selector: 'aol-style-icon',
@ -22,7 +25,7 @@ export class StyleIconComponent implements OnInit, OnChanges {
@Input() @Input()
crossOrigin: IconOrigin; crossOrigin: IconOrigin;
@Input() @Input()
img: string; img: HTMLCanvasElement | HTMLImageElement;
@Input() @Input()
offset: [number, number]; offset: [number, number];
@Input() @Input()
@ -44,7 +47,7 @@ export class StyleIconComponent implements OnInit, OnChanges {
@Input() @Input()
src: string; src: string;
instance: Icon; public instance: Icon;
constructor(@Host() private host: StyleComponent) {} constructor(@Host() private host: StyleComponent) {}

View File

@ -14,19 +14,19 @@ export class StyleStrokeComponent implements OnInit, OnChanges {
@Input() @Input()
color: Color | ColorLike; color: Color | ColorLike;
@Input() @Input()
lineCap: string; lineCap: CanvasLineCap | undefined;
@Input() @Input()
lineDash: number[]; lineDash: number[];
@Input() @Input()
lineJoin: string; lineJoin: CanvasLineJoin | undefined;
@Input() @Input()
miterLimit: number; miterLimit: number;
@Input() @Input()
width: number; width: number;
instance: Stroke; public instance: Stroke;
/* the typings do not have the setters */ /* the typings do not have the setters */
host: /*StyleComponent|StyleCircleComponent|StyleTextComponent*/ any; private readonly host: StyleComponent | StyleCircleComponent | StyleTextComponent;
constructor( constructor(
@Optional() styleHost: StyleComponent, @Optional() styleHost: StyleComponent,
@ -58,7 +58,7 @@ export class StyleStrokeComponent implements OnInit, OnChanges {
this.host.instance.setStroke(this.instance); this.host.instance.setStroke(this.instance);
break; break;
case 'style-circle': case 'style-circle':
this.host.stroke = this.instance; (this.host as StyleCircleComponent).stroke = this.instance;
// console.log('setting ol.style.circle instance\'s stroke:', this.host); // console.log('setting ol.style.circle instance\'s stroke:', this.host);
break; break;
default: default:

View File

@ -23,9 +23,9 @@ export class StyleComponent implements OnInit {
@Input() @Input()
zIndex: number; zIndex: number;
instance: Style; public instance: Style;
componentType = 'style'; public componentType = 'style';
private host: FeatureComponent | LayerVectorComponent; private readonly host: FeatureComponent | LayerVectorComponent;
constructor(@Optional() featureHost: FeatureComponent, @Optional() layerHost: LayerVectorComponent) { constructor(@Optional() featureHost: FeatureComponent, @Optional() layerHost: LayerVectorComponent) {
// console.log('creating aol-style'); // console.log('creating aol-style');

View File

@ -22,12 +22,12 @@ export class StyleTextComponent implements OnInit, OnChanges {
@Input() @Input()
text: string | undefined; text: string | undefined;
@Input() @Input()
textAlign: string | undefined; textAlign: CanvasTextAlign | undefined;
@Input() @Input()
textBaseLine: string | undefined; textBaseLine: string | undefined;
instance: Text; public instance: Text;
componentType = 'style-text'; public componentType = 'style-text';
constructor(@Optional() private host: StyleComponent) { constructor(@Optional() private host: StyleComponent) {
if (!host) { if (!host) {
@ -73,4 +73,6 @@ export class StyleTextComponent implements OnInit, OnChanges {
this.host.update(); this.host.update();
// console.log('changes detected in aol-style-text, setting new properties: ', changes); // console.log('changes detected in aol-style-text, setting new properties: ', changes);
} }
update() {}
} }

View File

@ -20,7 +20,7 @@ export class TileGridWMTSComponent extends TileGridComponent implements OnInit {
@Input() @Input()
sizes?: Size[]; sizes?: Size[];
@Input() @Input()
tileSizes?: (number | Size)[]; tileSizes?: Size[];
@Input() @Input()
widths?: number[]; widths?: number[];

Some files were not shown because too many files have changed in this diff Show More