Compare commits

..

No commits in common. "d306d5c4c10f7ae8977edb026e4a548f1f1ee4d2" and "6356f149a6af4b1553f14787aa30b57f118dd96c" have entirely different histories.

116 changed files with 6560 additions and 8052 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/ng-openlayers/node_modules/ projects/ngx-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 @@
} }
} }
}, },
"ng-openlayers": { "ngx-openlayers": {
"projectType": "library", "projectType": "library",
"root": "projects/ng-openlayers", "root": "projects/ngx-openlayers",
"sourceRoot": "projects/ng-openlayers/src", "sourceRoot": "projects/ngx-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/ng-openlayers/tsconfig.lib.json", "tsConfig": "projects/ngx-openlayers/tsconfig.lib.json",
"project": "projects/ng-openlayers/ng-package.json" "project": "projects/ngx-openlayers/ng-package.json"
}, },
"configurations": { "configurations": {
"production": { "production": {
"tsConfig": "projects/ng-openlayers/tsconfig.lib.prod.json" "tsConfig": "projects/ngx-openlayers/tsconfig.lib.prod.json"
} }
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular-devkit/build-angular:karma",
"options": { "options": {
"main": "projects/ng-openlayers/src/test.ts", "main": "projects/ngx-openlayers/src/test.ts",
"tsConfig": "projects/ng-openlayers/tsconfig.spec.json", "tsConfig": "projects/ngx-openlayers/tsconfig.spec.json",
"karmaConfig": "projects/ng-openlayers/karma.conf.js" "karmaConfig": "projects/ngx-openlayers/karma.conf.js"
} }
}, },
"lint": { "lint": {
"builder": "@angular-eslint/builder:lint", "builder": "@angular-eslint/builder:lint",
"options": { "options": {
"lintFilePatterns": [ "lintFilePatterns": [
"projects/ng-openlayers/**/*.ts", "projects/ngx-openlayers/**/*.ts",
"projects/ng-openlayers/**/*.html" "projects/ngx-openlayers/**/*.html"
] ]
} }
} }

