Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer move #537

Merged
merged 40 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0c20167
feat(map) Retrieve the mouse coord on move/click
Dec 5, 2019
55c3adf
feat(simple-map demo) Add pointer coordinates
Dec 5, 2019
09160dc
lint
Dec 5, 2019
1a417ae
typo
Dec 5, 2019
118d16e
lint
Dec 5, 2019
2b016c0
typo
Dec 5, 2019
9dd8764
feat(map) Retrieve the mouse coord on move/click when holding a preci…
Dec 5, 2019
2ff5c0d
refactor(mapPointerDirective) Renaming directive
Dec 5, 2019
cab7177
feat(demo) reverse search while ctrl is hold down
Dec 5, 2019
50fb1d4
wip
Dec 9, 2019
5ee2b0a
Merge remote-tracking branch 'origin/master' into pointerMove
Dec 9, 2019
aece342
wip
Dec 11, 2019
36f2708
Merge remote-tracking branch 'origin/master' into pointerMove
Dec 11, 2019
0bdbd40
lint
Dec 11, 2019
6d471d1
refactor(search-pointer-summary) rewrite
Dec 11, 2019
838a903
wip
Dec 11, 2019
c29c714
wip
Dec 11, 2019
4c23653
wip
Dec 11, 2019
ca7c454
refactor(search-pointer-summary-directive) moving from overlay to fea…
Dec 12, 2019
4b433c0
wip
Dec 12, 2019
35e2191
lint
Dec 12, 2019
13225c2
wip
Dec 13, 2019
e1b3bee
wip
Dec 13, 2019
e6a0375
wip
Dec 13, 2019
bd7e996
refactor(search-pointer-summary) Allow enable/disable the directive
Dec 16, 2019
354316d
feat(search-settings) Control if location summary on pointer position
Dec 16, 2019
a289aa1
demo(search) add pointer summary option
Dec 16, 2019
f431abc
refactor(search-setting) sort the search souces by type
Dec 16, 2019
05ce0e6
feat(source) allow to show/hide the source from search settings
Dec 16, 2019
2082159
lint
Dec 16, 2019
83f0ff5
Merge remote-tracking branch 'origin/master' into pointerMove
Dec 16, 2019
c34eeea
feat(search-setting) Hitting twice (<1sec) the CTRL key down activat…
Dec 16, 2019
884d36b
wip
Dec 17, 2019
9a45da6
Merge remote-tracking branch 'origin/master' into pointerMove
Dec 17, 2019
9bc21b6
refactor(*)Pointer move trigger nothing on touch screen
Dec 17, 2019
04bf9ca
lint
Dec 17, 2019
cdd114e
wip
Dec 17, 2019
a0aaf89
wip
Dec 17, 2019
9f74b22
wip
Dec 17, 2019
b481260
Merge remote-tracking branch 'origin/master' into pointerMove
Dec 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion demo/src/app/geo/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,30 @@
See the <a href="https://github.com/infra-geo-ouverte/igo2-lib/tree/master/demo/src/app/geo/search">code of this example</a><br>
See search section of the <a href="https://github.com/infra-geo-ouverte/igo2-lib/tree/master/demo/src/environments"> environment config</a>
<hr>
<br>
<span *ngIf="isTouchScreen" title="Details">
You can trigger the seach by coordinate by holding the CRTL key down while moving your cursor (on desktop). Don't
forget to focus on map before.
<br>
<br>
F2 activate/desactivate the pointer location.
</span>
</mat-card-content>

<igo-map-browser #mapBrowser [map]="map" [view]="view" igoOverlay [igoContextMenu]=actionbarMenu (menuPosition)="onContextMenuOpen($event)">
<igo-map-browser #mapBrowser [map]="map" [view]="view" igoOverlay [igoContextMenu]=actionbarMenu

igoSearchPointerSummary
[igoSearchPointerSummaryDelay]="500"
[igoSearchPointerSummaryEnabled]="igoSearchPointerSummaryEnabled"

(menuPosition)="onContextMenuOpen($event)" igoPointerPositionByKey [pointerPositionByKeyDelay]="500"
[pointerPositionByKeyCode]="17" (pointerPositionByKeyCoord)="onPointerSearch($event)">
<igo-zoom-button [map]="map" color="primary"></igo-zoom-button>
</igo-map-browser>

<igo-panel title="Search">
<igo-search-bar
(pointerSummaryEnabled)="onPointerSummaryEnabledChange($event)"
[searchSettings]="true"
(change)="onSearchTermChange($event)"
(search)="onSearch($event)"
Expand Down
20 changes: 18 additions & 2 deletions demo/src/app/geo/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@angular/core';
import * as proj from 'ol/proj';

