Skip to content

Commit

Permalink
feat(demo): add context demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Aug 15, 2018
1 parent 2c5203f commit b3261a1
Show file tree
Hide file tree
Showing 12 changed files with 154 additions and 1 deletion.
1 change: 1 addition & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"assets": [
"demo/src/favicon.ico",
"demo/src/assets",
"demo/src/contexts",
"demo/src/locale",
{
"glob": "**/*",
Expand Down
5 changes: 5 additions & 0 deletions demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ <h1>{{title}}</h1>
<a mat-list-item routerLink="search">Search</a>
<a mat-list-item routerLink="time-filter">Time filter</a>
<a mat-list-item routerLink="ogc-filter">OGC filter</a>

<hr>

<a mat-list-item routerLink="context">Context</a>

</mat-nav-list>
</mat-sidenav>

Expand Down
4 changes: 4 additions & 0 deletions demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { AppSearchModule } from './geo/search/search.module';
import { AppTimeFilterModule } from './geo/time-filter/time-filter.module';
import { AppOgcFilterModule } from './geo/ogc-filter/ogc-filter.module';

import { AppContextModule } from './context/context/context.module';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

Expand Down Expand Up @@ -61,6 +63,8 @@ import { AppComponent } from './app.component';
AppTimeFilterModule,
AppOgcFilterModule,

AppContextModule,

AppRoutingModule
],
bootstrap: [AppComponent]
Expand Down
15 changes: 15 additions & 0 deletions demo/src/app/context/context/context-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Routes, RouterModule } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';

import { AppContextComponent } from './context.component';

const routes: Routes = [
{
path: 'context',
component: AppContextComponent
}
];

export const AppContextRoutingModule: ModuleWithProviders = RouterModule.forChild(
routes
);
17 changes: 17 additions & 0 deletions demo/src/app/context/context/context.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<mat-card>
<mat-card-subtitle>Geo</mat-card-subtitle>
<mat-card-title>Context</mat-card-title>
<mat-card-content>
<p>* Dependencies: LanguageService</p>

</mat-card-content>

<igo-map-browser
igoMapContext
igoLayerContext
[map]="map">
<igo-zoom-button [map]="map" color="primary"></igo-zoom-button>
<igo-geolocate-button [map]="map" color="primary"></igo-geolocate-button>
</igo-map-browser>

</mat-card>
4 changes: 4 additions & 0 deletions demo/src/app/context/context/context.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
igo-map-browser {
width: 800px;
height: 300px;
}
28 changes: 28 additions & 0 deletions demo/src/app/context/context/context.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component } from '@angular/core';

import { LanguageService } from '@igo2/core';
import { IgoMap } from '@igo2/geo';

@Component({
selector: 'app-context',
templateUrl: './context.component.html',
styleUrls: ['./context.component.scss']
})
export class AppContextComponent {
public map = new IgoMap({
controls: {
attribution: {
collapsed: true
}
}
});

public view = {
center: [-73, 47.2],
zoom: 6
};

constructor(
private languageService: LanguageService
) {}
}
21 changes: 21 additions & 0 deletions demo/src/app/context/context/context.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { MatCardModule, MatButtonModule } from '@angular/material';

import { IgoMapModule } from '@igo2/geo';
import { IgoContextModule } from '@igo2/context';

import { AppContextComponent } from './context.component';
import { AppContextRoutingModule } from './context-routing.module';

@NgModule({
declarations: [AppContextComponent],
imports: [
AppContextRoutingModule,
MatCardModule,
MatButtonModule,
IgoMapModule,
IgoContextModule
],
exports: [AppContextComponent]
})
export class AppContextModule {}
9 changes: 9 additions & 0 deletions demo/src/contexts/_contexts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[{
"uri": "_default",
"title": "Default Context"
},
{
"uri": "context2",
"title": "Context 2"
}
]
30 changes: 30 additions & 0 deletions demo/src/contexts/_default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"uri": "_default",
"title": "Default Context",
"map": {
"view": {
"projection": "EPSG:3857",
"center": [-72, 50],
"zoom": 5,
"geolocate": true
}
},
"layers": [{
"title": "OSM",
"sourceOptions": {
"type": "osm"
}
},
{
"optionsFromCapabilities": true,
"sourceOptions": {
"type": "wms",
"url": "https://geoegl.msp.gouv.qc.ca/ws/igo_gouvouvert.fcgi",
"params": {
"layers": "MELS_CS_ANGLO_S",
"version": "1.3.0"
}
}
}
]
}
19 changes: 19 additions & 0 deletions demo/src/contexts/context2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"uri": "context2",
"title": "Context 2",
"map": {
"view": {
"projection": "EPSG:3857",
"center": [-72, 50],
"zoom": 5,
"geolocate": true
}
},
"layers": [{
"title": "OSM",
"sourceOptions": {
"type": "osm"
}
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"preversion": "npm run test.libs",
"version": "gulp bumpVersion && npm run build.libs && npm run changelog && git add .",
"postversion": "git push && git push --tags && npm run publish && npm run ghpages && npm run ghrelease",
"preghpages": "npm run build.demo -- --output-path ./dist/ghpages --base-href /igo2-lib/",
"preghpages": "npm run build.demo -- --output-path ./dist/ghpages --base-href /igo2-lib/ && echo \"include: ['_default.json', '_contexts.json']\" > dist/ghpages/_config.yml",
"ghpages": "VERSION=$(node -p -e \"require('./package.json').version\") && npx ngh --dir=dist/ghpages --no-silent=false --message=$VERSION",
"postghpages": "rimraf ./dist/ghpages",
"ghrelease": "VERSION=$(node -p -e \"require('./package.json').version\") && publish-release --owner infra-geo-ouverte --repo igo2-lib --tag $VERSION --name $VERSION --reuse-release --notes \"$(npm run changelog-current -s)\""
Expand Down

0 comments on commit b3261a1

Please sign in to comment.