Skip to content

Commit

Permalink
Use generic types for arlas-map component
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedHamouGisaia committed Jan 9, 2025
1 parent b488728 commit 37bdcd7
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 41 deletions.
14 changes: 9 additions & 5 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ import { Subject, takeUntil, zip } from 'rxjs';
import { ContributorService } from './services/contributors.service';
import { MapWuiService } from './services/map.service';
import { ResultlistService } from './services/resultlist.service';
import { ArlasLngLatBounds, ArlasMapFrameworkService } from 'arlas-map';
import { ArlasMapFrameworkService } from 'arlas-map';

@Component({
selector: 'arlas-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class ArlasWuiComponent implements OnInit {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class ArlasWuiComponent<L, S, M> implements OnInit {

public collections = new Array<string>();
public collectionToDescription = new Map<string, CollectionReferenceParameters>();
Expand All @@ -54,10 +58,10 @@ export class ArlasWuiComponent implements OnInit {
public constructor(
private readonly arlasStartupService: ArlasStartupService,
private readonly configService: ArlasConfigService,
private readonly resultlistService: ResultlistService,
private readonly resultlistService: ResultlistService<L, S, M>,
private readonly contributorService: ContributorService,
private readonly mapService: MapWuiService,
private readonly mapFrameworkService: ArlasMapFrameworkService<any, any, any>,
private readonly mapService: MapWuiService<L, S, M>,
private readonly mapFrameworkService: ArlasMapFrameworkService<L, S, M>,
private readonly colorService: ArlasColorService,
private readonly collaborativeService: ArlasCollaborativesearchService,
private readonly analyticsService: AnalyticsService
Expand Down
10 changes: 7 additions & 3 deletions src/app/components/arlas-analytics/arlas-analytics.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import { AnalyticsService, ArlasConfigService, ArlasStartupService } from 'arlas
templateUrl: './arlas-analytics.component.html',
styleUrls: ['./arlas-analytics.component.scss']
})
export class ArlasAnalyticsComponent implements OnInit {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class ArlasAnalyticsComponent<L, S, M> implements OnInit {
/**
* @Input : Angular
* Whether to show the analytics menu inside of this component. Useful for multi-windows views
Expand All @@ -41,8 +45,8 @@ export class ArlasAnalyticsComponent implements OnInit {
public constructor(
protected analyticsService: AnalyticsService,
protected arlasStartupService: ArlasStartupService,
private configService: ArlasConfigService,
protected resultlistService: ResultlistService
private readonly configService: ArlasConfigService,
protected resultlistService: ResultlistService<L, S, M>
) {
}

Expand Down
8 changes: 6 additions & 2 deletions src/app/components/arlas-list/arlas-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ import { Subject, takeUntil } from 'rxjs';
templateUrl: './arlas-list.component.html',
styleUrls: ['./arlas-list.component.scss']
})
export class ArlasListComponent implements OnInit, OnDestroy, AfterViewInit {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class ArlasListComponent<L, S, M> implements OnInit, OnDestroy, AfterViewInit {

/**
* @Input : Angular
Expand All @@ -54,7 +58,7 @@ export class ArlasListComponent implements OnInit, OnDestroy, AfterViewInit {
private _onDestroy$ = new Subject<boolean>();

public constructor(
protected resultlistService: ResultlistService
protected resultlistService: ResultlistService<L, S, M>
) { }

public ngOnInit(): void { }
Expand Down
16 changes: 10 additions & 6 deletions src/app/components/arlas-map/arlas-map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ const DEFAULT_BASEMAP: BasemapStyle = {
templateUrl: './arlas-map.component.html',
styleUrls: ['./arlas-map.component.scss']
})
export class ArlasWuiMapComponent implements OnInit {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class ArlasWuiMapComponent<L, S, M> implements OnInit {
/** Map definition */
public mapComponentConfig: any;
public mapId = 'mapgl';
Expand Down Expand Up @@ -113,13 +117,13 @@ export class ArlasWuiMapComponent implements OnInit {
/** Destroy subscriptions */
private readonly _onDestroy$ = new Subject<boolean>();

@ViewChild('map', { static: false }) public mapglComponent: ArlasMapComponent<any, any, any>;
@ViewChild('import', { static: false }) public mapImportComponent: MapImportComponent<any, any, any>;
@ViewChild('map', { static: false }) public mapglComponent: ArlasMapComponent<L, S, M>;
@ViewChild('import', { static: false }) public mapImportComponent: MapImportComponent<L, S, M>;
@ViewChild('mapSettings', { static: false }) public mapSettings: MapSettingsComponent;

public constructor(
protected arlasMapService: MapWuiService,
private readonly mapFrameworkService: ArlasMapFrameworkService<any, any, any>,
protected arlasMapService: MapWuiService<L, S, M>,
private readonly mapFrameworkService: ArlasMapFrameworkService<L, S, M>,
private readonly toolkitMapService: ArlasMapService,
protected visualizeService: VisualizeService,
private readonly configService: ArlasConfigService,
Expand All @@ -130,7 +134,7 @@ export class ArlasWuiMapComponent implements OnInit {
private readonly activatedRoute: ActivatedRoute,
private readonly router: Router,
private readonly mapSettingsService: ArlasMapSettings,
private readonly resultlistService: ResultlistService,
private readonly resultlistService: ResultlistService<L, S, M>,
private readonly translate: TranslateService,
private readonly snackbar: MatSnackBar,
private readonly iconRegistry: MatIconRegistry,
Expand Down
14 changes: 9 additions & 5 deletions src/app/components/arlas-wui-root/arlas-wui-root.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ import { environment } from '../../../environments/environment';
templateUrl: './arlas-wui-root.component.html',
styleUrls: ['./arlas-wui-root.component.scss'],
})
export class ArlasWuiRootComponent implements OnInit, AfterViewInit, OnDestroy {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class ArlasWuiRootComponent<L, S, M> implements OnInit, AfterViewInit, OnDestroy {
/**
* @Input : Angular
* Current version of ARLAS WUI
Expand Down Expand Up @@ -99,8 +103,8 @@ export class ArlasWuiRootComponent implements OnInit, AfterViewInit, OnDestroy {
@Input() public resultListGridColumns = 4;
public collections: string[];
@ViewChild('timeline', { static: false }) public timelineComponent: TimelineComponent;
@ViewChild('arlasMap', { static: false }) public arlasMapComponent: ArlasWuiMapComponent;
@ViewChild('arlasList', { static: false }) public arlasListComponent: ArlasListComponent;
@ViewChild('arlasMap', { static: false }) public arlasMapComponent: ArlasWuiMapComponent<L, S, M>;
@ViewChild('arlasList', { static: false }) public arlasListComponent: ArlasListComponent<L, S, M>;

/** Shortcuts */
public shortcuts = new Array<FilterShortcutConfiguration>();
Expand Down Expand Up @@ -141,8 +145,8 @@ export class ArlasWuiRootComponent implements OnInit, AfterViewInit, OnDestroy {
private readonly activatedRoute: ActivatedRoute,
private readonly router: Router,
protected analyticsService: AnalyticsService,
protected resultlistService: ResultlistService,
protected mapService: MapWuiService
protected resultlistService: ResultlistService<L, S, M>,
protected mapService: MapWuiService<L, S, M>
) {
if (this.arlasStartupService.shouldRunApp && !this.arlasStartupService.emptyMode) {
/** resize the map */
Expand Down
1 change: 0 additions & 1 deletion src/app/components/configs-list/configs-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class ConfigsListComponent implements OnInit {
private persistenceService: PersistenceService,
private arlasColorService: ArlasColorService,
private arlasSettingsService: ArlasSettingsService,
private authentService: AuthentificationService,
private arlasIamService: ArlasIamService,
private arlasStartupService: ArlasStartupService
) {
Expand Down
8 changes: 6 additions & 2 deletions src/app/components/left-menu/left-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export interface MenuState {
templateUrl: './left-menu.component.html',
styleUrls: ['./left-menu.component.scss']
})
export class LeftMenuComponent implements OnInit {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class LeftMenuComponent<L, S, M> implements OnInit {
/**
* @Input : Angular
* List of collections displayed in the map
Expand Down Expand Up @@ -78,7 +82,7 @@ export class LeftMenuComponent implements OnInit {
private readonly configService: ArlasConfigService,
protected arlasStartupService: ArlasStartupService,
protected persistenceService: PersistenceService,
private readonly mapService: MapWuiService
private readonly mapService: MapWuiService<L, S, M>
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,19 @@ import { CollaborationEvent, OperationEnum } from 'arlas-web-core';
templateUrl: './rasters-manager.component.html',
styleUrls: ['./rasters-manager.component.scss']
})
export class RastersManagerComponent implements OnInit, OnDestroy {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class RastersManagerComponent<L, S, M> implements OnInit, OnDestroy {

/** Destroy subscriptions */
private _onDestroy$ = new Subject<boolean>();
private readonly _onDestroy$ = new Subject<boolean>();

public constructor(
private visualisationService: VisualizeService,
private resultlistService: ResultlistService,
private collaborativeSearchService: ArlasCollaborativesearchService
private readonly visualisationService: VisualizeService,
private readonly resultlistService: ResultlistService<L, S, M>,
private readonly collaborativeSearchService: ArlasCollaborativesearchService
) { }

public ngOnInit(): void {
Expand Down
8 changes: 6 additions & 2 deletions src/app/pipes/get-resultlist-config.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ import { ResultListContributor } from 'arlas-web-contributors';
@Pipe({
name: 'getResultlistConfig'
})
export class GetResultlistConfigPipe implements PipeTransform {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class GetResultlistConfigPipe<L, S, M> implements PipeTransform {

public constructor(private resultlistService: ResultlistService) { }
public constructor(private readonly resultlistService: ResultlistService<L, S, M>) { }

public transform(resultlistContributor: ResultListContributor): any {
return this.resultlistService.resultlistConfigPerContId.get(resultlistContributor?.identifier);
Expand Down
15 changes: 10 additions & 5 deletions src/app/services/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ export interface FeatureHover {
@Injectable({
providedIn: 'root'
})
export class MapWuiService {
public mapComponent: ArlasMapComponent<any, any, any>;
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class MapWuiService<L, S, M> {
public mapComponent: ArlasMapComponent<L, S, M>;
private mapComponentConfig: any;
public mapContributors: Array<MapContributor> = new Array();
public centerLatLng: { lat: number; lng: number; } = { lat: 0, lng: 0 };
Expand All @@ -39,7 +43,8 @@ export class MapWuiService {

public coordinatesHaveSpace: boolean;

public constructor(public mapService: ArlasMapFrameworkService<any, any, any>, public mapLogicService: AbstractArlasMapService<any, any, any>) { }
public constructor(public mapService: ArlasMapFrameworkService<L, S, M>,
public mapLogicService: AbstractArlasMapService<L, S, M>) { }

public setContributors(mapContributors: Array<MapContributor>) {
this.mapContributors = mapContributors;
Expand Down Expand Up @@ -85,7 +90,7 @@ export class MapWuiService {
this.mapService.setMapCursor(this.mapComponent.map, cursor);
}

public setMapComponent(mapComponent: ArlasMapComponent<any, any, any>) {
public setMapComponent(mapComponent: ArlasMapComponent<L, S, M>) {
this.mapComponent = mapComponent;
}

Expand All @@ -99,7 +104,7 @@ export class MapWuiService {
public updateMapStyle(ids: Array<string | number>, collection: string) {
if (!!this.mapComponent && !!this.mapComponent.map && !!this.mapComponentConfig && !!this.mapComponentConfig.mapLayers.events.onHover) {
this.mapComponentConfig.mapLayers.events.onHover.forEach(l => {
this.mapLogicService.updateMapStyle(this.mapComponent.map, l, ids, collection );
this.mapLogicService.updateMapStyle(this.mapComponent.map, l, ids, collection);
});
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/app/services/resultlist.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ import { BehaviorSubject, finalize, Subject, take } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class ResultlistService {
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class ResultlistService<L, S, M> {

/** Resultlist configs */
public resultlistConfigs = [];
Expand Down Expand Up @@ -79,7 +83,7 @@ export class ResultlistService {
public constructor(
private readonly activatedRoute: ActivatedRoute,
private readonly router: Router,
private readonly mapService: MapWuiService,
private readonly mapService: MapWuiService<L, S, M>,
private readonly collaborativeService: ArlasCollaborativesearchService,
private readonly settingsService: ArlasSettingsService,
private readonly configService: ArlasConfigService,
Expand Down
10 changes: 7 additions & 3 deletions src/app/tools/lazy-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ import { map, ObservableInput } from 'rxjs';


@Injectable()
export class LazyLoadImageHooks extends IntersectionObserverHooks {
private http: HttpClient;
/** L: a layer class/interface.
* S: a source class/interface.
* M: a Map configuration class/interface.
*/
export class LazyLoadImageHooks<L, S, M> extends IntersectionObserverHooks {
private readonly http: HttpClient;

public constructor(
http: HttpClient,
private resultListService: ResultlistService
private readonly resultListService: ResultlistService<L, S, M>
) {
super();
this.http = http;
Expand Down

0 comments on commit 37bdcd7

Please sign in to comment.