Merge branch 'hotfix/AW-3412'
All checks were successful
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
commit
57407d83d3
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "farmmaps-lib-app",
|
"name": "farmmaps-lib-app",
|
||||||
"version": "1.1.4",
|
"version": "1.1.5",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
@ -19,9 +19,9 @@
|
|||||||
"@angular/platform-browser": "~11.2.14",
|
"@angular/platform-browser": "~11.2.14",
|
||||||
"@angular/platform-browser-dynamic": "~11.2.14",
|
"@angular/platform-browser-dynamic": "~11.2.14",
|
||||||
"@angular/router": "~11.2.14",
|
"@angular/router": "~11.2.14",
|
||||||
"@farmmaps/common": "1.1.1-prerelease.2031",
|
"@farmmaps/common": "1.1.4",
|
||||||
"@farmmaps/common-map": "1.1.1-prerelease.2031",
|
"@farmmaps/common-map": "1.1.4",
|
||||||
"@farmmaps/common-map3d": "1.1.1-prerelease.2031",
|
"@farmmaps/common-map3d": "1.1.4",
|
||||||
"@microsoft/signalr": "^3.1.16",
|
"@microsoft/signalr": "^3.1.16",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^9.0",
|
"@ng-bootstrap/ng-bootstrap": "^9.0",
|
||||||
"@ngrx/effects": "^11.0",
|
"@ngrx/effects": "^11.0",
|
||||||
|
@ -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 { Feature} from 'ol';
|
||||||
import { Geometry } from 'ol/geom';
|
import { Geometry } from 'ol/geom';
|
||||||
import * as extent from 'ol/extent';
|
import * as extent from 'ol/extent';
|
||||||
@ -10,51 +10,86 @@ import * as style from 'ol/style';
|
|||||||
templateUrl: './feature-thumbnail.component.html',
|
templateUrl: './feature-thumbnail.component.html',
|
||||||
styleUrls: ['./feature-thumbnail.component.scss']
|
styleUrls: ['./feature-thumbnail.component.scss']
|
||||||
})
|
})
|
||||||
export class GeometryThumbnailComponent implements OnInit {
|
export class GeometryThumbnailComponent implements AfterViewInit {
|
||||||
|
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
@ViewChild('canvas') canvas;
|
@ViewChild('canvas') canvas;
|
||||||
@ViewChild('container') container;
|
@ViewChild('container') container;
|
||||||
@Input('feature') feature:Feature;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
private geometry:Geometry = null;
|
||||||
|
@Input() set feature(value:Feature) {
|
||||||
|
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) {
|
private width:number = 0;
|
||||||
let renderContext = render.toContext(canvas.getContext( '2d'),{ size: [width, height] });
|
private height:number = 0;
|
||||||
|
|
||||||
let strokeStyle = new style.Style({
|
|
||||||
stroke: new style.Stroke({ color: 'black',width:1.5 })
|
|
||||||
});
|
|
||||||
|
|
||||||
let geom = geometry.clone(),
|
render(canvas,style:style.Style,geometry:Geometry,width:number,height:number) {
|
||||||
line = geom.getCoordinates()[0],
|
if(canvas && canvas.nativeElement && geometry && style) {
|
||||||
e = extent.boundingExtent( line );
|
let renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] });
|
||||||
|
|
||||||
let dxy = extent.getCenter(e),
|
let geom = geometry.clone(),
|
||||||
sxy = [
|
line = geom.getCoordinates()[0],
|
||||||
(width - 2 ) / extent.getWidth(e),
|
e = extent.boundingExtent( line );
|
||||||
(height - 2 ) / extent.getHeight(e)
|
|
||||||
];
|
let dxy = extent.getCenter(e),
|
||||||
|
sxy = [
|
||||||
let dx = dxy[0],
|
(width - 2 ) / extent.getWidth(e),
|
||||||
dy = dxy[1],
|
(height - 2 ) / extent.getHeight(e)
|
||||||
sx = sxy[0],
|
];
|
||||||
sy = sxy[1];
|
|
||||||
|
let dx = dxy[0],
|
||||||
geom.translate( -dx, -dy );
|
dy = dxy[1],
|
||||||
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
|
sx = sxy[0],
|
||||||
geom.translate( width / 2, height / 2 );
|
sy = sxy[1];
|
||||||
|
|
||||||
renderContext.setStyle( strokeStyle );
|
geom.translate( -dx, -dy );
|
||||||
renderContext.drawGeometry( geom );
|
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
|
||||||
|
geom.translate(width / 2,height / 2 );
|
||||||
|
renderContext.setStyle( style );
|
||||||
|
renderContext.drawGeometry( geom );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.render(this.canvas.nativeElement,
|
this.width = this.container.nativeElement.offsetWidth;
|
||||||
this.container.nativeElement.offsetWidth,
|
this.height = this.container.nativeElement.offsetHeight;
|
||||||
this.container.nativeElement.offsetHeight,
|
this.render(this.canvas,
|
||||||
this.feature.getGeometry());
|
this.geometryStyle,
|
||||||
|
this.geometry,
|
||||||
|
this.width,
|
||||||
|
this.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"issuer": "https://accounts.test.farmmaps.eu",
|
"issuer": "http://localhost:8094",
|
||||||
"clientId": "farmmapsdev",
|
"clientId": "farmmapsdev",
|
||||||
"audience": "http://localhost:8082",
|
"audience": "http://localhost:8082/",
|
||||||
"requireHttps": true,
|
"requireHttps": false,
|
||||||
"apiEndPoint": "http://localhost:8082",
|
"apiEndPoint": "http://localhost:8082",
|
||||||
"grantType":"code"
|
"grantType":"code"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user