13014
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"name": "farmmaps-lib-app", "name": "farmmaps-lib-app",
"version": "4.5.0", "version": "4.5.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build", "build": "ng build",
@ -10,20 +10,20 @@
"e2e": "ng e2e" "e2e": "ng e2e"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^17.3.3", "@angular/animations": "^16.2.12",
"@angular/common": "^17.3.3", "@angular/common": "^16.2.12",
"@angular/compiler": "^17.3.3", "@angular/compiler": "^16.2.12",
"@angular/core": "^17.3.3", "@angular/core": "^16.2.12",
"@angular-eslint/eslint-plugin": "^15.2.1", "@angular-eslint/eslint-plugin": "^15.2.1",
"@angular/forms": "^17.3.3", "@angular/forms": "^16.2.12",
"@angular/platform-browser": "^17.3.3", "@angular/platform-browser": "^16.2.12",
"@angular/platform-browser-dynamic": "^17.3.3", "@angular/platform-browser-dynamic": "^16.2.12",
"@angular/router": "^17.3.3", "@angular/router": "^16.2.12",
"@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",
"ng-openlayers": "file:dist/ng-openlayers", "ngx-openlayers": "file:dist/ngx-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",
@ -40,10 +40,10 @@
"https-browserify": "^1.0.0", "https-browserify": "^1.0.0",
"moment": "^2.29.4", "moment": "^2.29.4",
"ngrx-store-localstorage": "16.0.0", "ngrx-store-localstorage": "16.0.0",
"ngx-avatars": "1.7.0", "ngx-avatars": "1.5.0",
"ngx-clipboard": "^15.1.0", "ngx-clipboard": "^15.1.0",
"ngx-image-cropper": "^7.2.1", "ngx-image-cropper": "^7.2.1",
"ngx-uploadx": "^6.2.0", "ngx-uploadx": "^5.2.0",
"ol": "~6.3.1", "ol": "~6.3.1",
"olcs": "^2.13.1", "olcs": "^2.13.1",
"resumablejs": "^1.1.0", "resumablejs": "^1.1.0",
@ -54,15 +54,15 @@
"tslib": "^2.4.0", "tslib": "^2.4.0",
"url": "^0.11.0", "url": "^0.11.0",
"util": "^0.12.4", "util": "^0.12.4",
"zone.js": "~0.14.4" "zone.js": "~0.13.3"
}, },
"devDependencies": { "devDependencies": {
"@angular-builders/custom-webpack": "^16", "@angular-builders/custom-webpack": "^16",
"@angular-devkit/build-angular": "^17.3.3", "@angular-devkit/build-angular": "^16.2.11",
"@angular/cli": "^17.3.3", "@angular/cli": "^16.2.11",
"@angular/compiler-cli": "^17.3.3", "@angular/compiler-cli": "^16.2.12",
"@angular/language-service": "^17.3.3", "@angular/language-service": "^16.2.12",
"@angular/localize": "^17.3.3", "@angular/localize": "^16.2.12",
"@types/arcgis-rest-api": "^10.4.5", "@types/arcgis-rest-api": "^10.4.5",
"@types/jasmine": "~2.8.8", "@types/jasmine": "~2.8.8",
"@types/jasminewd2": "^2.0.9", "@types/jasminewd2": "^2.0.9",
@ -81,9 +81,9 @@
"karma-coverage-istanbul-reporter": "^3.0.3", "karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "^5.1.0", "karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.0.0", "karma-jasmine-html-reporter": "^2.0.0",
"ng-packagr": "^17.3.0", "ng-packagr": "^16.2.3",
"protractor": "~7.0.0", "protractor": "~7.0.0",
"ts-node": "^8.8.1", "ts-node": "^8.8.1",
"typescript": "~5.4.4" "typescript": "~4.9.3"
} }
} }

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 'ng-openlayers'; import { AngularOpenlayersModule } from 'ngx-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 'ng-openlayers'; import { MapComponent } from 'ngx-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 'ng-openlayers'; import { MapComponent } from 'ngx-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 'ng-openlayers'; import { LayerGroupComponent, MapComponent } from 'ngx-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 'ng-openlayers'; import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-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 'ng-openlayers'; import { MapComponent } from 'ngx-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 'ng-openlayers'; import { LayerVectorComponent, MapComponent } from 'ngx-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 'ng-openlayers'; import { MapComponent } from 'ngx-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 'ng-openlayers'; import { ViewComponent, MapComponent } from 'ngx-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 'ng-openlayers'; import { ViewComponent, MapComponent } from 'ngx-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 'ng-openlayers'; import { MapComponent } from 'ngx-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 'ng-openlayers'; import { MapComponent } from 'ngx-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

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

View File

@ -1,32 +0,0 @@
// 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,3 +0,0 @@
module.exports = {
ignorableDeepImportMatchers: [/ol\//],
};

View File

@ -1,33 +0,0 @@
{
"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

@ -1,39 +0,0 @@
{
"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

@ -1,38 +0,0 @@
{
"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,27 +0,0 @@
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

@ -1,27 +0,0 @@
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,142 +0,0 @@
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,27 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipLibCheck": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
],
"include": [
"**/*.ts"
]
}

View File

@ -1,9 +0,0 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": [
"./tslint.json",
"tslint-config-prettier",
"tslint-plugin-prettier"
]
}

View File

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

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/libs/ng-openlayers", "dest": "../../dist/ngx-openlayers",
"assets": [ "assets": [
"ngcc.config.js" "ngcc.config.js"
], ],

View File

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

View File

@ -0,0 +1,17 @@
{
"name": "ngx-openlayers",
"version": "2.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ngx-openlayers",
"version": "2.0.0",
"peerDependencies": {
"@angular/common": "^16.2.12",
"@angular/core": "^16.2.12",
"ol": ">=6.3.1"
}
}
}
}

View File

@ -0,0 +1,12 @@
{
"name": "ngx-openlayers",
"version": "2.0.0",
"publishConfig": {
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
},
"peerDependencies": {
"@angular/common": "^16.2.12",
"@angular/core": "^16.2.12",
"ol": ">=6.3.1"
}
}

View File

@ -1,15 +1,18 @@
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 {
label: string; instance: Attribution;
html: string;
constructor(private elementRef: ElementRef) {} constructor(private elementRef: ElementRef) {}
ngOnInit() { ngOnInit() {
this.label = this.elementRef.nativeElement.innerHTML; this.html = this.elementRef.nativeElement.innerHTML;
this.instance = new Attribution(this);
} }
} }

View File

