Compare commits

..

No commits in common. "57407d83d3ddad92eaf3a75e489338804e000b80" and "c6d14e6c9c8b824d2bc5657e770a9bc60495985b" have entirely different histories.

3 changed files with 41 additions and 76 deletions

View File

@ -1,6 +1,6 @@
{
"name": "farmmaps-lib-app",
"version": "1.1.5",
"version": "1.1.4",
"scripts": {
"ng": "ng",
"start": "ng serve",
@ -19,9 +19,9 @@
"@angular/platform-browser": "~11.2.14",
"@angular/platform-browser-dynamic": "~11.2.14",
"@angular/router": "~11.2.14",
"@farmmaps/common": "1.1.4",
"@farmmaps/common-map": "1.1.4",
"@farmmaps/common-map3d": "1.1.4",
"@farmmaps/common": "1.1.1-prerelease.2031",
"@farmmaps/common-map": "1.1.1-prerelease.2031",
"@farmmaps/common-map3d": "1.1.1-prerelease.2031",
"@microsoft/signalr": "^3.1.16",
"@ng-bootstrap/ng-bootstrap": "^9.0",
"@ngrx/effects": "^11.0",

View File

@ -1,4 +1,4 @@
import { Component, Input, AfterViewInit, ViewChild } from '@angular/core';
import { Component, Input, OnInit,ViewChild } from '@angular/core';
import { Feature} from 'ol';
import { Geometry } from 'ol/geom';
import * as extent from 'ol/extent';
@ -10,54 +10,23 @@ import * as style from 'ol/style';
templateUrl: './feature-thumbnail.component.html',
styleUrls: ['./feature-thumbnail.component.scss']
})
export class GeometryThumbnailComponent implements AfterViewInit {
export class GeometryThumbnailComponent implements OnInit {
constructor() { }
@ViewChild('canvas') canvas;
@ViewChild('container') container;
@Input('feature') feature:Feature;
private geometry:Geometry = null;
@Input() set feature(value:Feature) {
if(value) {
this.geometry = value.getGeometry();
} else {
this.geometry = null;
ngOnInit(): void {
}
this.render(this.canvas,
this.geometryStyle,
this.geometry,
this.width,
this.height);
};
private defaultStyle:style.Style = new style.Style({
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 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);
}
private width:number = 0;
private height:number = 0;
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 geom = geometry.clone(),
line = geom.getCoordinates()[0],
@ -76,20 +45,16 @@ export class GeometryThumbnailComponent implements AfterViewInit {
geom.translate( -dx, -dy );
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
geom.translate(width / 2,height / 2 );
renderContext.setStyle( style );
geom.translate( width / 2, height / 2 );
renderContext.setStyle( strokeStyle );
renderContext.drawGeometry( geom );
}
}
ngAfterViewInit() {
this.width = this.container.nativeElement.offsetWidth;
this.height = this.container.nativeElement.offsetHeight;
this.render(this.canvas,
this.geometryStyle,
this.geometry,
this.width,
this.height);
this.render(this.canvas.nativeElement,
this.container.nativeElement.offsetWidth,
this.container.nativeElement.offsetHeight,
this.feature.getGeometry());
}
}

View File

@ -1,8 +1,8 @@
{
"issuer": "http://localhost:8094",
"issuer": "https://accounts.test.farmmaps.eu",
"clientId": "farmmapsdev",
"audience": "http://localhost:8082/",
"requireHttps": false,
"audience": "http://localhost:8082",
"requireHttps": true,
"apiEndPoint": "http://localhost:8082",
"grantType":"code"
}