Skip to content

Commit

Permalink
feat(search-source): reseau-transport-quebec
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Mar 6, 2019
1 parent 0c1e156 commit 5ca51df
Show file tree
Hide file tree
Showing 5 changed files with 478 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { RouterModule } from "@angular/router";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import {
provideConfigOptions,
IgoMessageModule,
RouteService
} from "@igo2/core";
import { IgoSpinnerModule, IgoStopPropagationModule } from "@igo2/common";
import { IgoAuthModule } from "@igo2/auth";
} from '@igo2/core';
import { IgoSpinnerModule, IgoStopPropagationModule } from '@igo2/common';
import { IgoAuthModule } from '@igo2/auth';
import {
provideIChercheSearchSource,
// provideReseauTransportsQuebecSearchSource,
provideNominatimSearchSource,
provideILayerSearchSource,
provideOsrmRoutingSource
} from "@igo2/geo";
} from '@igo2/geo';

import { environment } from "../environments/environment";
import { PortalModule } from "./pages";
import { AppComponent } from "./app.component";
import { environment } from '../environments/environment';
import { PortalModule } from './pages';
import { AppComponent } from './app.component';
import { AppReseauTransportQuebecModule } from './shared/search/sources/reseau-transport-quebec.module';

@NgModule({
declarations: [AppComponent],
Expand All @@ -32,17 +32,17 @@ import { AppComponent } from "./app.component";
IgoMessageModule,
IgoSpinnerModule,
IgoStopPropagationModule,
PortalModule
PortalModule,
AppReseauTransportQuebecModule
],
providers: [
provideConfigOptions({
default: environment.igo,
path: "./config/config.json"
path: './config/config.json'
}),
RouteService,
provideNominatimSearchSource(),
provideIChercheSearchSource(),
// provideReseauTransportsQuebecSearchSource(),
provideILayerSearchSource(),
provideOsrmRoutingSource()
],
Expand Down
18 changes: 18 additions & 0 deletions src/app/shared/search/sources/reseau-transport-quebec.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { FeatureGeometry } from '@igo2/geo';

export interface ReseauTransportQuebecData {
type: string;
recherche: string;
geometry: FeatureGeometry;
bbox: [number, number, number, number];
properties: { [key: string]: any };
}

export interface ReseauTransportQuebecResponse {
features: ReseauTransportQuebecData[];
}

export interface ReseauTransportQuebecPropertiesAlias {
name: string;
alias: string;
}
17 changes: 17 additions & 0 deletions src/app/shared/search/sources/reseau-transport-quebec.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';

import {
provideReseauTransportQuebecSearchSource,
provideReseauTransportQuebecReverseSearchSource,
provideDefaultReseauTransportQuebecSearchResultFormatter
} from './reseau-transport-quebec.providers';


@NgModule({
providers: [
provideReseauTransportQuebecSearchSource(),
provideReseauTransportQuebecReverseSearchSource(),
provideDefaultReseauTransportQuebecSearchResultFormatter()
]
})
export class AppReseauTransportQuebecModule {}
84 changes: 84 additions & 0 deletions src/app/shared/search/sources/reseau-transport-quebec.providers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { HttpClient } from '@angular/common/http';

import { ConfigService } from '@igo2/core';

import { SearchSource } from '@igo2/geo';
import {
ReseauTransportQuebecReverseSearchSource,
ReseauTransportQuebecSearchSource,
ReseauTransportQuebecSearchResultFormatter
} from './reseau-transport-quebec';

/**
* ReseauTransportQuebec search result formatter factory
* @ignore
*/
export function defaultReseauTransportQuebecSearchResultFormatterFactory() {
return new ReseauTransportQuebecSearchResultFormatter();
}

/**
* Function that returns a provider for the ReseauTransportQuebec search result formatter
*/
export function provideDefaultReseauTransportQuebecSearchResultFormatter() {
return {
provide: ReseauTransportQuebecSearchResultFormatter,
useFactory: defaultReseauTransportQuebecSearchResultFormatterFactory
};
}

/**
* ReseauTransportQuebec search source factory
* @ignore
*/
export function reseauTransportQuebecSearchSourceFactory(
http: HttpClient,
config: ConfigService,
formatter: ReseauTransportQuebecSearchResultFormatter
) {
return new ReseauTransportQuebecSearchSource(
http,
config.getConfig(`searchSources.${ReseauTransportQuebecSearchSource.id}`),
formatter
);
}

/**
* Function that returns a provider for the ReseauTransportQuebec search source
*/
export function provideReseauTransportQuebecSearchSource() {
return {
provide: SearchSource,
useFactory: reseauTransportQuebecSearchSourceFactory,
multi: true,
deps: [HttpClient, ConfigService, ReseauTransportQuebecSearchResultFormatter]
};
}

/**
* ReseauTransportQuebecReverse search source factory
* @ignore
*/
export function reseauTransportQuebecReverseSearchSourceFactory(
http: HttpClient,
config: ConfigService,
formatter: ReseauTransportQuebecSearchResultFormatter
) {
return new ReseauTransportQuebecReverseSearchSource(
http,
config.getConfig(`searchSources.${ReseauTransportQuebecReverseSearchSource.id}`),
formatter
);
}

/**
* Function that returns a provider for the ReseauTransportQuebecReverse search source
*/
export function provideReseauTransportQuebecReverseSearchSource() {
return {
provide: SearchSource,
useFactory: reseauTransportQuebecReverseSearchSourceFactory,
multi: true,
deps: [HttpClient, ConfigService, ReseauTransportQuebecSearchResultFormatter]
};
}
Loading

0 comments on commit 5ca51df

Please sign in to comment.