Skip to content

Commit

Permalink
feat(draw): new draw tool (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
drekss authored Jan 20, 2021
1 parent 57024df commit dac05d2
Show file tree
Hide file tree
Showing 42 changed files with 5,506 additions and 3,848 deletions.
1 change: 1 addition & 0 deletions demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ <h5>{{version.lib}}</h5>
<a mat-list-item routerLink="feature">Feature</a>
<a mat-list-item routerLink="hover">Hover</a>
<a mat-list-item routerLink="measure">Measure</a>
<a mat-list-item routerLink="draw">Draw</a>
<a mat-list-item routerLink="query">Query</a>
<a mat-list-item routerLink="catalog">Catalog</a>
<a mat-list-item routerLink="search">Search</a>
Expand Down
2 changes: 2 additions & 0 deletions demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { AppGeometryModule } from './geo/geometry/geometry.module';
import { AppFeatureModule } from './geo/feature/feature.module';
import { AppHoverModule } from './geo/hover/hover.module';
import { AppMeasureModule } from './geo/measure/measure.module';
import { AppDrawModule } from './geo/draw/draw.module';
import { AppQueryModule } from './geo/query/query.module';
import { AppCatalogModule } from './geo/catalog/catalog.module';
import { AppSearchModule } from './geo/search/search.module';
Expand Down Expand Up @@ -88,6 +89,7 @@ import { AppComponent } from './app.component';
AppFeatureModule,
AppHoverModule,
AppMeasureModule,
AppDrawModule,
AppQueryModule,
AppCatalogModule,
AppSearchModule,
Expand Down
14 changes: 14 additions & 0 deletions demo/src/app/geo/draw/draw-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Routes, RouterModule } from '@angular/router';

import { AppDrawComponent } from './draw.component';

const routes: Routes = [
{
path: 'draw',
component: AppDrawComponent
}
];

export const AppDrawRoutingModule = RouterModule.forChild(
routes
);
18 changes: 18 additions & 0 deletions demo/src/app/geo/draw/draw.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<mat-card>
<mat-card-subtitle>Geo</mat-card-subtitle>
<mat-card-title>Simple Map</mat-card-title>
<mat-card-content>
<li>Dependencies: LanguageService</li>

<br>
See the <a href="https://github.com/infra-geo-ouverte/igo2-lib/tree/master/demo/src/app/geo/draw">code of this example</a>
<hr>
</mat-card-content>

<igo-map-browser [map]="map" [view]="view">
<igo-zoom-button [map]="map" color="primary"></igo-zoom-button>
</igo-map-browser>

<igo-draw [store]="store" [map]="map"></igo-draw>

</mat-card>
10 changes: 10 additions & 0 deletions demo/src/app/geo/draw/draw.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
igo-map-browser {
width: 100%;
height: 300px;
}

igo-draw ::ng-deep mat-divider {
position: inherit !important;
left: inherit !important;
width: 160px !important;
}
54 changes: 54 additions & 0 deletions demo/src/app/geo/draw/draw.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Component } from '@angular/core';

import { LanguageService } from '@igo2/core';
import {
IgoMap,
DataSourceService,
LayerService,
FeatureStore,
FeatureWithDraw
} from '@igo2/geo';

@Component({
selector: 'app-draw',
templateUrl: './draw.component.html',
styleUrls: ['./draw.component.scss']
})
export class AppDrawComponent {

public map = new IgoMap({
controls: {
attribution: {
collapsed: true
},
scaleLine: true
}
});

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

public store = new FeatureStore<FeatureWithDraw>([], {map: this.map});

constructor(
private languageService: LanguageService,
private dataSourceService: DataSourceService,
private layerService: LayerService
) {
this.dataSourceService
.createAsyncDataSource({
type: 'osm'
})
.subscribe(dataSource => {
this.map.addLayer(
this.layerService.createLayer({
title: 'OSM',
source: dataSource
})
);
});
}
}
19 changes: 19 additions & 0 deletions demo/src/app/geo/draw/draw.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { MatCardModule } from '@angular/material/card';

import { IgoMapModule, IgoDrawModule } from '@igo2/geo';

import { AppDrawComponent } from './draw.component';
import { AppDrawRoutingModule } from './draw-routing.module';

@NgModule({
declarations: [AppDrawComponent],
imports: [
AppDrawRoutingModule,
MatCardModule,
IgoMapModule,
IgoDrawModule
],
exports: [AppDrawComponent]
})
export class AppDrawModule {}
Loading

0 comments on commit dac05d2

Please sign in to comment.