-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(vectorLayer) add a hover directive #773 * feat(layerVector.hover) add hover for layer vector and fix #765 * feat(map.hover) delete hover screen on single click * feat (map.hover) fix lint * Delete mapboxStyle-covid.json no need ... * Delete mapboxStyle-covidcomplet.json no need ... * Update hover-routing.module.ts Co-authored-by: Marc-André Trottier <trottier.marcandre@msp.gouv.qc.ca> Co-authored-by: Marc-André Barbeau <marc-andre.barbeau@msp.gouv.qc.ca>
- Loading branch information
1 parent
09826e6
commit aa182ec
Showing
14 changed files
with
697 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Routes, RouterModule } from '@angular/router'; | ||
import { AppHoverComponent } from './hover.component'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: 'hover', | ||
component: AppHoverComponent | ||
} | ||
]; | ||
|
||
export const AppHoverRoutingModule = RouterModule.forChild( | ||
routes | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<mat-card> | ||
<mat-card-subtitle>Geo</mat-card-subtitle> | ||
<mat-card-title>Hover</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/hover">code of this example</a> | ||
<hr> | ||
</mat-card-content> | ||
|
||
<igo-map-browser [map]="map" [view]="view" | ||
igoHoverFeature | ||
[igoHoverFeatureDelay]="pointerHoverFeatureDelay" | ||
[igoHoverFeatureEnabled]="true"> | ||
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
igo-map-browser { | ||
width: 100%; | ||
height: 500px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { LanguageService, MediaService } from '@igo2/core'; | ||
import { IgoMap, DataSourceService, LayerService, WFSDataSourceOptions, VectorLayerOptions, WFSDataSource } from '@igo2/geo'; | ||
import { transform } from 'ol/proj'; | ||
|
||
@Component({ | ||
selector: 'app-hover', | ||
templateUrl: './hover.component.html', | ||
styleUrls: ['./hover.component.scss'] | ||
}) | ||
export class AppHoverComponent { | ||
public selected; | ||
public pointerCoord; | ||
public pointerCoordDelay: number = 0; | ||
public pointerHoverFeatureDelay: number = 0; | ||
public map = new IgoMap({ | ||
controls: { | ||
attribution: { | ||
collapsed: true | ||
}, | ||
scaleLine: true | ||
} | ||
}); | ||
|
||
public view = { | ||
center: [-73, 47.2], | ||
zoom: 8, | ||
projection: 'EPSG:3857' | ||
}; | ||
|
||
|
||
get media() { | ||
return this.mediaService.getMedia(); | ||
} | ||
|
||
get isTouchScreen() { | ||
return this.mediaService.isTouchScreen(); | ||
} | ||
|
||
constructor( | ||
private languageService: LanguageService, | ||
private dataSourceService: DataSourceService, | ||
private layerService: LayerService, | ||
private mediaService: MediaService | ||
) { | ||
|
||
this.dataSourceService | ||
.createAsyncDataSource({ | ||
type: 'wmts', | ||
url: 'https://geoegl.msp.gouv.qc.ca/carto/wmts/1.0.0/wmts', | ||
layer: 'carte_gouv_qc_public', | ||
matrixSet: 'EPSG_3857', | ||
version: '1.3.0' | ||
}) | ||
.subscribe(dataSource => { | ||
this.map.addLayer( | ||
this.layerService.createLayer({ | ||
title: 'Quebec', | ||
visible: true, | ||
baseLayer: true, | ||
source: dataSource | ||
}) | ||
); | ||
}); | ||
|
||
interface WFSDataOptions | ||
extends WFSDataSourceOptions {} | ||
|
||
const wfsDatasourcePolygon: WFSDataOptions = { | ||
type: 'wfs', | ||
url: '/ws/igo_gouvouvert.fcgi', | ||
params: { | ||
featureTypes: 'adn_bassin_n1_public_v', | ||
fieldNameGeometry: 'geometry', | ||
maxFeatures: 10000, | ||
version: '3.0.0', | ||
outputFormat: undefined, | ||
outputFormatDownload: 'shp' | ||
} | ||
}; | ||
|
||
this.dataSourceService | ||
.createAsyncDataSource(wfsDatasourcePolygon) | ||
.subscribe((dataSource: WFSDataSource) => { | ||
const layer: VectorLayerOptions = { | ||
title: 'WFS (polygon)', | ||
visible: true, | ||
source: dataSource | ||
}; | ||
this.map.addLayer(this.layerService.createLayer(layer)); | ||
}); | ||
|
||
const wfsDatasourcePoint: WFSDataOptions = { | ||
type: 'wfs', | ||
url: '/ws/igo_gouvouvert.fcgi', | ||
params: { | ||
featureTypes: 'CASERNE', | ||
fieldNameGeometry: 'geometry', | ||
maxFeatures: 10000, | ||
version: '3.0.0', | ||
outputFormat: undefined, | ||
outputFormatDownload: 'shp' | ||
} | ||
}; | ||
|
||
this.dataSourceService | ||
.createAsyncDataSource(wfsDatasourcePoint) | ||
.subscribe((dataSource: WFSDataSource) => { | ||
const layer: VectorLayerOptions = { | ||
title: 'WFS (point)', | ||
visible: true, | ||
source: dataSource, | ||
styleByAttribute: { | ||
attribute: 'en_caserne', | ||
data: ['true', 'false'], | ||
stroke: ['red', 'blue'], | ||
fill: ['#ffffff', '#ffffff'], | ||
radius: [7, 7], | ||
width: [2, 2], | ||
hoverStyle: { | ||
label: { | ||
attribute: 'Caserne: ${nom_service_incendie} \n Mun: ${ville}', | ||
style: { | ||
textAlign: 'left', | ||
textBaseline: 'bottom', | ||
font: '12px Calibri,sans-serif', | ||
fill: { color: '#000' }, | ||
backgroundFill: { color: 'rgba(255, 255, 255, 0.5)' }, | ||
backgroundStroke: { color: 'rgba(200, 200, 200, 0.75)', width: 2 }, | ||
stroke: { color: '#fff', width: 3 }, | ||
overflow: true, | ||
offsetX: 10, | ||
offsetY: -10, | ||
padding: [2.5, 2.5, 2.5, 2.5] | ||
} | ||
}, | ||
baseStyle: { | ||
circle: { | ||
stroke: { | ||
color: 'orange', | ||
width: 5 | ||
}, | ||
width: [5], | ||
radius: 15 | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
this.map.addLayer(this.layerService.createLayer(layer)); | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatCardModule } from '@angular/material/card'; | ||
|
||
import { IgoMapModule } from '@igo2/geo'; | ||
|
||
import { AppHoverComponent } from './hover.component'; | ||
import { AppHoverRoutingModule } from './hover-routing.module'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
@NgModule({ | ||
declarations: [AppHoverComponent], | ||
imports: [ | ||
CommonModule, | ||
AppHoverRoutingModule, | ||
MatCardModule, | ||
MatButtonModule, | ||
IgoMapModule | ||
], | ||
exports: [AppHoverComponent] | ||
}) | ||
export class AppHoverModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.