import { LanguageService } from '@igo2/core';
import { LanguageService, MediaService } from '@igo2/core';
import { EntityStore, ActionStore } from '@igo2/common';
import {
FEATURE,
Expand All @@ -34,6 +34,8 @@ import { SearchState } from '@igo2/integration';
export class AppSearchComponent implements OnInit, OnDestroy {
public store = new ActionStore([]);

public igoSearchPointerSummaryEnabled: boolean = false;

public map = new IgoMap({
overlay: true,
controls: {
Expand All @@ -59,6 +61,10 @@ export class AppSearchComponent implements OnInit, OnDestroy {
return this.searchState.store;
}

get isTouchScreen(): boolean {
return this.mediaService.isTouchScreen();
}

public selectedFeature: Feature;

constructor(
Expand All @@ -67,7 +73,8 @@ export class AppSearchComponent implements OnInit, OnDestroy {
private mapService: MapService,
private layerService: LayerService,
private searchState: SearchState,
private searchService: SearchService
private searchService: SearchService,
private mediaService: MediaService
) {
this.mapService.setMap(this.map);

Expand All @@ -84,6 +91,10 @@ export class AppSearchComponent implements OnInit, OnDestroy {
});
}

onPointerSummaryEnabledChange(value) {
this.igoSearchPointerSummaryEnabled = value;
}

onSearchTermChange(term?: string) {
if (term === undefined || term === '') {
this.searchStore.clear();
Expand Down Expand Up @@ -183,6 +194,11 @@ export class AppSearchComponent implements OnInit, OnDestroy {
return position;
}

onPointerSearch(event) {
this.lonlat = event;
this.onSearchCoordinate();
}

onSearchCoordinate() {
this.searchStore.clear();
const results = this.searchService.reverseSearch(this.lonlat);
Expand Down
7 changes: 6 additions & 1 deletion demo/src/app/geo/simple-map/simple-map.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
<hr>
</mat-card-content>

<igo-map-browser [map]="map" [view]="view">
<igo-map-browser [map]="map" [view]="view"
igoPointerPosition
[pointerPositionDelay]="pointerCoordDelay"
(pointerPositionCoord)="onPointerMove($event)">
<igo-zoom-button [map]="map" color="primary"></igo-zoom-button>
<igo-geolocate-button [map]="map" color="primary"></igo-geolocate-button>
<igo-rotation-button [map]="map" [showIfNoRotation]="true" color="primary"></igo-rotation-button>
</igo-map-browser>

</mat-card>

<p *ngIf="!isTouchScreen">{{pointerCoord}}</p>
19 changes: 17 additions & 2 deletions demo/src/app/geo/simple-map/simple-map.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';

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

@Component({
Expand All @@ -9,6 +9,8 @@ import { IgoMap, DataSourceService, LayerService } from '@igo2/geo';
styleUrls: ['./simple-map.component.scss']
})
export class AppSimpleMapComponent {
public pointerCoord;
public pointerCoordDelay: number = 0;
public map = new IgoMap({
controls: {
attribution: {
Expand All @@ -24,10 +26,19 @@ export class AppSimpleMapComponent {
rotation: 0.75
};

get media() {
return this.mediaService.getMedia();
}

get isTouchScreen() {
return this.mediaService.isTouchScreen();
}

constructor(
private languageService: LanguageService,
private dataSourceService: DataSourceService,
private layerService: LayerService
private layerService: LayerService,
private mediaService: MediaService
) {
this.dataSourceService
.createAsyncDataSource({
Expand All @@ -42,4 +53,8 @@ export class AppSimpleMapComponent {
);
});
}

onPointerMove(event) {
this.pointerCoord = event;
}
}
2 changes: 2 additions & 0 deletions demo/src/app/geo/simple-map/simple-map.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { IgoMapModule } from '@igo2/geo';

import { AppSimpleMapComponent } from './simple-map.component';
import { AppSimpleMapRoutingModule } from './simple-map-routing.module';
import { CommonModule } from '@angular/common';

@NgModule({
declarations: [AppSimpleMapComponent],
imports: [
CommonModule,
AppSimpleMapRoutingModule,
MatCardModule,
MatButtonModule,
Expand Down
4 changes: 4 additions & 0 deletions demo/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ export const environment: Environment = {
limit: '8'
}
},
coordinatesreverse: {
showInPointerSummary: true
},
icherchereverse: {
showInPointerSummary: true,
searchUrl: 'https://geoegl.msp.gouv.qc.ca/apis/terrapi',
order: 3,
enabled: true
Expand Down
4 changes: 4 additions & 0 deletions demo/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export const environment: Environment = {
limit: '8'
}
},
coordinatesreverse: {
showInPointerSummary: true
},
icherchereverse: {
showInPointerSummary: true,
searchUrl: '/apis/terrapi',
order: 3,
enabled: true
Expand Down
88 changes: 88 additions & 0 deletions packages/geo/src/assets/icons/cross_black_18px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions packages/geo/src/lib/map/map.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { RotationButtonComponent } from './rotation-button/rotation-button.compo
import { BaseLayersSwitcherComponent } from './baselayers-switcher/baselayers-switcher.component';
import { MiniBaseMapComponent } from './baselayers-switcher/mini-basemap.component';
import { MapOfflineDirective } from './shared/mapOffline.directive';
import { PointerPositionDirective } from './shared/map-pointer-position.directive';
import { PointerPositionByKeyDirective } from './shared/map-pointer-position-by-key.directive';

@NgModule({
imports: [
Expand All @@ -34,7 +36,9 @@ import { MapOfflineDirective } from './shared/mapOffline.directive';
RotationButtonComponent,
BaseLayersSwitcherComponent,
MiniBaseMapComponent,
MapOfflineDirective
MapOfflineDirective,
PointerPositionDirective,
PointerPositionByKeyDirective
],
declarations: [
MapBrowserComponent,
Expand All @@ -43,7 +47,9 @@ import { MapOfflineDirective } from './shared/mapOffline.directive';
RotationButtonComponent,
BaseLayersSwitcherComponent,
MiniBaseMapComponent,
MapOfflineDirective
MapOfflineDirective,
PointerPositionDirective,
PointerPositionByKeyDirective
]
})
export class IgoMapModule {}
2 changes: 2 additions & 0 deletions packages/geo/src/lib/map/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export * from './map.interface';
export * from './map.service';
export * from './map.utils';
export * from './mapOffline.directive';
export * from './map-pointer-position.directive';
export * from './map-pointer-position-by-key.directive';
export * from './projection.interfaces';
export * from './projection.service';
export * from './controllers';
Loading