-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from IGNF/12-sélectionner-un-sp-et-visualiser-…
…ses-informations 12 sélectionner un sp et visualiser ses informations
- Loading branch information
Showing
33 changed files
with
808 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ testem.log | |
# System files | ||
.DS_Store | ||
Thumbs.db | ||
/src/assets/customConfig-dev.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { SpselectorComponent } from './spselector.component'; | ||
|
||
describe('SpselectorComponent', () => { | ||
let component: SpselectorComponent; | ||
let fixture: ComponentFixture<SpselectorComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [SpselectorComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(SpselectorComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,74 @@ | ||
import { Component, Input, ElementRef, OnInit } from '@angular/core'; | ||
|
||
import Map from 'ol/Map'; | ||
import Style, { StyleLike } from 'ol/style/Style'; | ||
import Icon from 'ol/style/Icon'; | ||
|
||
import {Select} from 'ol/interaction'; | ||
import { Feature } from 'ol'; | ||
|
||
import { RightpanelService } from '../../rightpanel/rightpanel.service'; | ||
import { DefaultComponent } from '../../rightpanel/content/default/default.component'; | ||
import { ServicePublicComponent } from '../../rightpanel/content/service-public/service-public.component'; | ||
|
||
|
||
@Component({ | ||
selector: 'app-spselector', | ||
standalone: true, | ||
imports: [], | ||
template: '', | ||
}) | ||
export class SpselectorComponent implements OnInit { | ||
@Input() map!: Map; | ||
control!: Select; | ||
|
||
constructor(private elementRef: ElementRef, private rightpanelService: RightpanelService) {} | ||
|
||
ngOnInit() { | ||
var oldfeature: Feature; | ||
var oldstyle: StyleLike | undefined; | ||
|
||
// marker style select | ||
var selectStyle = new Style({ | ||
image: new Icon({ | ||
anchor: [0.5, 37], | ||
anchorXUnits: 'fraction', | ||
anchorYUnits: 'pixels', | ||
src: 'assets/images/mapmarker/pin.svg', | ||
}) | ||
}); | ||
|
||
var splayer = this.map.getAllLayers()[2]; | ||
|
||
this.map.on('click', evt => { | ||
let features = this.map.getFeaturesAtPixel(evt.pixel, { | ||
layerFilter: (layer) => { | ||
return splayer == layer; | ||
}, | ||
}); | ||
|
||
if(features[0]){ | ||
var newfeature = features[0] as Feature; | ||
|
||
// restore old style | ||
if(oldfeature){ | ||
oldfeature.setStyle(oldstyle); | ||
} | ||
|
||
// saving old feature | ||
oldfeature = newfeature; | ||
oldstyle = oldfeature.getStyle(); | ||
|
||
newfeature.setStyle(selectStyle); | ||
if(this.rightpanelService.isExpanded !== true ){ | ||
this.rightpanelService.toggleRightpanel(); | ||
} | ||
this.rightpanelService.setContent(ServicePublicComponent, newfeature.getProperties()); | ||
}else{ | ||
if(oldfeature){ | ||
oldfeature.setStyle(oldstyle); | ||
} | ||
} | ||
}); | ||
} | ||
} |
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
Empty file.
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 @@ | ||
<p>default works!</p> |
23 changes: 23 additions & 0 deletions
23
src/app/rightpanel/content/default/default.component.spec.ts
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,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DefaultComponent } from './default.component'; | ||
|
||
describe('DefaultComponent', () => { | ||
let component: DefaultComponent; | ||
let fixture: ComponentFixture<DefaultComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [DefaultComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(DefaultComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,16 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
template: `<p>hello</p>`, | ||
}) | ||
export class DefaultComponent implements OnInit { | ||
@Input() data!: any; | ||
|
||
ngOnInit() { | ||
console.log(this.data); | ||
} | ||
|
||
whoAmI() { | ||
return 'I am a child component!'; | ||
} | ||
} |
Oops, something went wrong.