@ -1,6 +1,7 @@
import { AfterViewInit, Component, ContentChildren, Host, QueryList } from '@angular/core'; import { AfterViewInit, Component, ContentChildren, Host, QueryList } from '@angular/core';
import { SourceComponent } from './sources/source.component'; import { Attribution } from 'ol/control';
import { AttributionComponent } from './attribution.component'; import { AttributionComponent } from './attribution.component';
import { SourceComponent } from './sources/source.component';
@Component({ @Component({
selector: 'aol-attributions', selector: 'aol-attributions',
@ -10,14 +11,14 @@ export class AttributionsComponent implements AfterViewInit {
@ContentChildren(AttributionComponent) @ContentChildren(AttributionComponent)
attributions: QueryList<AttributionComponent>; attributions: QueryList<AttributionComponent>;
instance: Array<string>; instance: Array<Attribution>;
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.label); this.instance = this.attributions.map((cmp) => cmp.instance);
// 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,14 +10,11 @@ export class ControlAttributionComponent implements OnInit, OnDestroy {
@Input() @Input()
collapsible: boolean; collapsible: boolean;
public componentType = 'control'; componentType = 'control';
instance: Attribution; instance: Attribution;
target: HTMLElement; target: Element;
constructor( constructor(private map: MapComponent, private element: ElementRef) {}
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 { MapComponent } from '../map.component';
import { ContentComponent } from '../content.component'; import { ContentComponent } from '../content.component';
import { MapComponent } from '../map.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;
public componentType = 'control'; componentType = 'control';
instance: Control; instance: Control;
element: HTMLElement; element: Element;
constructor(private map: MapComponent) {} constructor(private map: MapComponent) {}

View File

@ -1,6 +1,6 @@
import { Component, OnDestroy, OnInit, Input } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { Control, defaults } from 'ol/control';
import { Collection } from 'ol'; import { Collection } from 'ol';
import { Control, defaults } from 'ol/control';
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,14 +13,11 @@ 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( constructor(private map: MapComponent, private element: ElementRef) {}
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, OnDestroy, OnInit, OnChanges, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, OnDestroy, OnInit, 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: HTMLElement; target: Element;
@Input() @Input()
tipLabel: string; tipLabel: string;
@Input() @Input()

View File

@ -1,7 +1,6 @@
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',
@ -9,11 +8,13 @@ import { Units } from 'ol/control/ScaleLine';
}) })
export class ControlScaleLineComponent implements OnInit, OnDestroy { export class ControlScaleLineComponent implements OnInit, OnDestroy {
@Input() @Input()
units: Units; units: string;
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);
@ -21,6 +22,7 @@ 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 | HTMLElement; zoomInLabel: string | Node;
@Input() @Input()
zoomOutLabel: string | HTMLElement; zoomOutLabel: string | Node;
@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 { MapComponent } from '../map.component';
import { Extent } from 'ol/extent'; import { Extent } from 'ol/extent';
import { MapComponent } from '../map.component';
@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 | HTMLElement; label: string | Node;
@Input() @Input()
tipLabel: string; tipLabel: string;
@Input() @Input()

View File

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

View File

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, OnChanges, Input, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, OnDestroy, OnInit, 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;
public componentType = 'feature'; componentType = 'feature';
public instance: Feature; instance: Feature;
constructor(private host: SourceVectorComponent) {} constructor(private host: SourceVectorComponent) {}

View File

@ -1,7 +1,8 @@
import { Component, forwardRef, Input } from '@angular/core'; import { Component, forwardRef, Input } from '@angular/core';
import { FormatComponent } from './format.component';
import { MVT } from 'ol/format'; import { MVT } from 'ol/format';
import { FeatureClass } from 'ol/Feature'; import { Geometry } from 'ol/geom';
import GeometryType from 'ol/geom/GeometryType';
import { FormatComponent } from './format.component';
@Component({ @Component({
selector: 'aol-format-mvt', selector: 'aol-format-mvt',
@ -10,7 +11,9 @@ import { FeatureClass } from 'ol/Feature';
}) })
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,14 +1,23 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { FeatureComponent } from '../feature.component';
import { Circle } from 'ol/geom'; import { Circle } from 'ol/geom';
import { SimpleGeometryComponent } from './simplegeometry.component'; import { FeatureComponent } from '../feature.component';
import { MapComponent } from '../map.component'; import { MapComponent } from '../map.component';
import { SimpleGeometryComponent } from './simplegeometry.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();
@ -16,13 +25,4 @@ 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,20 +1,16 @@
import { Input, OnInit, Directive } from '@angular/core'; import { Directive, Input, OnInit } 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;
public instance: SimpleGeometry; instance: SimpleGeometry;
public componentType = 'simple-geometry'; componentType = 'simple-geometry';
protected constructor( constructor(protected map: MapComponent, protected host: FeatureComponent) {}
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 { Component, Input, AfterContentInit, OnChanges, SimpleChanges, OnDestroy } from '@angular/core'; import { AfterContentInit, Component, Input, OnChanges, OnDestroy, SimpleChanges } 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;
public componentType = 'graticule'; componentType = 'graticule';
constructor(private map: MapComponent) {} constructor(private map: MapComponent) {}

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import { Component, OnDestroy, OnInit, Input } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } 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, OnDestroy, OnInit, Input } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } 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, OnDestroy, OnInit, Input } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } 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,15 +1,13 @@
import { Component, Input, OnDestroy, OnInit, EventEmitter, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { MapComponent } from '../map.component';
import { Draw } from 'ol/interaction';
import { Collection, Feature } from 'ol'; import { Collection, Feature } from 'ol';
import { Condition } from 'ol/events/condition';
import GeometryType from 'ol/geom/GeometryType';
import { Draw } from 'ol/interaction';
import { DrawEvent, GeometryFunction } from 'ol/interaction/Draw';
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 { Condition } from 'ol/events/condition'; import { MapComponent } from '../map.component';
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',
@ -25,7 +23,7 @@ export class DrawInteractionComponent implements OnInit, OnDestroy {
@Input() @Input()
snapTolerance?: number; snapTolerance?: number;
@Input() @Input()
type: Type; type: GeometryType;
@Input() @Input()
maxPoints?: number; maxPoints?: number;
@Input() @Input()
@ -50,17 +48,13 @@ export class DrawInteractionComponent implements OnInit, OnDestroy {
@Output() @Output()
olChange = new EventEmitter<DrawEvent>(); olChange = new EventEmitter<DrawEvent>();
@Output() @Output()
olChangeActive = new EventEmitter<ObjectEvent>(); olChangeActive = new EventEmitter<DrawEvent>();
@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()
olError = new EventEmitter<BaseEvent>(); propertyChange = new EventEmitter<DrawEvent>();
@Output()
propertyChange = new EventEmitter<ObjectEvent>();
instance: Draw; instance: Draw;
@ -69,12 +63,10 @@ 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: ObjectEvent) => this.olChangeActive.emit(event)); this.instance.on('change:active', (event: DrawEvent) => 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('error', (event: BaseEvent) => this.olError.emit(event)); this.instance.on('propertychange', (event: DrawEvent) => this.propertyChange.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,15 +1,12 @@
import { Component, OnDestroy, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { MapComponent } from '../map.component';
import { Modify } from 'ol/interaction';
import { Collection, Feature } from 'ol'; 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 { Condition } from 'ol/events/condition';
import { ObjectEvent } from 'ol/Object'; import { Modify } from 'ol/interaction';
import { DrawEvent } from 'ol/interaction/Draw'; import { ModifyEvent } from 'ol/interaction/Modify';
import BaseEvent from 'ol/events/Event'; import { Vector } from 'ol/source';
import { Style } from 'ol/style';
import { StyleFunction } from 'ol/style/Style';
import { MapComponent } from '../map.component';
@Component({ @Component({
selector: 'aol-interaction-modify', selector: 'aol-interaction-modify',
@ -32,17 +29,15 @@ export class ModifyInteractionComponent implements OnInit, OnDestroy {
source?: Vector; source?: Vector;
@Output() @Output()
olChange = new EventEmitter<DrawEvent>(); modifyEnd = new EventEmitter<ModifyEvent>();
@Output() @Output()
olChangeActive = new EventEmitter<ObjectEvent>(); modifyStart = new EventEmitter<ModifyEvent>();
@Output() @Output()
olError = new EventEmitter<BaseEvent>(); olChange = new EventEmitter<ModifyEvent>();
@Output() @Output()
olModifyEnd = new EventEmitter<ModifyEvent>(); olChangeActive = new EventEmitter<ModifyEvent>();
@Output() @Output()
olModifyStart = new EventEmitter<ModifyEvent>(); propertyChange = new EventEmitter<ModifyEvent>();
@Output()
propertyChange = new EventEmitter<ObjectEvent>();
instance: Modify; instance: Modify;
@ -50,12 +45,11 @@ export class ModifyInteractionComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.instance = new Modify(this); this.instance = new Modify(this);
this.instance.on('change', (event: DrawEvent) => this.olChange.emit(event)); this.instance.on('change', (event: ModifyEvent) => this.olChange.emit(event));
this.instance.on('change:active', (event: ObjectEvent) => this.olChangeActive.emit(event)); this.instance.on('change:active', (event: ModifyEvent) => this.olChangeActive.emit(event));
this.instance.on('error', (event: BaseEvent) => this.olError.emit(event)); this.instance.on('propertychange', (event: ModifyEvent) => this.propertyChange.emit(event));
this.instance.on('modifyend', (event: ModifyEvent) => this.olModifyEnd.emit(event)); this.instance.on('modifyend', (event: ModifyEvent) => this.modifyEnd.emit(event));
this.instance.on('modifystart', (event: ModifyEvent) => this.olModifyStart.emit(event)); this.instance.on('modifystart', (event: ModifyEvent) => this.modifyStart.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, OnDestroy, OnInit, Input } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } 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,14 +1,12 @@
import { Component, OnDestroy, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { MapComponent } from '../map.component'; import { Collection, Feature } from 'ol';
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 { Condition } from 'ol/events/condition'; import { MapComponent } from '../map.component';
import { ObjectEvent } from 'ol/Object';
import BaseEvent from 'ol/events/Event';
@Component({ @Component({
selector: 'aol-interaction-select', selector: 'aol-interaction-select',
@ -35,17 +33,15 @@ 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()
olChangeActive = new EventEmitter<ObjectEvent>();
@Output()
olError = new EventEmitter<BaseEvent>();
@Output()
propertyChange = new EventEmitter<ObjectEvent>();
@Output()
olSelect = new EventEmitter<SelectEvent>(); olSelect = new EventEmitter<SelectEvent>();
@Output()
propertyChange = new EventEmitter<SelectEvent>();
instance: Select; instance: Select;
@ -55,10 +51,9 @@ 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,11 +1,9 @@
import { Component, OnDestroy, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { Translate } from 'ol/interaction';
import { Collection, Feature } from 'ol'; import { Collection, Feature } from 'ol';
import { Layer } from 'ol/layer'; import { Translate } from 'ol/interaction';
import { TranslateEvent } from 'ol/interaction/Translate'; import { TranslateEvent } from 'ol/interaction/Translate';
import { Layer } from 'ol/layer';
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',
@ -20,31 +18,31 @@ export class TranslateInteractionComponent implements OnInit, OnDestroy {
hitTolerance?: number; hitTolerance?: number;
@Output() @Output()
olChange = new EventEmitter<BaseEvent>(); olChange: EventEmitter<TranslateEvent>;
@Output() @Output()
olChangeActive = new EventEmitter<ObjectEvent>(); propertyChange: EventEmitter<TranslateEvent>;
@Output() @Output()
olError = new EventEmitter<BaseEvent>(); translateEnd: EventEmitter<TranslateEvent>;
@Output() @Output()
propertyChange = new EventEmitter<ObjectEvent>(); translateStart: EventEmitter<TranslateEvent>;
@Output() @Output()
translateEnd = new EventEmitter<TranslateEvent>(); translating: 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: BaseEvent) => this.olChange.emit(event)); this.instance.on('change', (event: TranslateEvent) => this.olChange.emit(event));
this.instance.on('change:active', (event: ObjectEvent) => this.olChangeActive.emit(event)); this.instance.on('propertychange', (event: TranslateEvent) => 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.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,11 +1,10 @@
import { OnDestroy, OnInit, OnChanges, Input, SimpleChanges, Directive } from '@angular/core'; import { Directive, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
import Event from 'ol/events/Event'; import { Event } from 'ol/events';
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;
@ -25,10 +24,10 @@ export abstract class LayerComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
postrender: (evt: Event) => void; postrender: (evt: Event) => void;
public instance: any; instance: any;
public componentType = 'layer'; componentType = 'layer';
protected constructor(protected host: MapComponent | LayerGroupComponent) {} 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,6 +23,8 @@ 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, OnDestroy, OnInit, Input, Optional, OnChanges, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, OnDestroy, OnInit, Optional, 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,6 +14,8 @@ 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, OnDestroy, OnInit, Input, Optional, OnChanges, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, OnDestroy, OnInit, Optional, 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,6 +23,8 @@ 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,5 +1,6 @@
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';
@ -15,7 +16,7 @@ export class LayerVectorTileComponent extends LayerComponent implements OnInit,
@Input() @Input()
renderBuffer: number; renderBuffer: number;
@Input() @Input()
renderMode: any | string; renderMode: RenderType | 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,122 @@
import {
AfterViewInit,
Component,
ElementRef,
EventEmitter,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges,
} from '@angular/core';
import Map from 'ol/Map';
import MapBrowserEvent from 'ol/MapBrowserEvent';
import MapEvent from 'ol/MapEvent';
import ObjectEvent from 'ol/Object';
import { Control } from 'ol/control';
import { Interaction } from 'ol/interaction';
import RenderEvent from 'ol/render/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: Element | string;
@Input()
loadTilesWhileAnimating: boolean;
@Input()
loadTilesWhileInteracting: boolean;
@Input()
logo: string | boolean;
@Input()
renderer: 'canvas' | 'webgl';
@Output()
olClick: EventEmitter<MapBrowserEvent>;
@Output()
dblClick: EventEmitter<MapBrowserEvent>;
@Output()
moveStart: EventEmitter<MapEvent>;
@Output()
moveEnd: EventEmitter<MapEvent>;
@Output()
pointerDrag: EventEmitter<MapBrowserEvent>;
@Output()
pointerMove: EventEmitter<MapBrowserEvent>;
@Output()
onpostrender: EventEmitter<RenderEvent>;
@Output()
postRender: EventEmitter<MapEvent>;
@Output()
onprerender: EventEmitter<RenderEvent>;
@Output()
propertyChange: EventEmitter<ObjectEvent>;
@Output()
singleClick: EventEmitter<MapBrowserEvent>;
instance: Map;
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) {
this.olClick = new EventEmitter<MapBrowserEvent>();
this.dblClick = new EventEmitter<MapBrowserEvent>();
this.moveStart = new EventEmitter<MapEvent>();
this.moveEnd = new EventEmitter<MapEvent>();
this.pointerDrag = new EventEmitter<MapBrowserEvent>();
this.pointerMove = new EventEmitter<MapBrowserEvent>();
this.onpostrender = new EventEmitter<RenderEvent>();
this.postRender = new EventEmitter<MapEvent>();
this.onprerender = new EventEmitter<RenderEvent>();
this.propertyChange = new EventEmitter<ObjectEvent>();
this.singleClick = new EventEmitter<MapBrowserEvent>();
}
ngOnInit() {
// console.log('creating ol.Map instance with:', this);
this.instance = new Map(this);
this.instance.setTarget(this.host.nativeElement.firstElementChild);
this.instance.on('click', (event: MapBrowserEvent) => this.olClick.emit(event));
this.instance.on('dblclick', (event: MapBrowserEvent) => this.dblClick.emit(event));
this.instance.on('movestart', (event: MapEvent) => this.moveStart.emit(event));
this.instance.on('moveend', (event: MapEvent) => this.moveEnd.emit(event));
this.instance.on('pointerdrag', (event: MapBrowserEvent) => this.pointerDrag.emit(event));
this.instance.on('pointermove', (event: MapBrowserEvent) => this.pointerMove.emit(event));
this.instance.on('postrender', (event: RenderEvent) => this.onpostrender.emit(event));
this.instance.on('postrender', (event: MapEvent) => this.postRender.emit(event));
this.instance.on('prerender', (event: RenderEvent) => this.onprerender.emit(event));
this.instance.on('propertychange', (event: ObjectEvent) => this.propertyChange.emit(event));
this.instance.on('singleclick', (event: MapBrowserEvent) => 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,7 +1,8 @@
import { Component, ContentChild, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, ContentChild, Input, OnDestroy, OnInit } from '@angular/core';
import { MapComponent } from './map.component'; import { Overlay, PanOptions } from 'ol';
import Overlay, { PanOptions, Positioning } from 'ol/Overlay'; import OverlayPositioning from 'ol/OverlayPositioning';
import { ContentComponent } from './content.component'; import { ContentComponent } from './content.component';
import { MapComponent } from './map.component';
@Component({ @Component({
selector: 'aol-overlay', selector: 'aol-overlay',
@ -16,7 +17,7 @@ export class OverlayComponent implements OnInit, OnDestroy {
@Input() @Input()
offset: number[]; offset: number[];
@Input() @Input()
positioning: Positioning; positioning: OverlayPositioning | string;
@Input() @Input()
stopEvent: boolean; stopEvent: boolean;
@Input() @Input()
@ -30,7 +31,7 @@ export class OverlayComponent implements OnInit, OnDestroy {
componentType = 'overlay'; componentType = 'overlay';
instance: Overlay; instance: Overlay;
element: HTMLElement; element: Element;
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 { BingMaps } from 'ol/source';
import { SourceComponent } from './source.component';
import { LayerTileComponent } from '../layers/layertile.component';
import { LoadFunction } from 'ol/Tile'; import { LoadFunction } from 'ol/Tile';
import { BingMaps } from 'ol/source';
import { LayerTileComponent } from '../layers/layertile.component';
import { SourceComponent } from './source.component';
@Component({ @Component({
selector: 'aol-source-bingmaps', selector: 'aol-source-bingmaps',

View File

@ -29,11 +29,10 @@ export class SourceClusterComponent extends SourceComponent implements AfterCont
@Input() @Input()
wrapX?: boolean; wrapX?: boolean;
@ContentChild(SourceVectorComponent, { static: false }) @ContentChild(SourceVectorComponent)
sourceVectorComponent: SourceVectorComponent; sourceVectorComponent: SourceVectorComponent;
instance: Cluster;
source: Vector; source: Vector;
instance: Cluster;
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 { LayerVectorComponent } from '../layers/layervector.component'; import { Feature } from 'ol';
import { SourceComponent } from './source.component';
import FeatureFormat from 'ol/format/Feature';
import { Vector } from 'ol/source';
import { GeoJSON } from 'ol/format'; import { GeoJSON } from 'ol/format';
import { ProjectionLike } from 'ol/proj'; import { ProjectionLike } from 'ol/proj';
import { Vector } from 'ol/source';
import { LayerVectorComponent } from '../layers/layervector.component';
import { SourceComponent } from './source.component';
@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: FeatureFormat; format: Feature;
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 ImageArcGISRest from 'ol/source/ImageArcGISRest'; import { LoadFunction } from 'ol/Image';
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 { ImageSourceEvent } from 'ol/source/Image';
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,
forwardRef,
Output,
EventEmitter,
OnChanges, OnChanges,
SimpleChanges,
OnInit, OnInit,
Output,
SimpleChanges,
forwardRef,
} from '@angular/core'; } from '@angular/core';
import { ImageStatic } from 'ol/source';
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 { LoadFunction } from 'ol/Image';
import { Extent } from 'ol/extent';
import { ProjectionLike } from 'ol/proj';
import { Size } from 'ol/size'; import { Size } from 'ol/size';
import { ImageStatic } from 'ol/source';
import { ImageSourceEvent } from 'ol/source/Image'; import { ImageSourceEvent } from 'ol/source/Image';
import { AttributionLike } from 'ol/source/Source';
import { LayerImageComponent } from '../layers/layerimage.component';
import { SourceComponent } from './source.component';
@Component({ @Component({
selector: 'aol-source-imagestatic', selector: 'aol-source-imagestatic',

View File

@ -16,7 +16,6 @@ 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',
@ -31,7 +30,7 @@ export class SourceImageWMSComponent extends SourceComponent implements OnChange
@Input() @Input()
hidpi: boolean; hidpi: boolean;
@Input() @Input()
serverType: ServerType; serverType: string;
@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 = new EventEmitter<TileSourceEvent>(); tileLoadStart: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadEnd = new EventEmitter<TileSourceEvent>(); tileLoadEnd: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadError = new EventEmitter<TileSourceEvent>(); tileLoadError: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
instance: OSM; instance: OSM;
@ -53,10 +53,12 @@ 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, RasterSourceEvent } from 'ol/source/Raster'; import { Operation, RasterOperationType, 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,17 +32,21 @@ export class SourceRasterComponent extends SourceComponent implements AfterConte
@Input() @Input()
lib?: any; lib?: any;
@Input() @Input()
operationType?: 'pixel' | 'image'; operationType?: RasterOperationType;
@Output() @Output()
beforeOperations = new EventEmitter<RasterSourceEvent>(); beforeOperations: EventEmitter<RasterSourceEvent> = new EventEmitter<RasterSourceEvent>();
@Output() @Output()
afterOperations = new EventEmitter<RasterSourceEvent>(); afterOperations: EventEmitter<RasterSourceEvent> = new EventEmitter<RasterSourceEvent>();
instance: Raster; instance: Raster;
sources: Source[] = []; sources: Source[] = [];
@ContentChild(SourceComponent, { static: false }) constructor(@Host() layer: LayerImageComponent) {
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) {
@ -51,10 +55,6 @@ 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,10 +1,9 @@
import { Input, OnDestroy, Directive } from '@angular/core'; import { Directive, Input, OnDestroy } from '@angular/core';
import Source from 'ol/source/Source'; import { Source } from 'ol';
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;
@ -12,7 +11,7 @@ export abstract class SourceComponent implements OnDestroy {
public instance: Source; public instance: Source;
public componentType = 'source'; public componentType = 'source';
protected constructor(protected host: LayerComponent) {} constructor(protected host: LayerComponent) {}
ngOnDestroy() { ngOnDestroy() {
if (this.host && this.host.instance) { if (this.host && this.host.instance) {
@ -20,7 +19,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,9 +2,8 @@ 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/TileGrid'; import { TileGrid } from 'ol/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',
@ -27,7 +26,7 @@ export class SourceTileWMSComponent extends SourceComponent implements OnChanges
@Input() @Input()
reprojectionErrorThreshold: number; reprojectionErrorThreshold: number;
@Input() @Input()
serverType: ServerType; serverType: string;
@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 as SourceWMTS } from 'ol/source'; import { WMTS } from 'ol/source';
import WMTS from 'ol/tilegrid/WMTS'; import { WMTS as TileGridWMTS } from 'ol/tilegrid';
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: WMTS; tileGrid: TileGridWMTS;
@Input() @Input()
projection: ProjectionLike; projection: ProjectionLike;
@Input() @Input()
reprojectionErrorThreshold?: number; reprojectionErrorThreshold?: number;
@Input() @Input()
requestEncoding?: RequestEncoding | undefined; requestEncoding?: WMTSRequestEncoding | string;
@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 = new EventEmitter<TileSourceEvent>(); tileLoadStart: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadEnd = new EventEmitter<TileSourceEvent>(); tileLoadEnd: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadError = new EventEmitter<TileSourceEvent>(); tileLoadError: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@ContentChild(TileGridWMTSComponent, { static: false }) @ContentChild(TileGridWMTSComponent)
tileGridWMTS: TileGridWMTSComponent; tileGridWMTS: TileGridWMTSComponent;
instance: SourceWMTS; instance: WMTS;
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 SourceWMTS(this); this.instance = new WMTS(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,7 +2,6 @@ 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',
@ -10,7 +9,7 @@ import { Config } from 'ol/source/TileJSON';
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: Config; @Input() tileJSON: JSON;
@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/source'; import { VectorTile } from 'ol';
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,15 +32,16 @@ export class SourceVectorTileComponent extends SourceComponent implements AfterC
@Input() @Input()
wrapX: boolean; wrapX: boolean;
@ContentChild(FormatComponent, { static: false }) @ContentChild(FormatComponent)
formatComponent: FormatComponent; formatComponent: FormatComponent;
@ContentChild(TileGridComponent, { static: false }) @ContentChild(TileGridComponent)
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, { static: false }) @ContentChild(TileGridComponent)
tileGridXYZ: TileGridComponent; tileGridXYZ: TileGridComponent;
@Output() @Output()
tileLoadStart = new EventEmitter<TileSourceEvent>(); tileLoadStart: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadEnd = new EventEmitter<TileSourceEvent>(); tileLoadEnd: EventEmitter<TileSourceEvent> = new EventEmitter<TileSourceEvent>();
@Output() @Output()
tileLoadError = new EventEmitter<TileSourceEvent>(); tileLoadError: EventEmitter<TileSourceEvent> = 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);
} }
} }

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