Compare commits

...

12 Commits

Author SHA1 Message Date
Willem Dantuma 48574dc0b0 Merge tag 'AW-3412' into develop
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit Details
# Conflicts:
#	package.json
#	projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts
#	src/configuration.json
2022-01-19 13:29:44 +01:00
Willem Dantuma 57407d83d3 Merge branch 'hotfix/AW-3412'
FarmMaps/FarmMapsLib/pipeline/head This commit looks good Details
2022-01-19 13:24:14 +01:00
Willem Dantuma f83549b5af Update version 2022-01-19 13:22:55 +01:00
Willem Dantuma 132556da81 AW-3412 2022-01-19 13:21:44 +01:00
Willem Dantuma c2350eec52 Fix configuration for local authentication 2022-01-19 11:56:30 +01:00
Willem Dantuma c6d14e6c9c Export interface
FarmMaps/FarmMapsLib/pipeline/head This commit looks good Details
2021-12-02 11:23:36 +01:00
Willem Dantuma 8e4364bd08 bump version
FarmMaps/FarmMapsLib/pipeline/head This commit looks good Details
2021-12-02 11:16:43 +01:00
Willem Dantuma af3340ed70 Inject clicked feature in component
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit Details
2021-12-02 11:13:36 +01:00
Willem Dantuma ff19d830a7 Fix version
FarmMaps/FarmMapsLib/pipeline/head This commit looks good Details
2021-11-26 12:06:17 +01:00
Willem Dantuma 29914cfb1b oops
FarmMaps/FarmMapsLib/pipeline/head Something is wrong with the build of this commit Details
2021-11-26 12:04:17 +01:00
Willem Dantuma 7bca0a57c4 Fix build
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit Details
2021-11-26 12:02:01 +01:00
Willem Dantuma fdba357e9c Fix matching
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit Details
2021-11-26 11:58:11 +01:00
3 changed files with 75 additions and 39 deletions

8
Jenkinsfile vendored
View File

@ -8,13 +8,13 @@ pipeline {
stage('npm install'){
steps {
sh '''rm -rf node_modules/
npm install
npm install --legacy-peer-deps
cd projects/common
npm install
npm install --legacy-peer-deps
cd ../common-map
npm install
npm install --legacy-peer-deps
cd ../common-map3d
npm install
npm install --legacy-peer-deps
'''
}
}

View File

@ -164,7 +164,8 @@ export {
ITemporalItemLayer,
TemporalItemLayer,
ifZoomToShowDirective,
ZoomToShowAlert
ZoomToShowAlert,
IClickedFeature
}
@NgModule({

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit,ViewChild } from '@angular/core';
import { Component, Input, AfterViewInit, ViewChild } from '@angular/core';
import { Feature} from 'ol';
import { Geometry,Polygon,MultiPolygon } from 'ol/geom';
import * as extent from 'ol/extent';
@ -10,51 +10,86 @@ import * as style from 'ol/style';
templateUrl: './feature-thumbnail.component.html',
styleUrls: ['./feature-thumbnail.component.scss']
})
export class GeometryThumbnailComponent implements OnInit {
export class GeometryThumbnailComponent implements AfterViewInit {
constructor() { }
@ViewChild('canvas') canvas;
@ViewChild('container') container;
@Input('feature') feature:Feature<Geometry>;
ngOnInit(): void {
private geometry:Geometry = null;
@Input() set feature(value:Feature<Geometry>) {
if(value) {
this.geometry = value.getGeometry();
} else {
this.geometry = null;
}
this.render(this.canvas,
this.geometryStyle,
this.geometry,
this.width,
this.height);
};
private defaultStyle:style.Style = new style.Style({
stroke: new style.Stroke({ color: 'black',width:1.5 })
});
private geometryStyle:style.Style = this.defaultStyle;
@Input() set fillColor(value:string) {
if(style) {
this.geometryStyle = new style.Style({
stroke: new style.Stroke({ color: 'black',width:1.5 }),
fill: new style.Fill({color: value})
});
} else {
this.geometryStyle = this.defaultStyle
}
this.render(this.canvas,
this.geometryStyle,
this.geometry,
this.width,
this.height);
}
render(canvas,width,height,geometry:Geometry) {
let renderContext = render.toContext(canvas.getContext( '2d'),{ size: [width, height] });
let strokeStyle = new style.Style({
stroke: new style.Stroke({ color: 'black',width:1.5 })
});
private width:number = 0;
private height:number = 0;
let geom = geometry.clone() as Polygon,
line = geom.getCoordinates()[0],
e = extent.boundingExtent( line );
render(canvas,style:style.Style,geometry:Geometry,width:number,height:number) {
if(canvas && canvas.nativeElement && geometry && style) {
let renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] });
let dxy = extent.getCenter(e),
sxy = [
(width - 2 ) / extent.getWidth(e),
(height - 2 ) / extent.getHeight(e)
];
let dx = dxy[0],
dy = dxy[1],
sx = sxy[0],
sy = sxy[1];
geom.translate( -dx, -dy );
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
geom.translate( width / 2, height / 2 );
renderContext.setStyle( strokeStyle );
renderContext.drawGeometry( geom );
let geom = geometry.clone(),
line = geom.getCoordinates()[0],
e = extent.boundingExtent( line );
let dxy = extent.getCenter(e),
sxy = [
(width - 2 ) / extent.getWidth(e),
(height - 2 ) / extent.getHeight(e)
];
let dx = dxy[0],
dy = dxy[1],
sx = sxy[0],
sy = sxy[1];
geom.translate( -dx, -dy );
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
geom.translate(width / 2,height / 2 );
renderContext.setStyle( style );
renderContext.drawGeometry( geom );
}
}
ngAfterViewInit() {
this.render(this.canvas.nativeElement,
this.container.nativeElement.offsetWidth,
this.container.nativeElement.offsetHeight,
this.feature.getGeometry());
this.width = this.container.nativeElement.offsetWidth;
this.height = this.container.nativeElement.offsetHeight;
this.render(this.canvas,
this.geometryStyle,
this.geometry,
this.width,
this.height);
}
}